Skip to main content

AppHandle

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

Attributes​

AttributeTypeDescription
namestrThe unique identifier of the application used for referencing it within the serving environment.
urlstrThe base URL where the application is hosted and accessible for network requests.
endpointstrThe specific entry point or API path used to interact with the application's primary functionality.

Methods​


name()​

@classmethod
def name() - > str

The unique identifier or display name of the application instance.

Returns​

TypeDescription
strThe string name of the app.

url()​

@classmethod
def url() - > str

The base URL where the application is currently hosted or accessible.

Returns​

TypeDescription
strThe full URL string for the application.

endpoint()​

@classmethod
def endpoint() - > str

The specific network endpoint or address used for communicating with the application.

Returns​

TypeDescription
strThe endpoint address string.

is_active()​

@classmethod
def is_active() - > bool

Checks whether the application is currently running and ready to handle requests.

Returns​

TypeDescription
boolTrue if the app is active, False otherwise.

is_deactivated()​

@classmethod
def is_deactivated() - > bool

Checks whether the application has been shut down or moved to a deactivated state.

Returns​

TypeDescription
boolTrue if the app is deactivated, False otherwise.

activate()​

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

Transitions the application to an active state to begin serving traffic.

Parameters​

NameTypeDescription
waitbool = FalseWhether to block execution until the application has fully finished its activation sequence.

Returns​

TypeDescription
[AppHandle](apphandle.md?sid=flyte__serve_apphandle)The AppHandle instance for chaining calls.

deactivate()​

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

Transitions the application to a deactivated state and stops serving traffic.

Parameters​

NameTypeDescription
waitbool = FalseWhether to block execution until the application has fully finished its deactivation sequence.

Returns​

TypeDescription
[AppHandle](apphandle.md?sid=flyte__serve_apphandle)The AppHandle instance for chaining calls.

ephemeral_ctx()​

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

Provides an asynchronous context manager that activates the app on entry and deactivates it on exit.

Returns​

TypeDescription
AbstractAsyncContextManager[None]An async context manager for managing the app lifecycle.

ephemeral_ctx_sync()​

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

Provides a synchronous context manager that activates the app on entry and deactivates it on exit.

Returns​

TypeDescription
AbstractContextManager[None]A context manager for managing the app lifecycle in synchronous code.