LightningApp¶
- class lightning.app.core.app.LightningApp(root, flow_cloud_compute=None, log_level='info', info=None, root_path='')
Bases:
object
The Lightning App, or App in short runs a tree of one or more components that interact to create end-to-end applications. There are two kinds of components:
LightningFlow
andLightningWork
. This modular design enables you to reuse components created by other users.The Lightning App alternatively run an event loop triggered by delta changes sent from either
LightningWork
or from the Lightning UI. Once deltas are received, the Lightning App runs theLightningFlow
provided.- Parameters
root¶ (
Union
[LightningFlow
,LightningWork
]) – The rootLightningFlow
orLightningWork
component, that defines all the app’s nested components, running infinitely. It must define a run() method that the app can call.flow_cloud_compute¶ (
Optional
[CloudCompute
]) – The default Cloud Compute used for flow, Rest API and frontend’s.log_level¶ (
str
) – The log level for the app, one of [info, debug]. This can be helpful when reporting bugs on Lightning repo.info¶ (
Optional
[AppInfo
]) – Provide additional info about the app which will be used to update html title, description and image meta tags and specify any additional tags as list of html strings.root_path¶ (
str
) – Set this to /path if you want to run your app behind a proxy at /path leave empty for “/”. For instance, if you want to run your app at https://customdomain.com/myapp, set root_path to /myapp. You can learn more about proxy here.
- run_once()
Method used to collect changes and run the root Flow once.
- Return type
- property flows: List[Union[LightningWork, LightningFlow]]
Returns all the flows defined within this application.
- property last_state: dict
Returns the latest state.
- property named_works: List[Tuple[str, LightningWork]]
Returns all the works defined within this application with their names.
- property root: Union[LightningFlow, LightningWork]
Returns the root component of the application.
- property state: dict
Return the current state of the application.
- property state_vars: dict
Return the current state restricted to the user defined variables of the application.
- property state_with_changes: dict
Return the current state with the new changes of the application.
- property works: List[LightningWork]
Returns all the works defined within this application.