@app_deploy
Simplify bookkeeping and lifecycle management for apps deployed from Metaflow flows.
While you can deploy apps from within a flow using the AppDeployer API directly,
doing so at scale introduces operational challenges: tracking which apps belong to
which run, cleaning up apps when flows complete or fail, and discovering apps
deployed across many runs. This decorator addresses these concerns automatically.
When applied to a flow, @app_deploy provides:
- Automatic Tagging: Every app deployed gains Metaflow metadata tags (flow name, run ID, step, task ID, project/branch info) enabling easy discovery and association with specific flow executions.
- Lifecycle Management: Configure automatic cleanup policies to scale down or delete apps when the flow exits (on success or failure), preventing orphaned apps from accumulating.
-
Convenient Access: Exposes
current.appswith the flow’s code package and container image, plus alist()method to discover all apps deployed in the current run.
Action to perform on all apps deployed in this run when the flow exits:
"none": No cleanup; apps remain running after flow completion."scale_down": Scale all deployed apps to zero replicas."delete": Delete all deployed apps.
current.apps
Manager for apps deployed within a Metaflow flow execution.
Accessible via current.apps when using the @app_deploy decorator.
Provides access to the flow’s code package, container image, and
methods to list apps deployed in the current run.
Attributes:
Examples: