Frontend¶
- class lightning.app.frontend.frontend.Frontend[source]¶
Bases:
ABCBase class for any frontend that gets exposed by LightningFlows.
The flow attribute will be set by the app while bootstrapping.
- abstract start_server(host, port, root_path='')[source]¶
Start the process that serves the UI at the given hostname and port number.
- Parameters
host¶ (
str) – The hostname where the UI will be served. This gets determined by the dispatcher (e.g., cloud), but defaults to localhost when running locally.port¶ (
int) – The port number where the UI will be served. This gets determined by the dispatcher, which by default chooses any free port when running locally.root_path¶ (
str) – root_path for the server if app in exposed via a proxy at /<root_path>
- Return type
Example
An custom implementation could look like this:
def start_server(self, host, port, root_path=""): self._process = subprocess.Popen(["flask", "run" "--host", host, "--port", str(port)])
- abstract stop_server()[source]¶
Stop the process that was started with
start_server()so the App can shut down.This method gets called when the LightningApp terminates.
- Return type
Example
def stop_server(self): self._process.kill()