Share via


az batch job

Manage Batch jobs.

Commands

Name Description Type Status
az batch job create

Add a job to a Batch account.

Core GA
az batch job delete

Deletes a job from a Batch account.

Core GA
az batch job disable

Disable a Batch job.

Core GA
az batch job enable

Enable a Batch job.

Core GA
az batch job list

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

Core GA
az batch job prep-release-status

View the status of Batch job preparation and release tasks.

Core GA
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.

Core GA
az batch job reset

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

Core GA
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.

Core GA
az batch job show

Gets information about the specified Batch job.

Core GA
az batch job stop

Stop a running Batch job.

Core GA
az batch job task-counts

View the number of tasks and slots in a Batch job and their states.

Core GA
az batch job task-counts show

Gets the Task counts for the specified Job.

Core GA

az batch job create

Add a job to a Batch account.

az batch job create [--account-endpoint]
                    [--account-key]
                    [--account-name]
                    [--allow-task-preemption]
                    [--id]
                    [--job-manager-task-application-package-references]
                    [--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]
                    [--max-parallel-tasks]
                    [--metadata]
                    [--on-all-tasks-complete]
                    [--pool-id]
                    [--priority]
                    [--required-slots]
                    [--uses-task-dependencies]

Examples

Create an new job associated with an existing pool.

az batch job create --id job1 --pool-id pool1

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.

--allow-task-preemption

Whether Tasks in this job can be preempted by other high priority jobs. If the value is set to True, other high priority jobs submitted to the system will take precedence and will be able requeue tasks from this job. You can update a job's allowTaskPreemption after it has been created using the update job API. True if flag present.

--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). Required.

--job-manager-task-application-package-references

A list of Application Packages that the Batch service will deploy to the Compute Node before running the command line.Application Packages are downloaded and deployed to a shared directory, not the Task working directory. Therefore, if a referenced Application Package is already on the Compute Node, and is up to date, then it is not re-downloaded; the existing copy on the Compute Node is used. If a referenced Application Package cannot be installed, for example because the package has been deleted or because download failed, the Task fails. Space-separated application IDs with optional version in 'id[#version]' format.

--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. If the command line refers to file paths, it should use a relative path (relative to the Task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). Required.

--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. Required.

--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. There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of ResourceFiles must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers. Space-separated resource references in filename=httpurl 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 (formatted to match the respective REST API body). If this parameter is specified, all 'Job Arguments' are ignored.

--max-parallel-tasks

The maximum number of tasks that can be executed in parallel for the job. The value of maxParallelTasks must be -1 or greater than 0 if specified. If not specified, the default value is -1, which means there's no limit to the number of tasks that can be run at once. You can update a job's maxParallelTasks after it has been created using the update job API.

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

--on-all-tasks-complete

The action the Batch service should take when all Tasks in the Job are in the completed state. Note that if a Job contains no Tasks, then all Tasks are considered complete. This option is therefore most commonly used with a Job Manager task; if you want to use automatic Job termination without a Job Manager, you should initially set onAllTasksComplete to noaction and update the Job properties to set onAllTasksComplete to terminatejob once you have finished adding Tasks. The default is noaction. Known values are: "noaction" and "terminatejob".

--pool-id

The ID of an existing Pool. All the Tasks of the Job will run on the specified Pool. You must ensure that the Pool referenced by this property exists. If the Pool does not exist at the time the Batch service tries to schedule a Job, no Tasks for the Job will run until you create a Pool with that id. Note that the Batch service will not reject the Job request; it will simply not run Tasks until the Pool exists. You must specify either the Pool ID or the auto Pool specification, but not both.

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

--required-slots

The number of scheduling slots that the Task requires to run. The default is 1. A Task can only be scheduled to run on a compute node if the node has enough free scheduling slots available. For multi-instance Tasks, this property is not supported and must not be specified.

--uses-task-dependencies

Whether Tasks in the Job can define dependencies on each other. The default is false. True if flag present.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az batch job delete

Deletes a job from a Batch account.

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

Examples

Delete a job using the job id without prompt for confirmation.

az batch job delete --job-id job1 --yes

Required Parameters

--job-id

The ID of the Job to delete. Required.

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 been modified since the specified time.

--yes -y

Do not prompt for confirmation.

Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az batch job disable

Disable a Batch job.

az batch job disable --job-id
                     [--account-endpoint]
                     [--account-key]
                     [--account-name]
                     [--disable-tasks]
                     [--if-match]
                     [--if-modified-since]
                     [--if-none-match]
                     [--if-unmodified-since]
                     [--json-file]

Examples

Disable a job and requeue any running tasks.

az batch job disable --job-id job1 --disable-tasks requeue

Required Parameters

--job-id

The ID of the Job to disable. Required.

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. Required. Known values are: "requeue", "terminate", and "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 been modified since the specified time.

--json-file

A file containing the content specification in JSON (formatted to match the respective REST API body). If this parameter is specified, all 'Content Arguments' are ignored.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az batch job enable

Enable a Batch job.

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

Examples

Enable a job.

az batch job enable --job-id job1

Required Parameters

--job-id

