Skip to main content

AppHandle

Protocol defining the common interface between local and remote app handles.

Attributes​

AttributeTypeDescription
namestrUnique name identifying the application.
urlstrNetwork URL used to access the running application.
endpointstrEndpoint address used for interacting with the application.

Methods​


name()​

@classmethod
def name() -> str

Retrieves the name of the application handle.

Returns​

TypeDescription
strThe unique name identifying the application.

url()​

@classmethod
def url() -> str

Retrieves the base URL for the serving application.

Returns​

TypeDescription
strThe URL where the application is accessible.

endpoint()​

@classmethod
def endpoint() -> str

Retrieves the endpoint path or identifier for the application.

Returns​

TypeDescription
strThe endpoint string used to route requests to the application.

is_active()​

@classmethod
def is_active() -> bool

Checks whether the application is currently active and running.

Returns​

TypeDescription
boolTrue if the application is currently active; otherwise False.

is_deactivated()​

@classmethod
def is_deactivated() -> bool

Checks whether the application has been deactivated.

Returns​

TypeDescription
boolTrue if the application is currently deactivated; otherwise False.

activate()​

@classmethod
def activate(
wait: bool = False
) -> [AppHandle](apphandle.md?sid=flyte__serve_apphandle)

Activates the application so it can begin serving requests.

Parameters​

NameTypeDescription
waitbool = FalseWhether to block execution until the application is fully activated.

Returns​

TypeDescription
[AppHandle](apphandle.md?sid=flyte__serve_apphandle)The activated application handle instance.

deactivate()​

@classmethod
def deactivate(
wait: bool = False
) -> [AppHandle](apphandle.md?sid=flyte__serve_apphandle)

Deactivates the application to stop serving requests.

Parameters​

NameTypeDescription
waitbool = FalseWhether to block execution until the application is fully deactivated.

Returns​

TypeDescription
[AppHandle](apphandle.md?sid=flyte__serve_apphandle)The deactivated application handle instance.

ephemeral_ctx()​

@classmethod
def ephemeral_ctx() -> AbstractAsyncContextManager[None]

Provides an asynchronous context manager that keeps the application active temporarily within the context scope.

Returns​

TypeDescription
AbstractAsyncContextManager[None]An async context manager managing the temporary lifecycle of the application.

ephemeral_ctx_sync()​

@classmethod
def ephemeral_ctx_sync() -> AbstractContextManager[None]

Provides a synchronous context manager that keeps the application active temporarily within the context scope.

Returns​

TypeDescription
AbstractContextManager[None]A synchronous context manager managing the temporary lifecycle of the application.