JobManagerTask Class
- java.
lang. Object - com.
microsoft. azure. batch. protocol. models. JobManagerTask
- com.
public class JobManagerTask
Specifies details of a Job Manager task. The Job Manager task is automatically started when the job is created. The Batch service tries to schedule the Job Manager task before any other tasks in the job. When shrinking a pool, the Batch service tries to preserve compute nodes where Job Manager tasks are running for as long as possible (that is, nodes running 'normal' tasks are removed before nodes running Job Manager tasks). When a Job Manager task fails and needs to be restarted, the system tries to schedule it at the highest priority. If there are no idle nodes available, the system may terminate one of the running tasks in the pool and return it to the queue in order to make room for the Job Manager task to restart. Note that a Job Manager task in one job does not have priority over tasks in other jobs. Across jobs, only job level priorities are observed. For example, if a Job Manager in a priority 0 job needs to be restarted, it will not displace tasks of a priority 1 job. 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 |
---|---|
Boolean |
allowLowPriorityNode()
Get the default value is true. |
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 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. |
String |
displayName()
Get it 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 |
id()
Get the ID can contain any combination of alphanumeric characters including hyphens and underscores and cannot contain more than 64 characters. |
Boolean |
killJobOnCompletion()
Get if true, when the Job Manager task completes, the Batch service marks the job as complete. If any tasks are still running at this time (other than Job Release), those tasks are terminated. If false, the completion of the Job Manager task does not affect the job status. In this case, you should either use the onAllTasksComplete attribute to terminate the job, or have a client or user terminate the job explicitly. An example of this is if the Job Manager creates a set of tasks but then takes no further role in their execution. The default value is true. If you are using the onAllTasksComplete and onTaskFailure attributes to control job lifetime, and using the Job Manager task only to create the tasks for the job (not to monitor progress), then it is important to set killJobOnCompletion to false. |
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 files listed under this element are located in the task's working directory. 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. |
Boolean |
runExclusive()
Get if true, no other tasks will run on the same compute node for as long as the Job Manager is running. If false, other tasks can run simultaneously with the Job Manager on a compute node. The Job Manager task counts normally against the node's concurrent task limit, so this is only relevant if the node allows multiple concurrent tasks. The default value is true. |
User |
userIdentity()
Get if omitted, the task runs as a non-administrative user unique to the task. |
Job |
withAllowLowPriorityNode(Boolean allowLowPriorityNode)
Set the default value is true. |
Job |
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. |
Job |
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. |
Job |
withCommandLine(String commandLine)
Set 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). |
Job |
withConstraints(TaskConstraints constraints)
Set the constraints value. |
Job |
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. |
Job |
withDisplayName(String displayName)
Set it need not be unique and can contain any Unicode characters up to a maximum length of 1024. |
Job |
withEnvironmentSettings(List<EnvironmentSetting> environmentSettings)
Set the environmentSettings value. |
Job |
withId(String id)
Set the ID can contain any combination of alphanumeric characters including hyphens and underscores and cannot contain more than 64 characters. |
Job |
withKillJobOnCompletion(Boolean killJobOnCompletion)
Set if true, when the Job Manager task completes, the Batch service marks the job as complete. If any tasks are still running at this time (other than Job Release), those tasks are terminated. If false, the completion of the Job Manager task does not affect the job status. In this case, you should either use the onAllTasksComplete attribute to terminate the job, or have a client or user terminate the job explicitly. An example of this is if the Job Manager creates a set of tasks but then takes no further role in their execution. The default value is true. If you are using the onAllTasksComplete and onTaskFailure attributes to control job lifetime, and using the Job Manager task only to create the tasks for the job (not to monitor progress), then it is important to set killJobOnCompletion to false. |
Job |
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. |
Job |
withResourceFiles(List<ResourceFile> resourceFiles)
Set files listed under this element are located in the task's working directory. 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. |
Job |
withRunExclusive(Boolean runExclusive)
Set if true, no other tasks will run on the same compute node for as long as the Job Manager is running. If false, other tasks can run simultaneously with the Job Manager on a compute node. The Job Manager task counts normally against the node's concurrent task limit, so this is only relevant if the node allows multiple concurrent tasks. The default value is true. |
Job |
withUserIdentity(UserIdentity userIdentity)
Set if omitted, the task runs as a non-administrative user unique to the task. |
Method Details
allowLowPriorityNode
public Boolean allowLowPriorityNode()
Get the default value is true.
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 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:
displayName
public String displayName()
Get it 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:
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:
killJobOnCompletion
public Boolean killJobOnCompletion()
Get if true, when the Job Manager task completes, the Batch service marks the job as complete. If any tasks are still running at this time (other than Job Release), those tasks are terminated. If false, the completion of the Job Manager task does not affect the job status. In this case, you should either use the onAllTasksComplete attribute to terminate the job, or have a client or user terminate the job explicitly. An example of this is if the Job Manager creates a set of tasks but then takes no further role in their execution. The default value is true. If you are using the onAllTasksComplete and onTaskFailure attributes to control job lifetime, and using the Job Manager task only to create the tasks for the job (not to monitor progress), then it is important to set killJobOnCompletion to false.
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 files listed under this element are located in the task's working directory. 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:
runExclusive
public Boolean runExclusive()
Get if true, no other tasks will run on the same compute node for as long as the Job Manager is running. If false, other tasks can run simultaneously with the Job Manager on a compute node. The Job Manager task counts normally against the node's concurrent task limit, so this is only relevant if the node allows multiple concurrent tasks. The default value is true.
Returns:
userIdentity
public UserIdentity userIdentity()
Get if omitted, the task runs as a non-administrative user unique to the task.
Returns:
withAllowLowPriorityNode
public JobManagerTask withAllowLowPriorityNode(Boolean allowLowPriorityNode)
Set the default value is true.
Parameters:
Returns:
withApplicationPackageReferences
public JobManagerTask 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 JobManagerTask 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 JobManagerTask withCommandLine(String commandLine)
Set 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 JobManagerTask withConstraints(TaskConstraints constraints)
Set the constraints value.
Parameters:
Returns:
withContainerSettings
public JobManagerTask 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:
withDisplayName
public JobManagerTask withDisplayName(String displayName)
Set it need not be unique and can contain any Unicode characters up to a maximum length of 1024.
Parameters:
Returns:
withEnvironmentSettings
public JobManagerTask withEnvironmentSettings(List
Set the environmentSettings value.
Parameters:
Returns:
withId
public JobManagerTask 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:
withKillJobOnCompletion
public JobManagerTask withKillJobOnCompletion(Boolean killJobOnCompletion)
Set if true, when the Job Manager task completes, the Batch service marks the job as complete. If any tasks are still running at this time (other than Job Release), those tasks are terminated. If false, the completion of the Job Manager task does not affect the job status. In this case, you should either use the onAllTasksComplete attribute to terminate the job, or have a client or user terminate the job explicitly. An example of this is if the Job Manager creates a set of tasks but then takes no further role in their execution. The default value is true. If you are using the onAllTasksComplete and onTaskFailure attributes to control job lifetime, and using the Job Manager task only to create the tasks for the job (not to monitor progress), then it is important to set killJobOnCompletion to false.
Parameters:
Returns:
withOutputFiles
public JobManagerTask 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 JobManagerTask withResourceFiles(List
Set files listed under this element are located in the task's working directory. 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:
withRunExclusive
public JobManagerTask withRunExclusive(Boolean runExclusive)
Set if true, no other tasks will run on the same compute node for as long as the Job Manager is running. If false, other tasks can run simultaneously with the Job Manager on a compute node. The Job Manager task counts normally against the node's concurrent task limit, so this is only relevant if the node allows multiple concurrent tasks. The default value is true.
Parameters:
Returns:
withUserIdentity
public JobManagerTask 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