The ID of the Job to enable. Required.

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 been modified since the specified time.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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]

Examples

List all of the jobs in a Batch account

az batch job list

List all of the job schedule in a Batch account

az batch job list --job-schedule-id jobschedule1

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. Only needed Alternatively, set by environment variable: AZURE_BATCH_ACCOUNT.

--expand

An OData $expand clause.

--filter

An OData $filter clause. For more information on constructing this filter,see https://learn.microsoft.com/rest/api/batchservice/odata-filters-in-batch.

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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]
                   [--allow-task-preemption]
                   [--if-match]
                   [--if-modified-since]
                   [--if-none-match]
                   [--if-unmodified-since]
                   [--job-max-task-retry-count]
                   [--job-max-wall-clock-time]
                   [--json-file]
                   [--max-parallel-tasks]
                   [--metadata]
                   [--on-all-tasks-complete]
                   [--pool-id]
                   [--priority]

Examples

Reset all job properties except priority.

az batch job reset --job-id job1 --priority 100

Required Parameters

--job-id

The ID of the Job whose properties you want to update. Required.

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.

--allow-task-preemption

Whether Tasks in this job can be preempted by other high priority jobs. If the value is set to True, other high priority jobs submitted to the system will take precedence and will be able requeue tasks from this job. You can update a job's allowTaskPreemption after it has been created using the update job API. True if flag present.

--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 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 specification in JSON (formatted to match the respective REST API body). If this parameter is specified, all 'Job Arguments' are ignored.

--max-parallel-tasks

The maximum number of tasks that can be executed in parallel for the job. The value of maxParallelTasks must be -1 or greater than 0 if specified. If not specified, the default value is -1, which means there's no limit to the number of tasks that can be run at once. You can update a job's maxParallelTasks after it has been created using the update job API.

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

--on-all-tasks-complete

The action the Batch service should take when all Tasks in the Job are in the completed state. The default is noaction. Known values are: "noaction" and "terminatejob".

--pool-id

The ID of an existing Pool. All the Tasks of the Job will run on the specified Pool. You must ensure that the Pool referenced by this property exists. If the Pool does not exist at the time the Batch service tries to schedule a Job, no Tasks for the Job will run until you create a Pool with that id. Note that the Batch service will not reject the Job request; it will simply not run Tasks until the Pool exists. You must specify either the Pool ID or the auto Pool specification, but not both.

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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]
                 [--allow-task-preemption]
                 [--if-match]
                 [--if-modified-since]
                 [--if-none-match]
                 [--if-unmodified-since]
                 [--job-max-task-retry-count]
                 [--job-max-wall-clock-time]
                 [--json-file]
                 [--max-parallel-tasks]
                 [--metadata]
                 [--on-all-tasks-complete]
                 [--pool-id]
                 [--priority]

Examples

Update job priority.

az batch job set --job-id job1 --priority 100

Required Parameters

--job-id

The ID of the Job whose properties you want to update. Required.

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.

--allow-task-preemption

Whether Tasks in this job can be preempted by other high priority jobs. If the value is set to True, other high priority jobs submitted to the system will take precedence and will be able requeue tasks from this job. You can update a job's allowTaskPreemption after it has been created using the update job API. True if flag present.

--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 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 specification in JSON (formatted to match the respective REST API body). If this parameter is specified, all 'Job Arguments' are ignored.

--max-parallel-tasks

The maximum number of tasks that can be executed in parallel for the job. The value of maxParallelTasks must be -1 or greater than 0 if specified. If not specified, the default value is -1, which means there's no limit to the number of tasks that can be run at once. You can update a job's maxParallelTasks after it has been created using the update job API.

--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). Known values are: "noaction" and "terminatejob".

--pool-id

The ID of an existing Pool. All the Tasks of the Job will run on the specified Pool. You must ensure that the Pool referenced by this property exists. If the Pool does not exist at the time the Batch service tries to schedule a Job, no Tasks for the Job will run until you create a Pool with that id. Note that the Batch service will not reject the Job request; it will simply not run Tasks until the Pool exists. You must specify either the Pool ID or the auto Pool specification, but not both.

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az batch job show

Gets information about the specified Batch 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]

Examples

Shows information details about a job.

az batch job show --job-id job1

Required Parameters

--job-id

The ID of the Job. Required.

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 been modified since the specified time.

--select

An OData $select clause.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az batch job stop

Stop a running Batch job.

Terminate the specified job, marking it as completed. When a Terminate Job request is received, the Batch service sets the job to the terminating state. The Batch service then terminates any running tasks associated with the job and runs any required job release tasks. Then the job moves into the completed state. If there are any tasks in the job in the active state, they will remain in the active state. Once a job is terminated, new tasks cannot be added and any remaining active tasks will not be scheduled.

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]

Examples

Stop a job and give a termination reason

az batch job stop --job-id job1 --terminate-reason "Completed workflow"

Required Parameters

--job-id

The ID of the Job to terminate. Required.

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 been modified since the specified time.

--terminate-reason

Termination reason.

The text you want to appear as the job's TerminateReason. The default is 'UserTerminate'.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.