az batch task

Manage Batch tasks.

Commands

az batch task create Create Batch tasks.
az batch task delete Deletes a Task from the specified Job.
az batch task file Manage Batch task files.
az batch task file delete Deletes the specified Task file from the Compute Node where the Task ran.
az batch task file download Download the content of a Batch task file.
az batch task file list Lists the files in a Task's directory on its Compute Node.
az batch task file show Gets the properties of the specified Task file.
az batch task list Lists all of the Tasks that are associated with the specified Job.
az batch task reactivate Reactivates a Task, allowing it to run again even if its retry count has been exhausted.
az batch task reset Reset the properties of a Batch task.
az batch task show Gets information about the specified Task.
az batch task stop Terminates the specified Task.
az batch task subtask Manage subtask information of a Batch task.
az batch task subtask list Lists all of the subtasks that are associated with the specified multi-instance Task.

az batch task create

Create Batch tasks.

az batch task create --job-id
[--account-endpoint]
[--account-key]
[--account-name]
[--affinity-id]
[--application-package-references]
[--command-line]
[--environment-settings]
[--json-file]
[--max-task-retry-count]
[--max-wall-clock-time]
[--resource-files]
[--retention-time]
[--subscription]
[--task-id]

Required Parameters

--job-id

The ID of the job containing the task.

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.

--affinity-id

Required. An opaque string representing the location of a Compute Node or a Task that has run previously. You can pass the affinityId of a Node to indicate that this Task needs to run on that Compute Node. Note that this is just a soft affinity. If the target Compute Node is busy or unavailable at the time the Task is scheduled, then the Task will be scheduled elsewhere.

--application-package-references

The space-separated list of IDs specifying the application packages to be installed. Space-separated application IDs with optional version in 'id[#version]' format.

--command-line

The command line of the 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.

--environment-settings

A list of environment variable settings for the task. Space-separated values in 'key=value' format.

--json-file

The file containing the task(s) to create in JSON(formatted to match REST API request body). When submitting multiple tasks, accepts either an array of tasks or a TaskAddCollectionParamater. If this parameter is specified, all other parameters are ignored.

--max-task-retry-count

The maximum number of times the 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 for the Task executable due to a nonzero exit code. The Batch service will try the Task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the Task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the Task after the first attempt. If the maximum retry count is -1, the Batch service retries the Task without limit.

--max-wall-clock-time

The maximum elapsed time that the Task may run, measured from the time the Task starts. If the Task does not complete within the time limit, the Batch service terminates it. If this is not specified, there is no time limit on how long the Task may run.

--resource-files

A list of files that the Batch service will download to the compute node before running the command line. Space-separated resource references in filename=blobsource format.

--retention-time

The minimum time to retain the Task directory on the Compute Node where it ran, from the time it completes execution. After this time, the Batch service may delete the Task directory and all its contents. The default is 7 days, i.e. the Task directory will be retained for 7 days unless the Compute Node is removed or the Job is deleted.

--subscription

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

--task-id

The ID of the task.

az batch task delete

Deletes a Task from the specified Job.

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

Required Parameters

--job-id

The ID of the Job from which to delete the Task.

--task-id

The ID of the Task 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.

--subscription

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

--yes -y

Do not prompt for confirmation.

az batch task list

Lists all of the Tasks that are associated with the specified Job.

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

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.

--filter

An OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-tasks.

--select

An OData $select clause.

--subscription

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

az batch task reactivate

Reactivates a Task, allowing it to run again even if its retry count has been exhausted.

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

Required Parameters

--job-id

The ID of the Job containing the Task.

--task-id

The ID of the Task to reactivate.

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.

--subscription

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

az batch task reset

Reset the properties of a Batch task.

az batch task reset --job-id
--task-id
[--account-endpoint]
[--account-key]
[--account-name]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--json-file]
[--max-task-retry-count]
[--max-wall-clock-time]
[--retention-time]
[--subscription]

Required Parameters

--job-id

The ID of the Job containing the Task.

--task-id

The ID of the Task 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.

--json-file

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

--max-task-retry-count

The maximum number of times the 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 for the Task executable due to a nonzero exit code. The Batch service will try the Task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the Task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the Task after the first attempt. If the maximum retry count is -1, the Batch service retries the Task without limit.

--max-wall-clock-time

The maximum elapsed time that the Task may run, measured from the time the Task starts. If the Task does not complete within the time limit, the Batch service terminates it. If this is not specified, there is no time limit on how long the Task may run. Expected format is an ISO-8601 duration.

--retention-time

The minimum time to retain the Task directory on the Compute Node where it ran, from the time it completes execution. After this time, the Batch service may delete the Task directory and all its contents. The default is 7 days, i.e. the Task directory will be retained for 7 days unless the Compute Node is removed or the Job is deleted. Expected format is an ISO-8601 duration.

--subscription

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

az batch task show

Gets information about the specified Task.

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

Required Parameters

--job-id

The ID of the Job that contains the Task.

--task-id

The ID of the Task to get information about.

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.

--subscription

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

az batch task stop

Terminates the specified Task.

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

Required Parameters

--job-id

The ID of the Job containing the Task.

--task-id

The ID of the Task 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.

--subscription

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