Implementation:Interpretml Interpret Powerlift BicepAzureContainerInstance
| Knowledge Sources | |
|---|---|
| Domains | Benchmarking, Cloud_Infrastructure, Azure, Infrastructure_as_Code |
| Last Updated | 2026-02-07 12:00 GMT |
Overview
Bicep-based Azure Container Instance executor that provisions ACI resources via Azure Resource Manager ARM/Bicep template deployments rather than direct SDK calls.
Description
The BicepAzureContainerInstance class extends the Executor base class and provides an alternative approach to Azure Container Instance provisioning. Instead of using the Azure Container Instance SDK directly (as in AzureContainerInstance), this executor uses Azure Resource Manager deployments with Bicep/ARM templates.
Key characteristics:
- Template-based deployment -- Reads an ARM template JSON file (
aci.json) and a startup shell script (startup.sh) from the same directory as the executor module. - Resource Manager integration -- Uses
azure.mgmt.resource.ResourceManagementClientto deploy container groups viabegin_create_or_updatewith incremental deployment mode. - Parameterized provisioning -- Passes container count, batch size, image, startup script, experiment ID, database URL, timeout, and resource group as deployment parameters.
- Deployment tracking -- Stores the deployment poller and name for join/cancel operations. The
join()method waits on the deployment poller, whilecancel()uses the Resource Management client to cancel the deployment. - No max_undead parameter -- Unlike the direct ACI executor, this version does not support the max_undead parameter since container lifecycle is managed by the ARM deployment.
Usage
Use this executor when you prefer Infrastructure-as-Code style provisioning of Azure Container Instances, or when you need to customize the ARM template for advanced container group configurations. Requires the aci.json template and startup.sh files to be present alongside the executor module.
Code Reference
Source Location
- Repository: Interpretml_Interpret
- File:
python/powerlift/powerlift/executors/bicep_azure_ci.py
Signature
class BicepAzureContainerInstance(Executor):
def __init__(
self,
store: Store,
azure_tenant_id: str,
subscription_id: str,
azure_client_id: str,
credential=None,
azure_client_secret: Optional[str] = None,
resource_group: str = "powerlift_rg",
shell_install: Optional[str] = None,
pip_install: Optional[str] = None,
wheel_filepaths: Optional[List[str]] = None,
n_instances: int = 1,
num_cores: int = 4,
mem_size_gb: int = 16,
image: str = "mcr.microsoft.com/devcontainers/python:3.12",
docker_db_uri: Optional[str] = None,
resource_uris: Optional[List[str]] = None,
delete_on_complete: bool = True,
): ...
def submit(self, experiment_id, timeout=None): ...
def join(self): ...
def cancel(self): ...
def delete_credentials(self): ...
Import
from powerlift.executors.bicep_azure_ci import BicepAzureContainerInstance
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| store | Store | Yes | Store instance that houses trials and provides the database URI |
| azure_tenant_id | str | Yes | Azure tenant ID for authentication |
| subscription_id | str | Yes | Azure subscription ID |
| azure_client_id | str | Yes | Azure client ID for service principal |
| credential | object | No | Azure credential object (alternative to client_secret) |
| azure_client_secret | str | No | Azure client secret for service principal authentication |
| resource_group | str | No | Azure resource group name (default: "powerlift_rg") |
| n_instances | int | No | Number of containers to deploy (default: 1) |
| num_cores | int | No | CPU cores per container (default: 4) |
| mem_size_gb | int | No | RAM in GB per container (default: 16) |
| image | str | No | Docker image for containers (default: "mcr.microsoft.com/devcontainers/python:3.12") |
| docker_db_uri | str | No | Database URI override for container use |
| resource_uris | List[str] | No | Azure resources to grant contributor access to |
| delete_on_complete | bool | No | Whether to delete containers after completion (default: True) |
| wheel_filepaths | List[str] | No | Wheel files to install in the container environment |
Outputs
| Name | Type | Description |
|---|---|---|
| join() return | List | Empty list (deployment results are managed by the ARM template) |
Usage Examples
from powerlift.bench.store import Store
from powerlift.executors.bicep_azure_ci import BicepAzureContainerInstance
from azure.identity import DefaultAzureCredential
store = Store("postgresql://user:pass@host/db")
credential = DefaultAzureCredential()
executor = BicepAzureContainerInstance(
store=store,
azure_tenant_id="your-tenant-id",
subscription_id="your-subscription-id",
azure_client_id="your-client-id",
credential=credential,
n_instances=8,
num_cores=4,
mem_size_gb=16,
)
executor.submit(experiment_id=1, timeout=3600)
executor.join()
Related Pages
- Interpretml_Interpret_Powerlift_Executor -- Abstract base class that BicepAzureContainerInstance extends
- Interpretml_Interpret_Powerlift_AzureContainerInstance -- Direct SDK-based alternative for ACI provisioning
- Interpretml_Interpret_Powerlift_AzureVMInstance -- Alternative executor using full Azure VMs
- Interpretml_Interpret_Powerlift_Schema -- Database schema models used by the Store