This class represents an application and provides methods for managing its lifecycle. It allows users to activate, deactivate, watch, and update applications, as well as retrieve their status and properties. The class also supports creating, retrieving, listing, replacing, and deleting applications.
Attributes
| Attribute | Type | Description |
|---|
| pb2 | app_definition_pb2.App | This attribute stores an instance of app_definition_pb2.App, which represents the protobuf definition of the application and is used to access its properties and status. |
Constructor
Signature
def App(
pb2: app_definition_pb2.App = null
) - > null
Parameters
| Name | Type | Description |
|---|
| pb2 | app_definition_pb2.App = null | The protobuf representation of the app. |
Methods
name()
@classmethod
def name() - > str
Get the name of the app.
Returns
revision()
@classmethod
def revision() - > int
Get the revision number of the app.
Returns
endpoint()
@classmethod
def endpoint() - > str
Get the public endpoint URL of the app.
Returns
deployment_status()
@classmethod
def deployment_status() - > app_definition_pb2.Status.DeploymentStatus
Get the deployment status of the app
Returns
| Type | Description |
|---|
app_definition_pb2.Status.DeploymentStatus | |
desired_state()
@classmethod
def desired_state() - > app_definition_pb2.Spec.DesiredState
Get the desired state of the app.
Returns
| Type | Description |
|---|
app_definition_pb2.Spec.DesiredState | |
is_active()
@classmethod
def is_active() - > bool
Check if the app is currently active or started.
Returns
is_deactivated()
@classmethod
def is_deactivated() - > bool
Check if the app is currently deactivated or stopped.
Returns
url()
@classmethod
def url() - > str
Get the console URL for viewing the app.
Returns
watch()
@classmethod
def watch(
wait_for: WaitFor = "activated"
) - > [App](app.md?sid=flyte_remote__app_app)
Watch for the app to reach activated or deactivated state.
Parameters
| Name | Type | Description |
|---|
| wait_for | WaitFor = "activated" | The state to wait for, either "activated" or "deactivated". |
Returns
| Type | Description |
|---|
[App](app.md?sid=flyte_remote__app_app) | The app in the desired state. |
activate()
@classmethod
def activate(
wait: bool = False
) - > [App](app.md?sid=flyte_remote__app_app)
Start the app
Parameters
| Name | Type | Description |
|---|
| wait | bool = False | Wait for the app to reach activated state |
Returns
| Type | Description |
|---|
[App](app.md?sid=flyte_remote__app_app) | |
deactivate()
@classmethod
def deactivate(
wait: bool = False
) - > [App](app.md?sid=flyte_remote__app_app)
Stop the app
Parameters
| Name | Type | Description |
|---|
| wait | bool = False | Wait for the app to reach the deactivated state |
Returns
| Type | Description |
|---|
[App](app.md?sid=flyte_remote__app_app) | |
ephemeral_ctx()
@classmethod
def ephemeral_ctx() - > AsyncGenerator[None, None]
Async context manager that activates the app and deactivates it when the context is exited.
Returns
| Type | Description |
|---|
AsyncGenerator[None, None] | |
ephemeral_ctx_sync()
@classmethod
def ephemeral_ctx_sync() - > Generator[None, None, None]
Context manager that activates the app and deactivates it when the context is exited.
Returns
| Type | Description |
|---|
Generator[None, None, None] | |
update()
@classmethod
def update(
updated_app_proto: app_definition_pb2.App,
reason: str
) - > [App](app.md?sid=flyte_remote__app_app)
Updates an existing app with the provided app protobuf and reason.
Parameters
| Name | Type | Description |
|---|
| updated_app_proto | app_definition_pb2.App | The protobuf message containing the updated app definition. |
| reason | str | A string explaining the reason for the update. |
Returns
| Type | Description |
|---|
[App](app.md?sid=flyte_remote__app_app) | The updated App object. |
delete()
@classmethod
def delete(
name: str,
project: str | None = None,
domain: str | None = None
)
Delete an app by name.
Parameters
| Name | Type | Description |
|---|
| name | str | The name of the app to delete. |
| project | `str | None` = None |
| domain | `str | None` = None |
replace()
@classmethod
def replace(
name: str,
updated_app_spec: app_definition_pb2.Spec,
reason: str,
labels: Mapping[str, str]| None = None,
project: str | None = None,
domain: str | None = None
) - > [App](app.md?sid=flyte_remote__app_app)
Replace an existing app's that matches the given name, with a new spec and optionally labels.
Parameters
| Name | Type | Description |
|---|
| name | str | Name of the new app |
| updated_app_spec | app_definition_pb2.Spec | Updated app spec |
| reason | str | The reason for replacing the app. |
| labels | `Mapping[str, str] | None` = None |
| project | `str | None` = None |
| domain | `str | None` = None |
Returns
| Type | Description |
|---|
[App](app.md?sid=flyte_remote__app_app) | A new app |
get()
@classmethod
def get(
name: str,
project: str | None = None,
domain: str | None = None
) - > [App](app.md?sid=flyte_remote__app_app)
Get an app by name.
Parameters
| Name | Type | Description |
|---|
| name | str | The name of the app. |
| project | `str | None` = None |
| domain | `str | None` = None |
Returns
| Type | Description |
|---|
[App](app.md?sid=flyte_remote__app_app) | The app remote object. |
listall()
@classmethod
def listall(
created_by_subject: str | None = None,
sort_by: Tuple[str, Literal["asc", "desc"]]| None = None,
limit: int = 100
) - > AsyncIterator[[App](app.md?sid=flyte_remote__app_app)]
Lists all applications, optionally filtered by the creator and sorted.
Parameters
| Name | Type | Description |
|---|
| created_by_subject | `str | None` = None |
| sort_by | `Tuple[str, Literal["asc", "desc"]] | None` = None |
| limit | int = 100 | The maximum number of applications to return. |
Returns
| Type | Description |
|---|
AsyncIterator[[App](app.md?sid=flyte_remote__app_app)] | An asynchronous iterator yielding App objects. |
create()
@classmethod
def create(
app: app_definition_pb2.App
) - > [App](app.md?sid=flyte_remote__app_app)
Creates a new application based on the provided app protobuf definition.
Parameters
| Name | Type | Description |
|---|
| app | app_definition_pb2.App | The protobuf message containing the definition of the app to create. |
Returns
| Type | Description |
|---|
[App](app.md?sid=flyte_remote__app_app) | The newly created App object. |