prefect_azure.workers.container_instance
Module containing the Azure Container Instances worker used for executing flow
runs in ACI containers.
To start an ACI worker, run the following command:
my-work-pool with the name of the work pool you want the worker
to poll for flow runs.
!!! example “Using a custom ARM template”
To facilitate easy customization, the Azure Container worker provisions a
containing group using an ARM template. The default ARM template is represented
in YAML as follows:
{{ }} is a placeholder that will be replaced with
a value at runtime. The values that can be used a placeholders are defined
by the variables schema defined in the base job template.
The default job manifest and available variables can be customized on a work pool
by work pool basis. These customizations can be made via the Prefect UI when
creating or editing a work pool.
Using an ARM template makes the worker flexible; you’re not limited to using the
features the worker provides out of the box. Instead, you can modify the ARM
template to use any features available in Azure Container Instances.
Classes
ContainerGroupProvisioningState
Terminal provisioning states for ACI container groups. Per the Azure docs,
the states in this Enum are the only ones that can be relied on as dependencies.
ContainerRunState
Terminal run states for ACI containers.
AzureContainerJobConfiguration
Configuration for an Azure Container Instance flow run.
Methods:
prepare_for_flow_run
AzureContainerVariables
Variables for an Azure Container Instance flow run.
AzureContainerWorkerResult
Contains information about the final state of a completed process
AzureContainerWorker
A Prefect worker that runs flows in an Azure Container Instance.
Methods:
kill_infrastructure
configuration.keep_container_group is True, the container group will be
stopped but not deleted. Otherwise, the container group will be deleted.
Args:
infrastructure_pid: The infrastructure identifier in format “flow_run_id:container_group_name”.configuration: The job configuration used to connect to Azure.grace_seconds: Not directly used for ACI (Azure handles graceful shutdown).
InfrastructureNotFound: If the container group doesn’t exist.
run
- The result of the flow run.