Skip to main content

App

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

AttributeTypeDescription
pb2app_definition_pb2.AppThis 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

NameTypeDescription
pb2app_definition_pb2.App = nullThe protobuf representation of the app.

Methods


name()

@classmethod
def name() - > str

Get the name of the app.

Returns

TypeDescription
str

revision()

@classmethod
def revision() - > int

Get the revision number of the app.

Returns

TypeDescription
int

endpoint()

@classmethod
def endpoint() - > str

Get the public endpoint URL of the app.

Returns

TypeDescription
str

deployment_status()

@classmethod
def deployment_status() - > app_definition_pb2.Status.DeploymentStatus

Get the deployment status of the app

Returns

TypeDescription
app_definition_pb2.Status.DeploymentStatus

desired_state()

@classmethod
def desired_state() - > app_definition_pb2.Spec.DesiredState

Get the desired state of the app.

Returns

TypeDescription
app_definition_pb2.Spec.DesiredState

is_active()

@classmethod
def is_active() - > bool

Check if the app is currently active or started.

Returns

TypeDescription
bool

is_deactivated()

@classmethod
def is_deactivated() - > bool

Check if the app is currently deactivated or stopped.

Returns

TypeDescription
bool

url()

@classmethod
def url() - > str

Get the console URL for viewing the app.

Returns

TypeDescription
str

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

NameTypeDescription
wait_forWaitFor = "activated"The state to wait for, either "activated" or "deactivated".

Returns

TypeDescription
[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

NameTypeDescription
waitbool = FalseWait for the app to reach activated state

Returns

TypeDescription
[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

NameTypeDescription
waitbool = FalseWait for the app to reach the deactivated state

Returns

TypeDescription
[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

TypeDescription
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

TypeDescription
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

NameTypeDescription
updated_app_protoapp_definition_pb2.AppThe protobuf message containing the updated app definition.
reasonstrA string explaining the reason for the update.

Returns

TypeDescription
[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

NameTypeDescription
namestrThe name of the app to delete.
project`strNone` = None
domain`strNone` = 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

NameTypeDescription
namestrName of the new app
updated_app_specapp_definition_pb2.SpecUpdated app spec
reasonstrThe reason for replacing the app.
labels`Mapping[str, str]None` = None
project`strNone` = None
domain`strNone` = None

Returns

TypeDescription
[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

NameTypeDescription
namestrThe name of the app.
project`strNone` = None
domain`strNone` = None

Returns

TypeDescription
[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

NameTypeDescription
created_by_subject`strNone` = None
sort_by`Tuple[str, Literal["asc", "desc"]]None` = None
limitint = 100The maximum number of applications to return.

Returns

TypeDescription
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

NameTypeDescription
appapp_definition_pb2.AppThe protobuf message containing the definition of the app to create.

Returns

TypeDescription
[App](app.md?sid=flyte_remote__app_app)The newly created App object.