or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/azure-batch@14.2.x
tile.json

tessl/pypi-azure-batch

tessl install tessl/pypi-azure-batch@14.2.0

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

Agent Success

Agent success rate when using this tile

91%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.07x

Baseline

Agent success rate without this tile

85%

task.mdevals/scenario-5/

Batch Task Monitor

A utility for managing and monitoring tasks in Azure Batch jobs, with support for tracking task states and retrieving execution information.

Capabilities

Task Addition and Bulk Creation

  • Given a job ID "job-001", a task ID "task-1", and a command line "/bin/bash -c 'echo hello'", adds a single task to the job @test
  • Given a job ID "job-002" and a list of 3 tasks with IDs ["task-a", "task-b", "task-c"] and command lines, adds all tasks to the job in a single bulk operation @test

Task State Monitoring

  • Given a job ID "job-003" and a task ID "task-5", retrieves the task and returns its current state (e.g., "completed", "running", "failed") @test
  • Given a job ID "job-004", lists all tasks in the job and returns a collection containing their IDs and states @test

Task Execution Information Retrieval

  • Given a job ID "job-005" and a completed task ID "task-10", retrieves the task execution info including exit code @test
  • Given a job ID "job-006" and a task ID "task-12", retrieves the task and checks if the execution info contains start time and end time (if completed) @test

Task Lifecycle Management

  • Given a job ID "job-007" and a running task ID "task-20", terminates the task @test
  • Given a job ID "job-008" and a task ID "task-25" with constraints (max_wall_clock_time of 60 seconds, max_task_retry_count of 2), updates the task with new constraints @test

Implementation

@generates

API

from typing import List, Dict, Any, Optional
from azure.batch import BatchServiceClient
from azure.batch.models import TaskAddParameter, TaskState, TaskExecutionInformation, TaskConstraints

def add_task(batch_client: BatchServiceClient, job_id: str, task_id: str, command_line: str) -> None:
    """
    Adds a single task to a job.

    Args:
        batch_client: The Azure Batch service client
        job_id: The ID of the job to add the task to
        task_id: The ID for the new task
        command_line: The command line to execute
    """
    pass

def bulk_add_tasks(batch_client: BatchServiceClient, job_id: str, tasks: List[Dict[str, str]]) -> None:
    """
    Adds multiple tasks to a job in a single operation.

    Args:
        batch_client: The Azure Batch service client
        job_id: The ID of the job to add tasks to
        tasks: List of dictionaries with 'id' and 'command_line' keys
    """
    pass

def get_task_state(batch_client: BatchServiceClient, job_id: str, task_id: str) -> str:
    """
    Retrieves the current state of a task.

    Args:
        batch_client: The Azure Batch service client
        job_id: The ID of the job containing the task
        task_id: The ID of the task

    Returns:
        The state of the task as a string
    """
    pass

def list_tasks(batch_client: BatchServiceClient, job_id: str) -> List[Dict[str, Any]]:
    """
    Lists all tasks in a job with their IDs and states.

    Args:
        batch_client: The Azure Batch service client
        job_id: The ID of the job

    Returns:
        List of dictionaries containing 'id' and 'state' for each task
    """
    pass

def get_execution_info(batch_client: BatchServiceClient, job_id: str, task_id: str) -> Optional[Dict[str, Any]]:
    """
    Retrieves execution information for a task including exit code.

    Args:
        batch_client: The Azure Batch service client
        job_id: The ID of the job containing the task
        task_id: The ID of the task

    Returns:
        Dictionary with execution info including 'exit_code', or None if not available
    """
    pass

def get_execution_times(batch_client: BatchServiceClient, job_id: str, task_id: str) -> Dict[str, Optional[Any]]:
    """
    Retrieves execution timing information for a task.

    Args:
        batch_client: The Azure Batch service client
        job_id: The ID of the job containing the task
        task_id: The ID of the task

    Returns:
        Dictionary with 'start_time' and 'end_time' (end_time may be None if not completed)
    """
    pass

def terminate_task(batch_client: BatchServiceClient, job_id: str, task_id: str) -> None:
    """
    Terminates a running task.

    Args:
        batch_client: The Azure Batch service client
        job_id: The ID of the job containing the task
        task_id: The ID of the task to terminate
    """
    pass

def update_task(batch_client: BatchServiceClient, job_id: str, task_id: str, constraints: TaskConstraints) -> None:
    """
    Updates task constraints.

    Args:
        batch_client: The Azure Batch service client
        job_id: The ID of the job containing the task
        task_id: The ID of the task to update
        constraints: New constraints for the task
    """
    pass

Dependencies { .dependencies }

azure-batch { .dependency }

Provides Azure Batch APIs for task management and monitoring.