CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-azure-batch

Microsoft Azure Batch Client Library for Python providing comprehensive APIs for managing batch computing workloads in Azure cloud

91

1.07x
Overview
Eval results
Files

application-operations.mddocs/

Application Operations

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.

Capabilities

Application Package Listing

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
    """

Application Package Information

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
    """

Usage Examples

Listing Available Applications

# 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)

Getting Application Details

# 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}")

Using Applications in Pool Configuration

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)

Using Applications in Task Configuration

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)

Types

Application Information Types

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 specified

Application Operation Option Types

class 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

Notes

  • Application packages must be uploaded and configured through the Azure portal or ARM templates before they can be used
  • Application packages are automatically extracted to the $AZ_BATCH_APP_PACKAGE_<applicationId>#<version> directory on compute nodes
  • If no version is specified in ApplicationPackageReference, the default version is used
  • Application packages are available to all tasks running on nodes where they are deployed
  • Application packages provide an efficient way to deploy large applications without including them in resource files

Install with Tessl CLI

npx tessl i tessl/pypi-azure-batch

docs

account-operations.md

application-operations.md

certificate-operations.md

client-management.md

compute-node-extension-operations.md

compute-node-operations.md

file-operations.md

index.md

job-operations.md

job-schedule-operations.md

pool-operations.md

task-operations.md

tile.json