prefect_azure.container_instance
Integrations with the Azure Container Instances service. Note this module is experimental. The interfaces within may change without notice.
The AzureContainerInstanceJob
infrastructure block in this module is ideally
configured via the Prefect UI and run via a Prefect agent, but it can be called directly
as demonstrated in the following examples.
Examples:
Run a command using an Azure Container Instances container.
AzureContainerInstanceJob(command=["echo", "hello world"]).run()
Run a command and stream the container's output to the local terminal.
AzureContainerInstanceJob(
command=["echo", "hello world"],
stream_output=True,
)
Run a command with a specific image
AzureContainerInstanceJob(command=["echo", "hello world"], image="alpine:latest")
Run a task with custom memory and CPU requirements
AzureContainerInstanceJob(command=["echo", "hello world"], memory=1.0, cpu=1.0)
Run a task with custom memory and CPU requirements
AzureContainerInstanceJob(command=["echo", "hello world"], memory=1.0, cpu=1.0)
Run a task with custom memory, CPU, and GPU requirements
AzureContainerInstanceJob(command=["echo", "hello world"], memory=1.0, cpu=1.0,
gpu_count=1, gpu_sku="V100")
Run a task with custom environment variables
AzureContainerInstanceJob(
command=["echo", "hello $PLANET"],
env={"PLANET": "earth"}
)
Run a task that uses a private ACR registry with a managed identity
AzureContainerInstanceJob(
command=["echo", "hello $PLANET"],
image="my-registry.azurecr.io/my-image",
image_registry=ACRManagedIdentity(
registry_url="my-registry.azurecr.io",
identity="/my/managed/identity/123abc"
)
)
ACRManagedIdentity
Bases: BaseModel
Use a Managed Identity to access Azure Container registry. Requires the user-assigned managed identity be available to the ACI container group.
Source code in prefect_azure/container_instance.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
AzureContainerInstanceJobResult
The result of an AzureContainerInstanceJob
run.
Source code in prefect_azure/container_instance.py
125 126 127 128 |
|
ContainerGroupProvisioningState
Bases: str
, Enum
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.
Source code in prefect_azure/container_instance.py
84 85 86 87 88 89 90 91 |
|
ContainerRunState
Bases: str
, Enum
Terminal run states for ACI containers.
Source code in prefect_azure/container_instance.py
94 95 96 97 98 99 100 |
|