CloudTask CloudTask CloudTask Class

Definition

An Azure Batch task. A task is a piece of work that is associated with a job and runs on a compute node.

public class CloudTask : Microsoft.Azure.Batch.IInheritedBehaviors, Microsoft.Azure.Batch.IRefreshable
type CloudTask = class
    interface IRefreshable
    interface IInheritedBehaviors
Public Class CloudTask
Implements IInheritedBehaviors, IRefreshable
Inheritance
CloudTaskCloudTaskCloudTask
Implements

Remarks

Batch will retry tasks when a recovery operation is triggered on a compute node. Examples of recovery operations include (but are not limited to) when an unhealthy compute node is rebooted or a compute node disappeared due to host failure. Retries due to recovery operations are independent of and are not counted against the MaxTaskRetryCount. Even if the MaxTaskRetryCount is 0, an internal retry due to a recovery operation may occur. Because of this, all tasks should be idempotent. This means tasks need to tolerate being interrupted and restarted without causing any corruption or duplicate data. The best practice for long running tasks is to use some form of checkpointing. 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.

Constructors

CloudTask(String, String) CloudTask(String, String) CloudTask(String, String)

Initializes a new instance of the CloudTask class.

Properties

AffinityInformation AffinityInformation AffinityInformation

Gets or sets a locality hint that can be used by the Batch service to select a node on which to start the task.

ApplicationPackageReferences ApplicationPackageReferences ApplicationPackageReferences

Gets or sets a list of application packages that the Batch service will deploy to the compute node before running the command line.

AuthenticationTokenSettings AuthenticationTokenSettings AuthenticationTokenSettings

Gets or sets the settings for an authentication token that the task can use to perform Batch service operations.

CommandLine CommandLine CommandLine

Gets or sets the command line of the task.

ComputeNodeInformation ComputeNodeInformation ComputeNodeInformation

Gets information about the compute node on which the task ran.

Constraints Constraints Constraints

Gets or sets the execution constraints that apply to this task.

ContainerSettings ContainerSettings ContainerSettings

Gets or sets the settings for the container under which the task runs.

CreationTime CreationTime CreationTime

Gets the creation time of the task.

CustomBehaviors CustomBehaviors CustomBehaviors

Gets or sets a list of behaviors that modify or customize requests to the Batch service made via this CloudTask.

DependsOn DependsOn DependsOn

Gets or sets any other tasks that this CloudTask depends on. The task will not be scheduled until all depended-on tasks have completed successfully.

DisplayName DisplayName DisplayName

Gets or sets the display name of the task.

EnvironmentSettings EnvironmentSettings EnvironmentSettings

Gets or sets a list of environment variable settings for the task.

ETag ETag ETag

Gets the ETag for the task.

ExecutionInformation ExecutionInformation ExecutionInformation

Gets the execution information for the task.

ExitConditions ExitConditions ExitConditions

Gets or sets how the Batch service should respond when the task completes.

FilesToStage FilesToStage FilesToStage

Gets or sets a list of files to be staged for the task.

Id Id Id

Gets or sets the id of the task.

LastModified LastModified LastModified

Gets the last modified time of the task.

MultiInstanceSettings MultiInstanceSettings MultiInstanceSettings

Gets or sets information about how to run the multi-instance task.

OutputFiles OutputFiles OutputFiles

Gets or sets a list of files that the Batch service will upload from the compute node after running the command line.

PreviousState PreviousState PreviousState

Gets the previous state of the task.

PreviousStateTransitionTime PreviousStateTransitionTime PreviousStateTransitionTime

Gets the time at which the task entered its previous state.

ResourceFiles ResourceFiles ResourceFiles

Gets or sets a list of files that the Batch service will download to the compute node before running the command line.

State State State

Gets the current state of the task.

StateTransitionTime StateTransitionTime StateTransitionTime

Gets the time at which the task entered its current state.

Statistics Statistics Statistics

Gets resource usage statistics for the task.

Url Url Url

Gets the URL of the task.

UserIdentity UserIdentity UserIdentity

Gets or sets the user identity under which the task runs.

Methods

Commit(IEnumerable<BatchClientBehavior>) Commit(IEnumerable<BatchClientBehavior>) Commit(IEnumerable<BatchClientBehavior>)

Commits all pending changes to this CloudTask to the Azure Batch service.

CommitAsync(IEnumerable<BatchClientBehavior>, CancellationToken) CommitAsync(IEnumerable<BatchClientBehavior>, CancellationToken) CommitAsync(IEnumerable<BatchClientBehavior>, CancellationToken)

Commits all pending changes to this CloudTask to the Azure Batch service.

CopyNodeFileContentToStream(String, Stream, GetFileRequestByteRange, IEnumerable<BatchClientBehavior>) CopyNodeFileContentToStream(String, Stream, GetFileRequestByteRange, IEnumerable<BatchClientBehavior>) CopyNodeFileContentToStream(String, Stream, GetFileRequestByteRange, IEnumerable<BatchClientBehavior>)

Copies the contents of a file in the task's directory from the node to the given Stream.

CopyNodeFileContentToStreamAsync(String, Stream, GetFileRequestByteRange, IEnumerable<BatchClientBehavior>, CancellationToken) CopyNodeFileContentToStreamAsync(String, Stream, GetFileRequestByteRange, IEnumerable<BatchClientBehavior>, CancellationToken) CopyNodeFileContentToStreamAsync(String, Stream, GetFileRequestByteRange, IEnumerable<BatchClientBehavior>, CancellationToken)

