az batch job

Manage Batch jobs.

Commands

az batch job all-statistics View statistics of all jobs under a Batch account.
az batch job all-statistics show Get lifetime summary statistics for all of the jobs in a Batch account.
az batch job create Add a job to a Batch account.
az batch job delete Deletes a job.
az batch job disable Disables the specified job, preventing new tasks from running.
az batch job enable Enables the specified job, allowing new tasks to run.
az batch job list List all of the jobs or job schedule in a Batch account.
az batch job prep-release-status View the status of Batch job preparation and release tasks.
az batch job prep-release-status list Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run.
az batch job reset Update the properties of a Batch job. Unspecified properties which can be updated are reset to their defaults.
az batch job set Update the properties of a Batch job. Updating a property in a subgroup will reset the unspecified properties of that group.
az batch job show Gets information about the specified job.
az batch job stop Terminates the specified job, marking it as completed.
az batch job task-counts View the number of tasks in a Batch job and their states.
az batch job task-counts show Gets the task counts for the specified job.

az batch job create

Add a job to a Batch account.

az batch job create [--account-endpoint]
[--account-key]
[--account-name]
[--id]
[--job-manager-task-command-line]
[--job-manager-task-environment-settings]
[--job-manager-task-id]
[--job-manager-task-resource-files]
[--job-max-task-retry-count]
[--job-max-wall-clock-time]
[--json-file]
[--metadata]
[--pool-id]
[--priority]
[--uses-task-dependencies]

Optional Parameters

--account-endpoint
Batch service endpoint. Alternatively, set by environment variable: AZURE_BATCH_ENDPOINT.
--account-key
Batch account key. Alternatively, set by environment variable: AZURE_BATCH_ACCESS_KEY.
--account-name
Batch account name. Alternatively, set by environment variable: AZURE_BATCH_ACCOUNT.
--id
A string that uniquely identifies the job within the account. The ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within an account that differ only by case).
--job-manager-task-command-line
The command line of the Job Manager task. The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux.
--job-manager-task-environment-settings
A list of environment variable settings for the Job Manager task. Space separated values in 'key=value' format.
--job-manager-task-id
A string that uniquely identifies the Job Manager task within the job. The ID can contain any combination of alphanumeric characters including hyphens and underscores and cannot contain more than 64 characters.
--job-manager-task-resource-files
A list of files that the Batch service will download to the compute node before running the command line. Files listed under this element are located in the task's working directory. Space separated resource references in filename=blobsource format.
--job-max-task-retry-count
The maximum number of times each task may be retried. The Batch service retries a task if its exit code is nonzero. Note that this value specifically controls the number of retries. The Batch service will try each task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries a task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry tasks. If the maximum retry count is -1, the Batch service retries tasks without limit. The default value is 0 (no retries).
--job-max-wall-clock-time
The maximum elapsed time that the job may run, measured from the time the job is created. If the job does not complete within the time limit, the Batch service terminates it and any tasks that are still running. In this case, the termination reason will be MaxWallClockTimeExpiry. If this property is not specified, there is no time limit on how long the job may run. Expected format is an ISO-8601 duration.
--json-file
A file containing the job specification in JSON format. If this parameter is specified, all 'Job Arguments' are ignored.
--metadata
A list of name-value pairs associated with the job as metadata. The Batch service does not assign any meaning to metadata; it is solely for the use of user code. Space separated values in 'key=value' format.
--pool-id
The id of an existing pool. All the tasks of the job will run on the specified pool.
--priority
The priority of the job. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0.
--uses-task-dependencies
Whether tasks in the job can define dependencies on each other. The default is false. True if flag present.

az batch job delete

Deletes a job.

az batch job delete --job-id
[--account-endpoint]
[--account-key]
[--account-name]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--yes]

Required Parameters

--job-id
The ID of the job to delete.

Optional Parameters

--account-endpoint
Batch service endpoint. Alternatively, set by environment variable: AZURE_BATCH_ENDPOINT.
--account-key
Batch account key. Alternatively, set by environment variable: AZURE_BATCH_ACCESS_KEY.
--account-name
Batch account name. Alternatively, set by environment variable: AZURE_BATCH_ACCOUNT.
--if-match
An ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client.
--if-modified-since
A timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time.
--if-none-match
An ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client.
--if-unmodified-since
A timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time.
--yes -y
Do not prompt for confirmation.

az batch job disable

Disables the specified job, preventing new tasks from running.

az batch job disable --job-id
[--account-endpoint]
[--account-key]
[--account-name]
[--disable-tasks {'''requeue'', ''terminate'', ''wait'''}]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]

