Microsoft Azure Batch Client Library for Python providing comprehensive APIs for managing batch computing workloads in Azure cloud
91
Core client initialization, configuration, and authentication management for accessing Azure Batch services. The client provides the main entry point for all Batch operations and handles authentication, configuration, and operation routing.
The primary client class for issuing REST requests to the Azure Batch service. Provides access to all Batch operations through specialized operation classes.
class BatchServiceClient:
"""
A client for issuing REST requests to the Azure Batch service.
Args:
credentials: Authentication credentials (SharedKeyCredentials or Azure AD)
batch_url: Base URL for Azure Batch service requests
Attributes:
application: ApplicationOperations instance
pool: PoolOperations instance
account: AccountOperations instance
certificate: CertificateOperations instance
file: FileOperations instance
job_schedule: JobScheduleOperations instance
job: JobOperations instance
task: TaskOperations instance
compute_node: ComputeNodeOperations instance
compute_node_extension: ComputeNodeExtensionOperations instance
api_version: API version string (2024-02-01.19.0)
"""
def __init__(self, credentials, batch_url: str): ...Shared key authentication for Azure Batch using account name and access key. This is the most common authentication method for Batch applications.
class SharedKeyCredentials:
"""
Shared key authentication for Azure Batch.
Args:
account_name: Name of the Batch account
key: Primary or secondary access key for the account
"""
def __init__(self, account_name: str, key: str): ...
def signed_session(self, session=None): ...Configuration settings for the BatchServiceClient including credentials, endpoint, and request settings.
class BatchServiceClientConfiguration:
"""
Configuration for BatchServiceClient.
Args:
credentials: Authentication credentials
batch_url: Base URL for Batch service
"""
def __init__(self, credentials, batch_url: str): ...from azure.batch import BatchServiceClient
from azure.batch.batch_auth import SharedKeyCredentials
# Create credentials
credentials = SharedKeyCredentials(
account_name="mybatchaccount",
key="your_primary_or_secondary_key"
)
# Create client
batch_url = "https://mybatchaccount.eastus.batch.azure.com"
client = BatchServiceClient(credentials, batch_url)
# Access operations
pools = client.pool.list()
jobs = client.job.list()from azure.batch.models import BatchErrorException
try:
pool = client.pool.get("nonexistent-pool")
except BatchErrorException as e:
print(f"Batch error: {e.error.code} - {e.error.message}")
for detail in e.error.values:
print(f" {detail.key}: {detail.value}")# With Azure Active Directory (requires azure-identity)
from azure.identity import DefaultAzureCredential
from msrest.authentication import TokenCredential
# For Azure AD authentication, use the standard Azure identity libraries
credential = DefaultAzureCredential()
# Note: Azure Batch typically uses SharedKeyCredentials
# Azure AD auth requires additional configurationclass BatchServiceClientConfiguration:
"""Client configuration settings."""
def __init__(self):
self.credentials: Any
self.batch_url: str
self.base_url: str
self.filepath: strclass SharedKeyAuth:
"""Internal shared key authentication implementation."""
def __init__(self, header: str, account_name: str, key: str): ...
def __call__(self, request): ...Install with Tessl CLI
npx tessl i tessl/pypi-azure-batchdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10