Azure

Azure Batch Documentation

Job Concepts

In Azure Batch, a Job defines a collection of work to be performed. Jobs group related tasks, control their execution order, and provide a central point for monitoring and management.

Job Lifecycle

Job lifecycle diagram

The lifecycle consists of the following states:

Show example: Creating a job with Azure CLI
# Create a new job
az batch job create \\
    --account-name MyBatchAccount \\
    --resource-group MyResourceGroup \\
    --id my-job \\
    --pool-id my-pool

Job Properties

PropertyTypeDescription
idstringUnique identifier for the job.
displayNamestringFriendly name shown in the portal.
priorityintExecution priority, higher values mean higher priority.
stateenumCurrent state (active, running, completed, etc.).
constraintsobjectTimeouts and retry limits.
metadataarrayCustom key/value pairs.

Job Scheduling

Jobs can be scheduled to start at a specific time or recur on a defined interval.

Show example: Recurring job with SDK (Python)
import azure.batch as batch
from datetime import datetime, timedelta

client = batch.BatchServiceClient(credentials, batch_url)

recurrence = batch.models.RecurrenceInterval(
    interval=timedelta(hours=6)
)

schedule = batch.models.Schedule(
    start_window=datetime.utcnow(),
    recurrence=recurrence
)

client.job.add(
    job_id='recurring-job',
    pool_info=batch.models.PoolInformation(pool_id='my-pool'),
    schedule=schedule
)

Related Topics