CloudTask Class
- java.
lang. Object - com.
microsoft. azure. batch. protocol. models. CloudTask
- com.
public class CloudTask
An Azure Batch Task. Batch will retry Tasks when a recovery operation is triggered on a Node. Examples of recovery operations include (but are not limited to) when an unhealthy 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.
Constructor Summary
Constructor | Description | |
---|---|---|
CloudTask() |
Method Summary
Modifier and Type | Method and Description |
---|---|
Affinity |
affinityInfo()
Get the affinity |
List<Application |
applicationPackageReferences()
Get application packages are downloaded and deployed to a shared directory, not the Task working directory. |
Authentication |
authenticationTokenSettings()
Get if this property is set, the Batch service provides the Task with an authentication token which can be used to authenticate Batch service operations without requiring an Account access key. |
String |
commandLine()
Get for multi-instance Tasks, the command line is executed as the primary Task, after the primary Task and all subtasks have finished executing the coordination command line. |
Task |
constraints()
Get the constraints value. |
Task |
containerSettings()
Get if the Pool that will run this Task has container |
org.joda.time.DateTime |
creationTime()
Get the creation |
Task |
dependsOn()
Get this Task will not be scheduled until all Tasks that it depends on have completed successfully. |
String |
displayName()
Get the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. |
String |
eTag()
Get this is an opaque string. |
List<Environment |
environmentSettings()
Get the environment |
Task |
executionInfo()
Get the execution |
Exit |
exitConditions()
Get how the Batch service should respond when the Task completes. |
String |
id()
Get the ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. |
org.joda.time.DateTime |
lastModified()
Get the last |
Multi |
multiInstanceSettings()
Get the multi |
Compute |
nodeInfo()
Get the node |
List<Output |
outputFiles()
Get for multi-instance Tasks, the files will only be uploaded from the Compute Node on which the primary Task is executed. |
Task |
previousState()
Get this property is not set if the Task is in its initial Active state. |
org.joda.time.DateTime |
previousStateTransitionTime()
Get this property is not set if the Task is in its initial Active state. |
Integer |
requiredSlots()
Get the default is 1. |
List<Resource |
resourceFiles()
Get for multi-instance Tasks, the resource files will only be downloaded to the Compute Node on which the primary Task is executed. |
Task |
state()
Get possible values include: 'active', 'preparing', 'running', 'completed'. |
org.joda.time.DateTime |
stateTransitionTime()
Get the state |
Task |
stats()
Get the stats value. |
String |
url()
Get the url value. |
User |
userIdentity()
Get if omitted, the Task runs as a non-administrative user unique to the Task. |
Cloud |
withAffinityInfo(AffinityInformation affinityInfo)
Set the affinity |
Cloud |
withApplicationPackageReferences(List<ApplicationPackageReference> applicationPackageReferences)
Set application packages are downloaded and deployed to a shared directory, not the Task working directory. |
Cloud |
withAuthenticationTokenSettings(AuthenticationTokenSettings authenticationTokenSettings)
Set if this property is set, the Batch service provides the Task with an authentication token which can be used to authenticate Batch service operations without requiring an Account access key. |
Cloud |
withCommandLine(String commandLine)
Set for multi-instance Tasks, the command line is executed as the primary Task, after the primary Task and all subtasks have finished executing the coordination command line. |
Cloud |
withConstraints(TaskConstraints constraints)
Set the constraints value. |
Cloud |
withContainerSettings(TaskContainerSettings containerSettings)
Set if the Pool that will run this Task has container |
Cloud |
withCreationTime(DateTime creationTime)
Set the creation |
Cloud |
withDependsOn(TaskDependencies dependsOn)
Set this Task will not be scheduled until all Tasks that it depends on have completed successfully. |
Cloud |
withDisplayName(String displayName)
Set the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. |
Cloud |
withETag(String eTag)
Set this is an opaque string. |
Cloud |
withEnvironmentSettings(List<EnvironmentSetting> environmentSettings)
Set the environment |
Cloud |
withExecutionInfo(TaskExecutionInformation executionInfo)
Set the execution |
Cloud |
withExitConditions(ExitConditions exitConditions)
Set how the Batch service should respond when the Task completes. |
Cloud |
withId(String id)
Set the ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. |
Cloud |
withLastModified(DateTime lastModified)
Set the last |
Cloud |
withMultiInstanceSettings(MultiInstanceSettings multiInstanceSettings)
Set the multi |
Cloud |
withNodeInfo(ComputeNodeInformation nodeInfo)
Set the node |
Cloud |
withOutputFiles(List<OutputFile> outputFiles)
Set for multi-instance Tasks, the files will only be uploaded from the Compute Node on which the primary Task is executed. |
Cloud |
withPreviousState(TaskState previousState)
Set this property is not set if the Task is in its initial Active state. |
Cloud |
withPreviousStateTransitionTime(DateTime previousStateTransitionTime)
Set this property is not set if the Task is in its initial Active state. |
Cloud |
withRequiredSlots(Integer requiredSlots)
Set the default is 1. |
Cloud |
withResourceFiles(List<ResourceFile> resourceFiles)
Set for multi-instance Tasks, the resource files will only be downloaded to the Compute Node on which the primary Task is executed. |
Cloud |
withState(TaskState state)
Set possible values include: 'active', 'preparing', 'running', 'completed'. |
Cloud |
withStateTransitionTime(DateTime stateTransitionTime)
Set the state |
Cloud |
withStats(TaskStatistics stats)
Set the stats value. |
Cloud |
withUrl(String url)
Set the url value. |
Cloud |
withUserIdentity(UserIdentity userIdentity)
Set if omitted, the Task runs as a non-administrative user unique to the Task. |
Methods inherited from java.lang.Object
Constructor Details
CloudTask
public CloudTask()
Method Details
affinityInfo
public AffinityInformation affinityInfo()
Get the affinityInfo value.
Returns:
applicationPackageReferences
public List
Get application packages are downloaded and deployed to a shared directory, not the Task working directory. Therefore, if a referenced package is already on the Node, and is up to date, then it is not re-downloaded; the existing copy on the Compute Node is used. If a referenced Package cannot be installed, for example because the package has been deleted or because download failed, the Task fails.
Returns:
authenticationTokenSettings
public AuthenticationTokenSettings authenticationTokenSettings()
Get if this property is set, the Batch service provides the Task with an authentication token which can be used to authenticate Batch service operations without requiring an Account access key. The token is provided via the AZ_BATCH_AUTHENTICATION_TOKEN environment variable. The operations that the Task can carry out using the token depend on the settings. For example, a Task can request Job permissions in order to add other Tasks to the Job, or check the status of the Job or of other Tasks under the Job.
Returns:
commandLine
public String commandLine()
Get for multi-instance Tasks, the command line is executed as the primary Task, after the primary Task and all subtasks have finished executing the coordination command line. 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/azure/batch/batch-compute-node-environment-variables).
Returns:
constraints
public TaskConstraints constraints()
Get the constraints value.
Returns:
containerSettings
public TaskContainerSettings containerSettings()
Get if the Pool that will run this Task has containerConfiguration set, this must be set as well. If the Pool that will run this Task doesn't have containerConfiguration set, this must not be set. When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all Task environment variables are mapped into the container, and the Task command line is executed in the container. Files produced in the container outside of AZ_BATCH_NODE_ROOT_DIR might not be reflected to the host disk, meaning that Batch file APIs will not be able to access those files.
Returns:
creationTime
public DateTime creationTime()
Get the creationTime value.
Returns:
dependsOn
public TaskDependencies dependsOn()
Get this Task will not be scheduled until all Tasks that it depends on have completed successfully. If any of those Tasks fail and exhaust their retry counts, this Task will never be scheduled.
Returns:
displayName
public String displayName()
Get the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024.
Returns:
eTag
public String eTag()
Get this is an opaque string. You can use it to detect whether the Task has changed between requests. In particular, you can be pass the ETag when updating a Task to specify that your changes should take effect only if nobody else has modified the Task in the meantime.
Returns:
environmentSettings
public List
Get the environmentSettings value.
Returns:
executionInfo
public TaskExecutionInformation executionInfo()
Get the executionInfo value.
Returns:
exitConditions
public ExitConditions exitConditions()
Get how the Batch service should respond when the Task completes.
Returns:
id
public String id()
Get the ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters.
Returns:
lastModified
public DateTime lastModified()
Get the lastModified value.
Returns:
multiInstanceSettings
public MultiInstanceSettings multiInstanceSettings()
Get the multiInstanceSettings value.
Returns:
nodeInfo
public ComputeNodeInformation nodeInfo()
Get the nodeInfo value.
Returns:
outputFiles
public List
Get for multi-instance Tasks, the files will only be uploaded from the Compute Node on which the primary Task is executed.
Returns:
previousState
public TaskState previousState()
Get this property is not set if the Task is in its initial Active state. Possible values include: 'active', 'preparing', 'running', 'completed'.
Returns:
previousStateTransitionTime
public DateTime previousStateTransitionTime()
Get this property is not set if the Task is in its initial Active state.
Returns:
requiredSlots
public Integer requiredSlots()
Get 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 must be 1.
Returns:
resourceFiles
public List
Get for multi-instance Tasks, the resource files will only be downloaded to the Compute Node on which the primary Task is executed. 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.
Returns:
state
public TaskState state()
Get possible values include: 'active', 'preparing', 'running', 'completed'.
Returns:
stateTransitionTime
public DateTime stateTransitionTime()
Get the stateTransitionTime value.
Returns:
stats
public TaskStatistics stats()
Get the stats value.
Returns:
url
public String url()
Get the url value.
Returns:
userIdentity
public UserIdentity userIdentity()
Get if omitted, the Task runs as a non-administrative user unique to the Task.
Returns:
withAffinityInfo
public CloudTask withAffinityInfo(AffinityInformation affinityInfo)
Set the affinityInfo value.
Parameters:
Returns:
withApplicationPackageReferences
public CloudTask withApplicationPackageReferences(List
Set application packages are downloaded and deployed to a shared directory, not the Task working directory. Therefore, if a referenced package is already on the Node, and is up to date, then it is not re-downloaded; the existing copy on the Compute Node is used. If a referenced Package cannot be installed, for example because the package has been deleted or because download failed, the Task fails.
Parameters:
Returns:
withAuthenticationTokenSettings
public CloudTask withAuthenticationTokenSettings(AuthenticationTokenSettings authenticationTokenSettings)
Set if this property is set, the Batch service provides the Task with an authentication token which can be used to authenticate Batch service operations without requiring an Account access key. The token is provided via the AZ_BATCH_AUTHENTICATION_TOKEN environment variable. The operations that the Task can carry out using the token depend on the settings. For example, a Task can request Job permissions in order to add other Tasks to the Job, or check the status of the Job or of other Tasks under the Job.
Parameters:
Returns:
withCommandLine
public CloudTask withCommandLine(String commandLine)
Set for multi-instance Tasks, the command line is executed as the primary Task, after the primary Task and all subtasks have finished executing the coordination command line. 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/azure/batch/batch-compute-node-environment-variables).
Parameters:
Returns:
withConstraints
public CloudTask withConstraints(TaskConstraints constraints)
Set the constraints value.
Parameters:
Returns:
withContainerSettings
public CloudTask withContainerSettings(TaskContainerSettings containerSettings)
Set if the Pool that will run this Task has containerConfiguration set, this must be set as well. If the Pool that will run this Task doesn't have containerConfiguration set, this must not be set. When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all Task environment variables are mapped into the container, and the Task command line is executed in the container. Files produced in the container outside of AZ_BATCH_NODE_ROOT_DIR might not be reflected to the host disk, meaning that Batch file APIs will not be able to access those files.
Parameters:
Returns:
withCreationTime
public CloudTask withCreationTime(DateTime creationTime)
Set the creationTime value.
Parameters:
Returns:
withDependsOn
public CloudTask withDependsOn(TaskDependencies dependsOn)
Set this Task will not be scheduled until all Tasks that it depends on have completed successfully. If any of those Tasks fail and exhaust their retry counts, this Task will never be scheduled.
Parameters:
Returns:
withDisplayName
public CloudTask withDisplayName(String displayName)
Set the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024.
Parameters:
Returns:
withETag
public CloudTask withETag(String eTag)
Set this is an opaque string. You can use it to detect whether the Task has changed between requests. In particular, you can be pass the ETag when updating a Task to specify that your changes should take effect only if nobody else has modified the Task in the meantime.
Parameters:
Returns:
withEnvironmentSettings
public CloudTask withEnvironmentSettings(List
Set the environmentSettings value.
Parameters:
Returns:
withExecutionInfo
public CloudTask withExecutionInfo(TaskExecutionInformation executionInfo)
Set the executionInfo value.
Parameters:
Returns:
withExitConditions
public CloudTask withExitConditions(ExitConditions exitConditions)
Set how the Batch service should respond when the Task completes.
Parameters:
Returns:
withId
public CloudTask withId(String id)
Set the ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters.
Parameters:
Returns:
withLastModified
public CloudTask withLastModified(DateTime lastModified)
Set the lastModified value.
Parameters:
Returns:
withMultiInstanceSettings
public CloudTask withMultiInstanceSettings(MultiInstanceSettings multiInstanceSettings)
Set the multiInstanceSettings value.
Parameters:
Returns:
withNodeInfo
public CloudTask withNodeInfo(ComputeNodeInformation nodeInfo)
Set the nodeInfo value.
Parameters:
Returns:
withOutputFiles
public CloudTask withOutputFiles(List
Set for multi-instance Tasks, the files will only be uploaded from the Compute Node on which the primary Task is executed.
Parameters:
Returns:
withPreviousState
public CloudTask withPreviousState(TaskState previousState)
Set this property is not set if the Task is in its initial Active state. Possible values include: 'active', 'preparing', 'running', 'completed'.
Parameters:
Returns:
withPreviousStateTransitionTime
public CloudTask withPreviousStateTransitionTime(DateTime previousStateTransitionTime)
Set this property is not set if the Task is in its initial Active state.
Parameters:
Returns:
withRequiredSlots
public CloudTask withRequiredSlots(Integer requiredSlots)
Set 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 must be 1.
Parameters:
Returns:
withResourceFiles
public CloudTask withResourceFiles(List
Set for multi-instance Tasks, the resource files will only be downloaded to the Compute Node on which the primary Task is executed. 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.
Parameters:
Returns:
withState
public CloudTask withState(TaskState state)
Set possible values include: 'active', 'preparing', 'running', 'completed'.
Parameters:
Returns:
withStateTransitionTime
public CloudTask withStateTransitionTime(DateTime stateTransitionTime)
Set the stateTransitionTime value.
Parameters:
Returns:
withStats
public CloudTask withStats(TaskStatistics stats)
Set the stats value.
Parameters:
Returns:
withUrl
public CloudTask withUrl(String url)
Set the url value.
Parameters:
Returns:
withUserIdentity
public CloudTask withUserIdentity(UserIdentity userIdentity)
Set if omitted, the Task runs as a non-administrative user unique to the Task.
Parameters:
Returns:
Applies to
Azure SDK for Java