TaskAddParameter Class
- java.
lang. Object - com.
microsoft. azure. batch. protocol. models. TaskAddParameter
- com.
public class TaskAddParameter
An Azure Batch task to add. 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 if you do not specify constraints, the maxTaskRetryCount is the maxTaskRetryCount specified for the job, the maxWallClockTime is infinite, and the retentionTime is 7 days. |
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. |
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. If the job does not have usesTaskDependencies set to true, and this element is present, the request fails with error code TaskDependenciesNotSpecifiedOnJob. |
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. |
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. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within a job that differ only by case). |
Multi |
multiInstanceSettings()
Get the multiInstanceSettings 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. |
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. |
User |
userIdentity()
Get if omitted, the task runs as a non-administrative user unique to the task. |
Task |
withAffinityInfo(AffinityInformation affinityInfo)
Set the affinityInfo value. |
Task |
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. |
Task |
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. |
Task |
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). |
Task |
withConstraints(TaskConstraints constraints)
Set if you do not specify constraints, the maxTaskRetryCount is the maxTaskRetryCount specified for the job, the maxWallClockTime is infinite, and the retentionTime is 7 days. |
Task |
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. |
Task |
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. If the job does not have usesTaskDependencies set to true, and this element is present, the request fails with error code TaskDependenciesNotSpecifiedOnJob. |
Task |
withDisplayName(String displayName)
Set the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. |
Task |
withEnvironmentSettings(List<EnvironmentSetting> environmentSettings)
Set the environmentSettings value. |
Task |
withExitConditions(ExitConditions exitConditions)
Set how the Batch service should respond when the task completes. |
Task |
withId(String id)
Set the ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within a job that differ only by case). |
Task |
withMultiInstanceSettings(MultiInstanceSettings multiInstanceSettings)
Set the multiInstanceSettings value. |
Task |
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. |
Task |
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. |
Task |
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 if you do not specify constraints, the maxTaskRetryCount is the maxTaskRetryCount specified for the job, the maxWallClockTime is infinite, and the retentionTime is 7 days.
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:
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. If the job does not have usesTaskDependencies set to true, and this element is present, the request fails with error code TaskDependenciesNotSpecifiedOnJob.
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:
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. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within a job that differ only by case).
Returns:
multiInstanceSettings
public MultiInstanceSettings multiInstanceSettings()
Get the multiInstanceSettings 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:
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:
userIdentity
public UserIdentity userIdentity()
Get if omitted, the task runs as a non-administrative user unique to the task.
Returns:
withAffinityInfo
public TaskAddParameter withAffinityInfo(AffinityInformation affinityInfo)
Set the affinityInfo value.
Parameters:
Returns:
withApplicationPackageReferences
public TaskAddParameter 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 TaskAddParameter 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 TaskAddParameter 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 TaskAddParameter withConstraints(TaskConstraints constraints)
Set if you do not specify constraints, the maxTaskRetryCount is the maxTaskRetryCount specified for the job, the maxWallClockTime is infinite, and the retentionTime is 7 days.
Parameters:
Returns:
withContainerSettings
public TaskAddParameter 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:
withDependsOn
public TaskAddParameter 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. If the job does not have usesTaskDependencies set to true, and this element is present, the request fails with error code TaskDependenciesNotSpecifiedOnJob.
Parameters:
Returns:
withDisplayName
public TaskAddParameter 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 TaskAddParameter withEnvironmentSettings(List
Set the environmentSettings value.
Parameters:
Returns:
withExitConditions
public TaskAddParameter withExitConditions(ExitConditions exitConditions)
Set how the Batch service should respond when the task completes.
Parameters:
Returns:
withId
public TaskAddParameter withId(String id)
Set the ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within a job that differ only by case).
Parameters:
Returns:
withMultiInstanceSettings
public TaskAddParameter withMultiInstanceSettings(MultiInstanceSettings multiInstanceSettings)
Set the multiInstanceSettings value.
Parameters:
Returns:
withOutputFiles
public TaskAddParameter 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:
withResourceFiles
public TaskAddParameter 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:
withUserIdentity
public TaskAddParameter 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