Task class
Class representing a Task.
Constructors
| Task(Batch |
Create a Task. |
Methods
| add(string, Task |
|
| add(string, Task |
The maximum lifetime of a Task from addition to completion is 180 days. If a Task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. |
| add(string, Task |
|
| add |
|
| add |
Note that each Task must have a unique ID. The Batch service may not return the results for each Task in the same order the Tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same Task IDs during a retry so that if the prior operation succeeded, the retry will not create extra Tasks unexpectedly. If the response contains any Tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only Tasks that failed to add, and to omit Tasks that were successfully added on the first attempt. The maximum lifetime of a Task from addition to completion is 180 days. If a Task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. |
| add |
|
| delete |
|
| 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. |
| delete |
|
| get(string, string, Service |
|
| get(string, string, Task |
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. |
| get(string, string, Task |
|
| list(string, Service |
|
| list(string, Task |
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. |
| list(string, Task |
|
| list |
|
| 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. |
| list |
|
| list |
|
| list |
If the Task is not a multi-instance Task then this returns an empty collection. |
| list |
|
| reactivate(string, string, Service |
|
| reactivate(string, string, Task |
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 failure information is no longer available after reactivation. Each time a Task is reactivated, its retry count is reset to 0. Reactivation will fail for Tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, it will fail if the Job has completed (or is terminating or deleting). |
| reactivate(string, string, Task |
|
| terminate(string, string, Service |
|
| terminate(string, string, Task |
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. |
| terminate(string, string, Task |
|
| update(string, string, Service |
|
| update(string, string, Task |
Updates the properties of the specified Task. |
| update(string, string, Task |
Constructor Details
Task(BatchServiceClientContext)
Create a Task.
new Task(client: BatchServiceClientContext)
Parameters
- client
- BatchServiceClientContext
Reference to the service client.
Method Details
add(string, TaskAddParameter, ServiceCallback<void>)
function add(jobId: string, task: TaskAddParameter, callback: ServiceCallback<void>)
Parameters
- jobId
-
string
The ID of the Job to which the Task is to be added.
- task
- TaskAddParameter
The Task to be added.
- callback
-
ServiceCallback<void>
The callback
add(string, TaskAddParameter, TaskAddOptionalParams)
The maximum lifetime of a Task from addition to completion is 180 days. If a Task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time.
function add(jobId: string, task: TaskAddParameter, options?: TaskAddOptionalParams): Promise<TaskAddResponse>
Parameters
- jobId
-
string
The ID of the Job to which the Task is to be added.
- task
- TaskAddParameter
The Task to be added.
- options
- TaskAddOptionalParams
The optional parameters
Returns
Promise<TaskAddResponse>
Promise<Models.TaskAddResponse>
add(string, TaskAddParameter, TaskAddOptionalParams, ServiceCallback<void>)
function add(jobId: string, task: TaskAddParameter, options: TaskAddOptionalParams, callback: ServiceCallback<void>)
Parameters
- jobId
-
string
The ID of the Job to which the Task is to be added.
- task
- TaskAddParameter
The Task to be added.
- options
- TaskAddOptionalParams
The optional parameters
- callback
-
ServiceCallback<void>
The callback
addCollection(string, TaskAddParameter[], ServiceCallback<TaskAddCollectionResult>)
function addCollection(jobId: string, value: TaskAddParameter[], callback: ServiceCallback<TaskAddCollectionResult>)
Parameters
- jobId
-
string
The ID of the Job to which the Task collection is to be added.
- value
The collection of Tasks to add. The maximum count of Tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each Task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer Tasks.
- callback
The callback
addCollection(string, TaskAddParameter[], TaskAddCollectionOptionalParams)
Note that each Task must have a unique ID. The Batch service may not return the results for each Task in the same order the Tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same Task IDs during a retry so that if the prior operation succeeded, the retry will not create extra Tasks unexpectedly. If the response contains any Tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only Tasks that failed to add, and to omit Tasks that were successfully added on the first attempt. The maximum lifetime of a Task from addition to completion is 180 days. If a Task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time.
function addCollection(jobId: string, value: TaskAddParameter[], options?: TaskAddCollectionOptionalParams): Promise<TaskAddCollectionResponse>
Parameters
- jobId
-
string
The ID of the Job to which the Task collection is to be added.
- value
The collection of Tasks to add. The maximum count of Tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each Task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer Tasks.
- options
- TaskAddCollectionOptionalParams
The optional parameters
Returns
Promise<TaskAddCollectionResponse>
Promise<Models.TaskAddCollectionResponse>
addCollection(string, TaskAddParameter[], TaskAddCollectionOptionalParams, ServiceCallback<TaskAddCollectionResult>)
function addCollection(jobId: string, value: TaskAddParameter[], options: TaskAddCollectionOptionalParams, callback: ServiceCallback<TaskAddCollectionResult>)
Parameters
- jobId
-
string
The ID of the Job to which the Task collection is to be added.
- value
The collection of Tasks to add. The maximum count of Tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each Task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer Tasks.
- options
- TaskAddCollectionOptionalParams
The optional parameters
- callback
The callback
deleteMethod(string, string, ServiceCallback<void>)
function deleteMethod(jobId: string, taskId: string, callback: ServiceCallback<void>)
Parameters
- jobId
-
string
The ID of the Job from which to delete the Task.
- taskId
-
string
The ID of the Task to delete.
- callback
-
ServiceCallback<void>
The callback
deleteMethod(string, string, TaskDeleteMethodOptionalParams)
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.
function deleteMethod(jobId: string, taskId: string, options?: TaskDeleteMethodOptionalParams): Promise<TaskDeleteResponse>
Parameters
- jobId
-
string
The ID of the Job from which to delete the Task.
- taskId
-
string
The ID of the Task to delete.
- options
- TaskDeleteMethodOptionalParams
The optional parameters
Returns
Promise<TaskDeleteResponse>
Promise<Models.TaskDeleteResponse>
deleteMethod(string, string, TaskDeleteMethodOptionalParams, ServiceCallback<void>)
function deleteMethod(jobId: string, taskId: string, options: TaskDeleteMethodOptionalParams, callback: ServiceCallback<void>)
Parameters
- jobId
-
string
The ID of the Job from which to delete the Task.
- taskId
-
string
The ID of the Task to delete.
- options
- TaskDeleteMethodOptionalParams
The optional parameters
- callback
-
ServiceCallback<void>
The callback
get(string, string, ServiceCallback<CloudTask>)
function get(jobId: string, taskId: string, callback: ServiceCallback<CloudTask>)
Parameters
- jobId
-
string
The ID of the Job that contains the Task.
- taskId
-
string
The ID of the Task to get information about.
- callback
The callback
get(string, string, TaskGetOptionalParams)
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.
function get(jobId: string, taskId: string, options?: TaskGetOptionalParams): Promise<TaskGetResponse>
Parameters
- jobId
-
string
The ID of the Job that contains the Task.
- taskId
-
string
The ID of the Task to get information about.
- options
- TaskGetOptionalParams
The optional parameters
Returns
Promise<TaskGetResponse>
Promise<Models.TaskGetResponse>
get(string, string, TaskGetOptionalParams, ServiceCallback<CloudTask>)
function get(jobId: string, taskId: string, options: TaskGetOptionalParams, callback: ServiceCallback<CloudTask>)
Parameters
- jobId
-
string
The ID of the Job that contains the Task.
- taskId
-
string
The ID of the Task to get information about.
- options
- TaskGetOptionalParams
The optional parameters
- callback
The callback
list(string, ServiceCallback<CloudTaskListResult>)
function list(jobId: string, callback: ServiceCallback<CloudTaskListResult>)
Parameters
- jobId
-
string
The ID of the Job.
- callback
The callback
list(string, TaskListOptionalParams)
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.
function list(jobId: string, options?: TaskListOptionalParams): Promise<TaskListResponse>
Parameters
- jobId
-
string
The ID of the Job.
- options
- TaskListOptionalParams
The optional parameters
Returns
Promise<TaskListResponse>
Promise<Models.TaskListResponse>
list(string, TaskListOptionalParams, ServiceCallback<CloudTaskListResult>)
function list(jobId: string, options: TaskListOptionalParams, callback: ServiceCallback<CloudTaskListResult>)
Parameters
- jobId
-
string
The ID of the Job.
- options
- TaskListOptionalParams
The optional parameters
- callback
The callback
listNext(string, ServiceCallback<CloudTaskListResult>)
function listNext(nextPageLink: string, callback: ServiceCallback<CloudTaskListResult>)
Parameters
- nextPageLink
-
string
The NextLink from the previous successful call to List operation.
- callback
The callback
listNext(string, TaskListNextOptionalParams)
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.
function listNext(nextPageLink: string, options?: TaskListNextOptionalParams): Promise<TaskListResponse>
Parameters
- nextPageLink
-
string
The NextLink from the previous successful call to List operation.
- options
- TaskListNextOptionalParams
The optional parameters
Returns
Promise<TaskListResponse>
Promise<Models.TaskListResponse>
listNext(string, TaskListNextOptionalParams, ServiceCallback<CloudTaskListResult>)
function listNext(nextPageLink: string, options: TaskListNextOptionalParams, callback: ServiceCallback<CloudTaskListResult>)
Parameters
- nextPageLink
-
string
The NextLink from the previous successful call to List operation.
- options
- TaskListNextOptionalParams
The optional parameters
- callback
The callback
listSubtasks(string, string, ServiceCallback<CloudTaskListSubtasksResult>)
function listSubtasks(jobId: string, taskId: string, callback: ServiceCallback<CloudTaskListSubtasksResult>)
Parameters
- jobId
-
string
The ID of the Job.
- taskId
-
string
The ID of the Task.
- callback
The callback
listSubtasks(string, string, TaskListSubtasksOptionalParams)
If the Task is not a multi-instance Task then this returns an empty collection.
function listSubtasks(jobId: string, taskId: string, options?: TaskListSubtasksOptionalParams): Promise<TaskListSubtasksResponse>
Parameters
- jobId
-
string
The ID of the Job.
- taskId
-
string
The ID of the Task.
- options
- TaskListSubtasksOptionalParams
The optional parameters
Returns
Promise<TaskListSubtasksResponse>
Promise<Models.TaskListSubtasksResponse>
listSubtasks(string, string, TaskListSubtasksOptionalParams, ServiceCallback<CloudTaskListSubtasksResult>)
function listSubtasks(jobId: string, taskId: string, options: TaskListSubtasksOptionalParams, callback: ServiceCallback<CloudTaskListSubtasksResult>)
Parameters
- jobId
-
string
The ID of the Job.
- taskId
-
string
The ID of the Task.
- options
- TaskListSubtasksOptionalParams
The optional parameters
- callback
The callback
reactivate(string, string, ServiceCallback<void>)
function reactivate(jobId: string, taskId: string, callback: ServiceCallback<void>)
Parameters
- jobId
-
string
The ID of the Job containing the Task.
- taskId
-
string
The ID of the Task to reactivate.
- callback
-
ServiceCallback<void>
The callback
reactivate(string, string, TaskReactivateOptionalParams)
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 failure information is no longer available after reactivation. Each time a Task is reactivated, its retry count is reset to 0. Reactivation will fail for Tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, it will fail if the Job has completed (or is terminating or deleting).
function reactivate(jobId: string, taskId: string, options?: TaskReactivateOptionalParams): Promise<TaskReactivateResponse>
Parameters
- jobId
-
string
The ID of the Job containing the Task.
- taskId
-
string
The ID of the Task to reactivate.
- options
- TaskReactivateOptionalParams
The optional parameters
Returns
Promise<TaskReactivateResponse>
Promise<Models.TaskReactivateResponse>
reactivate(string, string, TaskReactivateOptionalParams, ServiceCallback<void>)
function reactivate(jobId: string, taskId: string, options: TaskReactivateOptionalParams, callback: ServiceCallback<void>)
Parameters
- jobId
-
string
The ID of the Job containing the Task.
- taskId
-
string
The ID of the Task to reactivate.
- options
- TaskReactivateOptionalParams
The optional parameters
- callback
-
ServiceCallback<void>
The callback
terminate(string, string, ServiceCallback<void>)
function terminate(jobId: string, taskId: string, callback: ServiceCallback<void>)
Parameters
- jobId
-
string
The ID of the Job containing the Task.
- taskId
-
string
The ID of the Task to terminate.
- callback
-
ServiceCallback<void>
The callback
terminate(string, string, TaskTerminateOptionalParams)
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.
function terminate(jobId: string, taskId: string, options?: TaskTerminateOptionalParams): Promise<TaskTerminateResponse>
Parameters
- jobId
-
string
The ID of the Job containing the Task.
- taskId
-
string
The ID of the Task to terminate.
- options
- TaskTerminateOptionalParams
The optional parameters
Returns
Promise<TaskTerminateResponse>
Promise<Models.TaskTerminateResponse>
terminate(string, string, TaskTerminateOptionalParams, ServiceCallback<void>)
function terminate(jobId: string, taskId: string, options: TaskTerminateOptionalParams, callback: ServiceCallback<void>)
Parameters
- jobId
-
string
The ID of the Job containing the Task.
- taskId
-
string
The ID of the Task to terminate.
- options
- TaskTerminateOptionalParams
The optional parameters
- callback
-
ServiceCallback<void>
The callback
update(string, string, ServiceCallback<void>)
function update(jobId: string, taskId: string, callback: ServiceCallback<void>)
Parameters
- jobId
-
string
The ID of the Job containing the Task.
- taskId
-
string
The ID of the Task to update.
- callback
-
ServiceCallback<void>
The callback
update(string, string, TaskUpdateOptionalParams)
Updates the properties of the specified Task.
function update(jobId: string, taskId: string, options?: TaskUpdateOptionalParams): Promise<TaskUpdateResponse>
Parameters
- jobId
-
string
The ID of the Job containing the Task.
- taskId
-
string
The ID of the Task to update.
- options
- TaskUpdateOptionalParams
The optional parameters
Returns
Promise<TaskUpdateResponse>
Promise<Models.TaskUpdateResponse>
update(string, string, TaskUpdateOptionalParams, ServiceCallback<void>)
function update(jobId: string, taskId: string, options: TaskUpdateOptionalParams, callback: ServiceCallback<void>)
Parameters
- jobId
-
string
The ID of the Job containing the Task.
- taskId
-
string
The ID of the Task to update.
- options
- TaskUpdateOptionalParams
The optional parameters
- callback
-
ServiceCallback<void>
The callback