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 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.
Method Summary
Modifier and Type | Method and Description |
---|---|
Affinity |
affinityInfo()
Get the affinityInfo value. |
List<Application |
applicationPackageReferences()
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 compute node, and is up to date, then it is not re-downloaded; the existing copy on the compute node is used. If a referenced application package cannot be installed, for example because the package has been deleted or because download failed, the task fails. |
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. 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. |
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/en-us/azure/batch/batch-compute-node-environment-variables). |
Task |
constraints()
Get the constraints value. |
Task |
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. |
DateTime |
creationTime()
Get the creationTime value. |
Task |
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. |
String |
displayName()
Get the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. |
List<Environment |
environmentSettings()
Get the environmentSettings value. |
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. |
Task |
executionInfo()
Get the executionInfo value. |
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. |
DateTime |
lastModified()
Get the lastModified value. |
Multi |
multiInstanceSettings()
Get the multiInstanceSettings value. |
Compute |
nodeInfo()
Get the nodeInfo value. |
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. Possible values include: 'active', 'preparing', 'running', 'completed'. |
DateTime |
previousStateTransitionTime()
Get this property is not set if the task is in its initial Active state. |
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. 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. |
Task |
state()
Get possible values include: 'active', 'preparing', 'running', 'completed'. |
DateTime |
stateTransitionTime()
Get the stateTransitionTime value. |
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 affinityInfo value. |
Cloud |
withApplicationPackageReferences(List<ApplicationPackageReference> applicationPackageReferences)
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 compute node, and is up to date, then it is not re-downloaded; the existing copy on the compute node is used. If a referenced application package cannot be installed, for example because the package has been deleted or because download failed, the task fails. |
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. 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. |
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. 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/en-us/azure/batch/batch-compute-node-environment-variables). |
Cloud |
withConstraints(TaskConstraints constraints)
Set the constraints value. |
Cloud |
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. |
Cloud |
withCreationTime(DateTime creationTime)
Set the creationTime value. |
Cloud |
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. |
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 |
withEnvironmentSettings(List<EnvironmentSetting> environmentSettings)
Set the environmentSettings value. |
Cloud |
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. |
Cloud |
withExecutionInfo(TaskExecutionInformation executionInfo)
Set the executionInfo value. |
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 lastModified value. |
Cloud |
withMultiInstanceSettings(MultiInstanceSettings multiInstanceSettings)
Set the multiInstanceSettings value. |
Cloud |
withNodeInfo(ComputeNodeInformation nodeInfo)
Set the nodeInfo value. |
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. Possible values include: 'active', 'preparing', 'running', 'completed'. |
Cloud |
withPreviousStateTransitionTime(DateTime previousStateTransitionTime)
Set this property is not set if the task is in its initial Active state. |
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. 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. |
Cloud |
withState(TaskState state)
Set possible values include: 'active', 'preparing', 'running', 'completed'. |
Cloud |
withStateTransitionTime(DateTime stateTransitionTime)
Set the stateTransitionTime value. |
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. |
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 compute node, and is up to date, then it is not re-downloaded; the existing copy on the compute node is used. If a referenced application 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/en-us/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.
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:
environmentSettings
public List
Get the environmentSettings value.
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:
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:
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 compute node, and is up to date, then it is not re-downloaded; the existing copy on the compute node is used. If a referenced application 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/en-us/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.
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:
withEnvironmentSettings
public CloudTask withEnvironmentSettings(List
Set the environmentSettings value.
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:
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:
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