Required Parameters

--job-id
The ID of the job to disable.

Optional Parameters

--account-endpoint
Batch service endpoint. Alternatively, set by environment variable: AZURE_BATCH_ENDPOINT.
--account-key
Batch account key. Alternatively, set by environment variable: AZURE_BATCH_ACCESS_KEY.
--account-name
Batch account name. Alternatively, set by environment variable: AZURE_BATCH_ACCOUNT.
--disable-tasks
What to do with active tasks associated with the job. Values are: requeue - Terminate running tasks and requeue them. The tasks will run again when the job is enabled. terminate - Terminate running tasks. The tasks will not run again. wait - Allow currently running tasks to complete.
accepted values: '''requeue'', ''terminate'', ''wait'''
--if-match
An ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client.
--if-modified-since
A timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time.
--if-none-match
An ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client.
--if-unmodified-since
A timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time.

az batch job enable

Enables the specified job, allowing new tasks to run.

az batch job enable --job-id
[--account-endpoint]
[--account-key]
[--account-name]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]

Required Parameters

--job-id
The ID of the job to enable.

Optional Parameters

--account-endpoint
Batch service endpoint. Alternatively, set by environment variable: AZURE_BATCH_ENDPOINT.
--account-key
Batch account key. Alternatively, set by environment variable: AZURE_BATCH_ACCESS_KEY.
--account-name
Batch account name. Alternatively, set by environment variable: AZURE_BATCH_ACCOUNT.
--if-match
An ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client.
--if-modified-since
A timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time.
--if-none-match
An ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client.
--if-unmodified-since
A timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time.

az batch job list

List all of the jobs or job schedule in a Batch account.

az batch job list [--account-endpoint]
[--account-key]
[--account-name]
[--expand]
[--filter]
[--job-schedule-id]
[--select]

Optional Parameters

--account-endpoint
Batch service endpoint. Alternatively, set by environment variable: AZURE_BATCH_ENDPOINT.
--account-key
The Batch account key. Alternatively, set by environment variable: AZURE_BATCH_ACCESS_KEY.
--account-name
The Batch account name. Alternatively, set by environment variable: AZURE_BATCH_ACCOUNT.
--expand
An OData $expand clause.
--filter
An OData $filter clause.
--job-schedule-id
The ID of the job schedule from which you want to get a list of jobs. If omitted, lists all jobs in the account.
--select
An OData $select clause.

az batch job reset

Update the properties of a Batch job. Unspecified properties which can be updated are reset to their defaults.

az batch job reset --job-id
[--account-endpoint]
[--account-key]
[--account-name]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--job-max-task-retry-count]
[--job-max-wall-clock-time]
[--json-file]
[--metadata]
[--on-all-tasks-complete {noAction, terminateJob}]
[--pool-id]
[--priority]

Required Parameters

--job-id
The ID of the job whose properties you want to update.

Optional Parameters

--account-endpoint
Batch service endpoint. Alternatively, set by environment variable: AZURE_BATCH_ENDPOINT.
--account-key
Batch account key. Alternatively, set by environment variable: AZURE_BATCH_ACCESS_KEY.
--account-name
Batch account name. Alternatively, set by environment variable: AZURE_BATCH_ACCOUNT.
--if-match
An ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client.
--if-modified-since
A timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time.
--if-none-match
An ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client.
--if-unmodified-since
A timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time.
--job-max-task-retry-count
The maximum number of times each task may be retried. The Batch service retries a task if its exit code is nonzero. Note that this value specifically controls the number of retries. The Batch service will try each task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries a task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry tasks. If the maximum retry count is -1, the Batch service retries tasks without limit. The default value is 0 (no retries).
--job-max-wall-clock-time
The maximum elapsed time that the job may run, measured from the time the job is created. If the job does not complete within the time limit, the Batch service terminates it and any tasks that are still running. In this case, the termination reason will be MaxWallClockTimeExpiry. If this property is not specified, there is no time limit on how long the job may run. Expected format is an ISO-8601 duration.
--json-file
A file containing the job update parameter specification in JSON format. If this parameter is specified, all 'Job Arguments' are ignored.
--metadata
A list of name-value pairs associated with the job as metadata. If omitted, it takes the default value of an empty list; in effect, any existing metadata is deleted. Space separated values in 'key=value' format.
--on-all-tasks-complete
The action the Batch service should take when all tasks in the job are in the completed state. If omitted, the completion behavior is set to noAction. If the current value is terminateJob, this is an error because a job's completion behavior may not be changed from terminateJob to noAction. You may not change the value from terminatejob to noaction - that is, once you have engaged automatic job termination, you cannot turn it off again. If you try to do this, the request fails and Batch returns status code 400 (Bad Request) and an 'invalid property value' error response. If you do not specify this element in a PUT request, it is equivalent to passing noaction. This is an error if the current value is terminatejob.
accepted values: noAction, terminateJob
--pool-id
The id of an existing pool. All the tasks of the job will run on the specified pool.
--priority
The priority of the job. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. If omitted, it is set to the default value 0.

