Protocol defining the common interface between local and remote app handles. Both _LocalApp (local serving) and App (remote serving) satisfy this protocol, enabling calling code to work uniformly regardless of the serving mode.
Attributes
| Attribute | Type | Description |
|---|
| name | str | This attribute stores the name of the application handle, used to identify the application. |
| url | str | This attribute stores the URL where the application is accessible, used for direct access to the application. |
| endpoint | str | This attribute stores the specific API endpoint for the application, used for programmatic interaction with the application. |
Methods
name()
@classmethod
def name() - > str
Retrieves the name of the application handle.
Returns
| Type | Description |
|---|
str | The string name of the application. |
url()
@classmethod
def url() - > str
Retrieves the URL where the application is accessible.
Returns
| Type | Description |
|---|
str | The string URL of the application. |
endpoint()
@classmethod
def endpoint() - > str
Retrieves the endpoint identifier for the application.
Returns
| Type | Description |
|---|
str | The string endpoint identifier. |
is_active()
@classmethod
def is_active() - > bool
Checks if the application handle is currently active.
Returns
| Type | Description |
|---|
bool | True if the application is active, False otherwise. |
is_deactivated()
@classmethod
def is_deactivated() - > bool
Checks if the application handle is currently deactivated.
Returns
| Type | Description |
|---|
bool | True if the application is deactivated, False otherwise. |
activate()
@classmethod
def activate(
wait: bool = False
) - > [AppHandle](apphandle.md?sid=flyte__serve_apphandle)
Activates the application handle, making it ready for use. Callers use this to start the application.
Parameters
| Name | Type | Description |
|---|
| wait | bool = False | A boolean indicating whether to wait for the activation process to complete before returning. |
Returns
| Type | Description |
|---|
[AppHandle](apphandle.md?sid=flyte__serve_apphandle) | The activated AppHandle instance. |
deactivate()
@classmethod
def deactivate(
wait: bool = False
) - > [AppHandle](apphandle.md?sid=flyte__serve_apphandle)
Deactivates the application handle, stopping its operation. Callers use this to shut down the application.
Parameters
| Name | Type | Description |
|---|
| wait | bool = False | A boolean indicating whether to wait for the deactivation process to complete before returning. |
Returns
| Type | Description |
|---|
[AppHandle](apphandle.md?sid=flyte__serve_apphandle) | The deactivated AppHandle instance. |
ephemeral_ctx()
@classmethod
def ephemeral_ctx() - > AbstractAsyncContextManager[None]
Provides an asynchronous context manager for ephemeral application states. Callers use this for temporary application configurations that are automatically cleaned up.
Returns
| Type | Description |
|---|
AbstractAsyncContextManager[None] | An asynchronous context manager that manages an ephemeral state. |
ephemeral_ctx_sync()
@classmethod
def ephemeral_ctx_sync() - > AbstractContextManager[None]
Provides a synchronous context manager for ephemeral application states. Callers use this for temporary application configurations that are automatically cleaned up in a synchronous context.
Returns
| Type | Description |
|---|
AbstractContextManager[None] | A synchronous context manager that manages an ephemeral state. |