Batch tasks - az batch task

Manage your Batch tasks.

Commands

az batch task create Create a single Batch task or multiple Batch tasks.
az batch task delete Deletes a task from the specified job.
az batch task file Manage your 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 the specified 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 the specified task.
az batch task reset Update the properties of the specified task. All updatable properties are replaced with the values specified or reset if unspecified.
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 your 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 a single Batch task or multiple Batch tasks.

az batch task create --job-id
[--account-endpoint]
[--account-key]
[--account-name]
[--affinity-info]
[--application-package-references]
[--command-line]
[--environment-settings]
[--json-file]
[--max-task-retry-count]
[--max-wall-clock-time]
[--resource-files]
[--retention-time]
[--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-info

A locality hint that can be used by the Batch service to select a compute node on which to start the new task.

--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 format, 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. 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. 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 infinite, i.e. the task directory will be retained until the compute node is removed or reimaged.

--task-id

The ID of the task.

az batch task delete

When a task is deleted, all of the files in its directory on the compute node where it ran are also deleted (regardless of the retention time). For multi-instance tasks, the delete task operation applies synchronously to the primary task; subtasks and their files are then deleted asynchronously in the background.

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

--yes -y

Do not prompt for confirmation.

az batch task list

For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks.

az batch task list --job-id
[--account-endpoint]
[--account-key]
[--account-name]
[--expand]
[--filter]
[--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.

--filter

An OData $filter clause.

--select

An OData $select clause.

az batch task reactivate

Reactivation makes a task eligible to be retried again up to its maximum retry count. The task's state is changed to active. As the task is no longer in the completed state, any previous exit code or scheduling error is no longer available after reactivation. This will fail for tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, this will fail if the job has completed (or is terminating or deleting).

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]

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.

az batch task reset

Update the properties of the specified task. All updatable properties are replaced with the values specified or reset if unspecified.

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]

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 format. 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. 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. 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 infinite, i.e. the task directory will be retained until the compute node is removed or reimaged. Expected format is an ISO-8601 duration.

az batch task show

For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks.

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]

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.

az batch task stop

When the task has been terminated, it moves to the completed state. For multi-instance tasks, the terminate task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background.

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]

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.