az batch job set

Update the properties of a Batch job. Updating a property in a subgroup will reset the unspecified properties of that group.

az batch job set --job-id
[--account-endpoint]
[--account-key]
[--account-name]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--job-max-task-retry-count]
[--job-max-wall-clock-time]
[--json-file]
[--metadata]
[--on-all-tasks-complete {noAction, terminateJob}]
[--pool-id]
[--priority]

Required Parameters

--job-id
The ID of the job whose properties you want to update.

Optional Parameters

--account-endpoint
Batch service endpoint. Alternatively, set by environment variable: AZURE_BATCH_ENDPOINT.
--account-key
Batch account key. Alternatively, set by environment variable: AZURE_BATCH_ACCESS_KEY.
--account-name
Batch account name. Alternatively, set by environment variable: AZURE_BATCH_ACCOUNT.
--if-match
An ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client.
--if-modified-since
A timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time.
--if-none-match
An ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client.
--if-unmodified-since
A timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time.
--job-max-task-retry-count
The maximum number of times each task may be retried. The Batch service retries a task if its exit code is nonzero. Note that this value specifically controls the number of retries. The Batch service will try each task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries a task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry tasks. If the maximum retry count is -1, the Batch service retries tasks without limit. The default value is 0 (no retries).
--job-max-wall-clock-time
The maximum elapsed time that the job may run, measured from the time the job is created. If the job does not complete within the time limit, the Batch service terminates it and any tasks that are still running. In this case, the termination reason will be MaxWallClockTimeExpiry. If this property is not specified, there is no time limit on how long the job may run. Expected format is an ISO-8601 duration.
--json-file
A file containing the job patch parameter specification in JSON format. If this parameter is specified, all 'Job Arguments' are ignored.
--metadata
A list of name-value pairs associated with the job as metadata. If omitted, the existing job metadata is left unchanged. Space separated values in 'key=value' format.
--on-all-tasks-complete
The action the Batch service should take when all tasks in the job are in the completed state. If omitted, the completion behavior is left unchanged. You may not change the value from terminateJob to noAction - that is, once you have engaged automatic job termination, you cannot turn it off again. If you try to do this, the request fails with an 'invalid property value' error response; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request).
accepted values: noAction, terminateJob
--pool-id
The id of an existing pool. All the tasks of the job will run on the specified pool.
--priority
The priority of the job. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. If omitted, the priority of the job is left unchanged.

az batch job show

Gets information about the specified job.

az batch job show --job-id
[--account-endpoint]
[--account-key]
[--account-name]
[--expand]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--select]

Required Parameters

--job-id
The ID of the job.

Optional Parameters

--account-endpoint
Batch service endpoint. Alternatively, set by environment variable: AZURE_BATCH_ENDPOINT.
--account-key
Batch account key. Alternatively, set by environment variable: AZURE_BATCH_ACCESS_KEY.
--account-name
Batch account name. Alternatively, set by environment variable: AZURE_BATCH_ACCOUNT.
--expand
An OData $expand clause.
--if-match
An ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client.
--if-modified-since
A timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time.
--if-none-match
An ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client.
--if-unmodified-since
A timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time.
--select
An OData $select clause.

az batch job stop

Terminates the specified job, marking it as completed.

az batch job stop --job-id
[--account-endpoint]
[--account-key]
[--account-name]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--terminate-reason]

Required Parameters

--job-id
The ID of the job to terminate.

Optional Parameters

--account-endpoint
Batch service endpoint. Alternatively, set by environment variable: AZURE_BATCH_ENDPOINT.
--account-key
Batch account key. Alternatively, set by environment variable: AZURE_BATCH_ACCESS_KEY.
--account-name
Batch account name. Alternatively, set by environment variable: AZURE_BATCH_ACCOUNT.
--if-match
An ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client.
--if-modified-since
A timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time.
--if-none-match
An ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client.
--if-unmodified-since
A timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time.
--terminate-reason
The text you want to appear as the job's TerminateReason. The default is 'UserTerminate'.