Microsoft Azure Client Libraries for Python meta-package providing comprehensive access to Azure cloud services and management capabilities
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Azure compute services provide batch processing, container management, and virtual machine management capabilities. This includes the Azure Batch service for large-scale parallel workloads and compute resource management for provisioning and configuring compute infrastructure.
Enables large-scale parallel and high-performance computing (HPC) applications to run efficiently in the cloud. Manages compute pools, jobs, and tasks for batch processing workloads.
class BatchServiceClient:
"""
Client for Azure Batch service operations.
Parameters:
- credentials: Authentication credentials (SharedKeyCredentials)
- base_url: str, Batch service endpoint URL (optional, defaults to 'https://batch.core.windows.net')
"""
def __init__(self, credentials, base_url=None, **kwargs): ...
@property
def pool(self): ... # Pool operations
@property
def job(self): ... # Job operations
@property
def task(self): ... # Task operations
@property
def compute_node(self): ... # Compute node operations
@property
def file(self): ... # File operationsManage compute pools for batch processing.
class PoolOperations:
def add(self, pool, **kwargs):
"""Add a pool to the specified account."""
def delete(self, pool_id, **kwargs):
"""Delete a pool from the specified account."""
def get(self, pool_id, **kwargs):
"""Get information about the specified pool."""
def list(self, **kwargs):
"""List all pools in the specified account."""
def update_properties(self, pool_id, pool_update_parameter, **kwargs):
"""Update properties of the specified pool."""
def enable_auto_scale(self, pool_id, auto_scale_formula, **kwargs):
"""Enable automatic scaling on the specified pool."""
def disable_auto_scale(self, pool_id, **kwargs):
"""Disable automatic scaling on the specified pool."""
def evaluate_auto_scale(self, pool_id, auto_scale_formula, **kwargs):
"""Get the result of evaluating an automatic scaling formula."""
def resize(self, pool_id, pool_resize_parameter, **kwargs):
"""Change the number of compute nodes in the specified pool."""
def stop_resize(self, pool_id, **kwargs):
"""Stop an ongoing resize operation on the specified pool."""Manage batch jobs and job scheduling.
class JobOperations:
def add(self, job, **kwargs):
"""Add a job to the specified account."""
def delete(self, job_id, **kwargs):
"""Delete a job."""
def get(self, job_id, **kwargs):
"""Get information about the specified job."""
def list(self, **kwargs):
"""List all jobs in the specified account."""
def update(self, job_id, job_update_parameter, **kwargs):
"""Update properties of the specified job."""
def disable(self, job_id, disable_job_option, **kwargs):
"""Disable the specified job."""
def enable(self, job_id, **kwargs):
"""Enable the specified job."""
def terminate(self, job_id, **kwargs):
"""Terminate the specified job."""Manage individual tasks within batch jobs.
class TaskOperations:
def add(self, job_id, task, **kwargs):
"""Add a task to the specified job."""
def add_collection(self, job_id, value, **kwargs):
"""Add a collection of tasks to the specified job."""
def delete(self, job_id, task_id, **kwargs):
"""Delete a task from the specified job."""
def get(self, job_id, task_id, **kwargs):
"""Get information about the specified task."""
def list(self, job_id, **kwargs):
"""List all tasks associated with the specified job."""
def update(self, job_id, task_id, task_update_parameter, **kwargs):
"""Update properties of the specified task."""
def terminate(self, job_id, task_id, **kwargs):
"""Terminate the specified task."""
def reactivate(self, job_id, task_id, **kwargs):
"""Reactivate a task."""Provides authentication for Azure Batch services.
class SharedKeyCredentials:
"""
Shared key credentials for Azure Batch authentication.
Parameters:
- account_name: str, Batch account name
- account_key: str, Batch account access key
"""
def __init__(self, account_name: str, account_key: str): ...
def signed_session(self, session=None):
"""Create a signed session for requests."""Manages Azure compute resources including virtual machines, availability sets, and compute-related infrastructure.
class ComputeManagementClient:
"""
Client for Azure Compute Management operations.
Parameters:
- credentials: Authentication credentials (ServicePrincipalCredentials)
- subscription_id: str, Azure subscription ID
"""
def __init__(self, credentials, subscription_id, **kwargs): ...
@property
def virtual_machines(self): ... # VM operations
@property
def virtual_machine_sizes(self): ... # VM size operations
@property
def availability_sets(self): ... # Availability set operations
@property
def virtual_machine_scale_sets(self): ... # Scale set operations
@property
def virtual_machine_images(self): ... # VM image operations
@property
def usage(self): ... # Usage operations
@property
def disks(self): ... # Disk operations
@property
def snapshots(self): ... # Snapshot operationsclass PoolSpecification:
"""Specification for creating a batch pool."""
def __init__(self, id: str, vm_size: str, **kwargs): ...
id: str # Pool identifier
display_name: str # Display name
vm_size: str # Virtual machine size
cloud_service_configuration: object # Cloud service config
virtual_machine_configuration: object # VM config
target_dedicated_nodes: int # Target dedicated node count
target_low_priority_nodes: int # Target low priority node count
enable_auto_scale: bool # Auto scaling enabled
auto_scale_formula: str # Auto scaling formula
start_task: object # Start task specification
application_packages: list # Application packages
metadata: list # Pool metadataclass JobSpecification:
"""Specification for creating a batch job."""
def __init__(self, pool_info, **kwargs): ...
display_name: str # Display name
priority: int # Job priority
constraints: object # Job constraints
job_manager_task: object # Job manager task
job_preparation_task: object # Job preparation task
job_release_task: object # Job release task
pool_info: object # Pool information
common_environment_settings: list # Environment settings
metadata: list # Job metadataclass TaskAddParameter:
"""Parameters for adding a task to a job."""
def __init__(self, id: str, command_line: str, **kwargs): ...
id: str # Task identifier
display_name: str # Display name
command_line: str # Command line to execute
container_settings: object # Container settings
resource_files: list # Resource files
output_files: list # Output files
environment_settings: list # Environment settings
constraints: object # Task constraints
user_identity: object # User identity
depends_on: object # Task dependencies
application_package_references: list # Application packages
authentication_token_settings: object # Auth token settingsfrom azure.batch import BatchServiceClient
from azure.batch.batch_auth import SharedKeyCredentials
from azure.batch.models import (
PoolSpecification,
VirtualMachineConfiguration,
ImageReference,
NodeAgentSku
)
# Set up authentication
credentials = SharedKeyCredentials(account_name, account_key)
batch_client = BatchServiceClient(credentials, base_url=batch_url)
# Create a pool specification
vm_config = VirtualMachineConfiguration(
image_reference=ImageReference(
publisher="Canonical",
offer="UbuntuServer",
sku="18.04-LTS"
),
node_agent_sku_id="batch.node.ubuntu 18.04"
)
pool_spec = PoolSpecification(
id="mypool",
vm_size="Standard_A1_v2",
target_dedicated_nodes=2,
virtual_machine_configuration=vm_config
)
# Create the pool
batch_client.pool.add(pool_spec)
# List pools
pools = batch_client.pool.list()
for pool in pools:
print(f"Pool: {pool.id}, State: {pool.state}")from azure.batch.models import (
JobSpecification,
PoolInformation,
TaskAddParameter
)
# Create job specification
job_spec = JobSpecification(
pool_info=PoolInformation(pool_id="mypool")
)
# Add job
batch_client.job.add(job_spec, job_id="myjob")
# Add tasks to the job
tasks = []
for i in range(5):
task = TaskAddParameter(
id=f"task{i}",
command_line=f"echo 'Hello from task {i}'"
)
tasks.append(task)
batch_client.task.add_collection("myjob", tasks)
# Monitor task completion
tasks = batch_client.task.list("myjob")
for task in tasks:
print(f"Task {task.id}: {task.state}")Install with Tessl CLI
npx tessl i tessl/pypi-azure