Copies the contents of a file in the task's directory from the node to the given Stream.

CopyNodeFileContentToString(String, Encoding, GetFileRequestByteRange, IEnumerable<BatchClientBehavior>) CopyNodeFileContentToString(String, Encoding, GetFileRequestByteRange, IEnumerable<BatchClientBehavior>) CopyNodeFileContentToString(String, Encoding, GetFileRequestByteRange, IEnumerable<BatchClientBehavior>)

Reads the contents of a file in the task's directory on its compute node into a string.

CopyNodeFileContentToStringAsync(String, Encoding, GetFileRequestByteRange, IEnumerable<BatchClientBehavior>, CancellationToken) CopyNodeFileContentToStringAsync(String, Encoding, GetFileRequestByteRange, IEnumerable<BatchClientBehavior>, CancellationToken) CopyNodeFileContentToStringAsync(String, Encoding, GetFileRequestByteRange, IEnumerable<BatchClientBehavior>, CancellationToken)

Reads the contents of a file in the task's directory on its compute node into a string.

Delete(IEnumerable<BatchClientBehavior>) Delete(IEnumerable<BatchClientBehavior>) Delete(IEnumerable<BatchClientBehavior>)

Deletes this CloudTask.

DeleteAsync(IEnumerable<BatchClientBehavior>, CancellationToken) DeleteAsync(IEnumerable<BatchClientBehavior>, CancellationToken) DeleteAsync(IEnumerable<BatchClientBehavior>, CancellationToken)

Deletes this CloudTask.

GetNodeFile(String, IEnumerable<BatchClientBehavior>) GetNodeFile(String, IEnumerable<BatchClientBehavior>) GetNodeFile(String, IEnumerable<BatchClientBehavior>)

Gets the specified NodeFile from the CloudTask's directory on its compute node.

GetNodeFileAsync(String, IEnumerable<BatchClientBehavior>, CancellationToken) GetNodeFileAsync(String, IEnumerable<BatchClientBehavior>, CancellationToken) GetNodeFileAsync(String, IEnumerable<BatchClientBehavior>, CancellationToken)

Gets the specified NodeFile from the CloudTask's directory on its compute node.

ListNodeFiles(Nullable<Boolean>, DetailLevel, IEnumerable<BatchClientBehavior>) ListNodeFiles(Nullable<Boolean>, DetailLevel, IEnumerable<BatchClientBehavior>) ListNodeFiles(Nullable<Boolean>, DetailLevel, IEnumerable<BatchClientBehavior>)

Enumerates the files in the CloudTask's directory on its compute node.

ListSubtasks(DetailLevel, IEnumerable<BatchClientBehavior>) ListSubtasks(DetailLevel, IEnumerable<BatchClientBehavior>) ListSubtasks(DetailLevel, IEnumerable<BatchClientBehavior>)

Enumerates the subtasks of the multi-instance CloudTask.

Reactivate(IEnumerable<BatchClientBehavior>) Reactivate(IEnumerable<BatchClientBehavior>) Reactivate(IEnumerable<BatchClientBehavior>)

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

ReactivateAsync(IEnumerable<BatchClientBehavior>, CancellationToken) ReactivateAsync(IEnumerable<BatchClientBehavior>, CancellationToken) ReactivateAsync(IEnumerable<BatchClientBehavior>, CancellationToken)

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

Refresh(DetailLevel, IEnumerable<BatchClientBehavior>) Refresh(DetailLevel, IEnumerable<BatchClientBehavior>) Refresh(DetailLevel, IEnumerable<BatchClientBehavior>)

Refreshes the current CloudTask.

RefreshAsync(DetailLevel, IEnumerable<BatchClientBehavior>, CancellationToken) RefreshAsync(DetailLevel, IEnumerable<BatchClientBehavior>, CancellationToken) RefreshAsync(DetailLevel, IEnumerable<BatchClientBehavior>, CancellationToken)

Refreshes the current CloudTask.

StageFiles() StageFiles() StageFiles()

Stages the files listed in the FilesToStage list.

StageFilesAsync(ConcurrentDictionary<Type,IFileStagingArtifact>) StageFilesAsync(ConcurrentDictionary<Type,IFileStagingArtifact>) StageFilesAsync(ConcurrentDictionary<Type,IFileStagingArtifact>)

Stages the files listed in the FilesToStage list.

Terminate(IEnumerable<BatchClientBehavior>) Terminate(IEnumerable<BatchClientBehavior>) Terminate(IEnumerable<BatchClientBehavior>)

Terminates this CloudTask, marking it as completed.

TerminateAsync(IEnumerable<BatchClientBehavior>, CancellationToken) TerminateAsync(IEnumerable<BatchClientBehavior>, CancellationToken) TerminateAsync(IEnumerable<BatchClientBehavior>, CancellationToken)

Terminates this CloudTask, marking it as completed.

Extension Methods

OutputStorage(CloudTask, CloudStorageAccount) OutputStorage(CloudTask, CloudStorageAccount) OutputStorage(CloudTask, CloudStorageAccount)

Gets the TaskOutputStorage for a specified CloudTask.

IsDefined(Object) IsDefined(Object) IsDefined(Object)

Determines if a certain property is defined or not.

IsNull(Object) IsNull(Object) IsNull(Object)

Determines if a certain property is null or not.

IsPrimitive(Object) IsPrimitive(Object) IsPrimitive(Object)

Determines if a certain property is of premitive JSON type.

Applies to