Microsoft Azure Batch Client Library for Python providing comprehensive APIs for managing batch computing workloads in Azure cloud
91
Application package management capabilities for managing and deploying application packages to batch pools and tasks. Application packages provide a convenient way to deploy and manage application binaries and dependencies on compute nodes.
Retrieve information about available application packages in the batch account.
def list(application_list_options=None, custom_headers=None, raw=False, **operation_config):
"""
List all applications available in the specified account.
Returns only applications and versions that are available for use on
compute nodes; that is, that can be used in an application package reference.
Args:
application_list_options: Additional options for listing applications
custom_headers: Custom headers to include in request
raw: Return raw response if True
Returns:
ItemPaged[ApplicationSummary]: Paginated list of applications
"""Get detailed information about specific application packages.
def get(application_id, application_get_options=None, custom_headers=None, raw=False, **operation_config):
"""
Get information about the specified application.
Args:
application_id: ID of the application to retrieve
application_get_options: Additional options for the operation
custom_headers: Custom headers to include in request
raw: Return raw response if True
Returns:
ApplicationSummary: Application information including available versions
"""# List all available applications
applications = client.application.list()
for app in applications:
print(f"Application: {app.id}")
print(f" Display Name: {app.display_name}")
print(f" Versions: {app.versions}")
print(f" Default Version: {app.default_version}")
# List applications with filtering
from azure.batch.models import ApplicationListOptions
list_options = ApplicationListOptions(
filter="startswith(id, 'myapp')",
max_results=10
)
filtered_apps = client.application.list(list_options)# Get details for a specific application
app_details = client.application.get("myapp")
print(f"Application ID: {app_details.id}")
print(f"Display Name: {app_details.display_name}")
print(f"Default Version: {app_details.default_version}")
print("Available Versions:")
for version in app_details.versions:
print(f" - {version}")
# Check if specific application exists
try:
app = client.application.get("nonexistent-app")
print("Application exists")
except Exception as e:
print(f"Application not found: {e}")from azure.batch.models import (
PoolSpecification, ApplicationPackageReference,
VirtualMachineConfiguration, ImageReference
)
# Create pool with application packages
app_references = [
ApplicationPackageReference(
application_id="myapp",
version="1.0" # Use specific version
),
ApplicationPackageReference(
application_id="mylib"
# No version specified - uses default version
)
]
pool_spec = PoolSpecification(
id="app-pool",
vm_size="Standard_D2s_v3",
virtual_machine_configuration=VirtualMachineConfiguration(
image_reference=ImageReference(
publisher="Canonical",
offer="UbuntuServer",
sku="18.04-LTS"
),
node_agent_sku_id="batch.node.ubuntu 18.04"
),
target_dedicated_nodes=2,
application_packages=app_references
)
client.pool.add(pool_spec)from azure.batch.models import TaskSpecification, ApplicationPackageReference
# Create task that uses application packages
task_app_refs = [
ApplicationPackageReference(
application_id="processing-tool",
version="2.1"
)
]
task_spec = TaskSpecification(
id="processing-task",
command_line="$AZ_BATCH_APP_PACKAGE_processing-tool#2.1/bin/process input.dat",
application_package_references=task_app_refs
)
client.task.add("my-job", task_spec)class ApplicationSummary:
"""Application package summary information."""
def __init__(self):
self.id: str
self.display_name: str
self.versions: List[str]
self.default_version: str
class ApplicationPackageReference:
"""Reference to an application package."""
def __init__(self):
self.application_id: str
self.version: str # Optional - uses default if not specifiedclass ApplicationListOptions:
"""Options for listing applications."""
def __init__(self):
self.filter: str
self.select: str
self.max_results: int
self.timeout: int
class ApplicationGetOptions:
"""Options for getting application information."""
def __init__(self):
self.select: str
self.timeout: int$AZ_BATCH_APP_PACKAGE_<applicationId>#<version> directory on compute nodesInstall 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