Package com.azure.compute.batch.models
Class BatchJobManagerTask
java.lang.Object
com.azure.compute.batch.models.BatchJobManagerTask
- All Implemented Interfaces:
com.azure.json.JsonSerializable<BatchJobManagerTask>
public final class BatchJobManagerTask
extends Object
implements com.azure.json.JsonSerializable<BatchJobManagerTask>
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 Nodes where
Job Manager Tasks are running for as long as possible (that is, Compute Nodes
running 'normal' Tasks are removed before Compute 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 Compute
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 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
ConstructorsConstructorDescriptionBatchJobManagerTask
(String id, String commandLine) Creates an instance of BatchJobManagerTask class. -
Method Summary
Modifier and TypeMethodDescriptionstatic BatchJobManagerTask
fromJson
(com.azure.json.JsonReader jsonReader) Reads an instance of BatchJobManagerTask from the JsonReader.Get the applicationPackageReferences property: A list of Application Packages that the Batch service will deploy to the Compute Node before running the command line.Application Packages are downloaded and deployed to a shared directory, not the Task working directory.Get the authenticationTokenSettings property: The settings for an authentication token that the Task can use to perform Batch service operations.Get the commandLine property: The command line of the Job Manager Task.Get the constraints property: Constraints that apply to the Job Manager Task.Get the containerSettings property: The settings for the container under which the Job Manager Task runs.Get the displayName property: The display name of the Job Manager Task.Get the environmentSettings property: A list of environment variable settings for the Job Manager Task.getId()
Get the id property: A string that uniquely identifies the Job Manager Task within the Job.Get the outputFiles property: A list of files that the Batch service will upload from the Compute Node after running the command line.Get the requiredSlots property: The number of scheduling slots that the Task requires to run.Get the resourceFiles property: A list of files that the Batch service will download to the Compute Node before running the command line.Get the userIdentity property: The user identity under which the Job Manager Task runs.Get the allowLowPriorityNode property: Whether the Job Manager Task may run on a Spot/Low-priority Compute Node.Get the killJobOnCompletion property: Whether completion of the Job Manager Task signifies completion of the entire Job.Get the runExclusive property: Whether the Job Manager Task requires exclusive use of the Compute Node where it runs.setAllowLowPriorityNode
(Boolean allowLowPriorityNode) Set the allowLowPriorityNode property: Whether the Job Manager Task may run on a Spot/Low-priority Compute Node.setApplicationPackageReferences
(List<BatchApplicationPackageReference> applicationPackageReferences) Set the applicationPackageReferences property: A list of Application Packages that the Batch service will deploy to the Compute Node before running the command line.Application Packages are downloaded and deployed to a shared directory, not the Task working directory.setAuthenticationTokenSettings
(AuthenticationTokenSettings authenticationTokenSettings) Set the authenticationTokenSettings property: The settings for an authentication token that the Task can use to perform Batch service operations.setConstraints
(BatchTaskConstraints constraints) Set the constraints property: Constraints that apply to the Job Manager Task.setContainerSettings
(BatchTaskContainerSettings containerSettings) Set the containerSettings property: The settings for the container under which the Job Manager Task runs.setDisplayName
(String displayName) Set the displayName property: The display name of the Job Manager Task.setEnvironmentSettings
(List<EnvironmentSetting> environmentSettings) Set the environmentSettings property: A list of environment variable settings for the Job Manager Task.setKillJobOnCompletion
(Boolean killJobOnCompletion) Set the killJobOnCompletion property: Whether completion of the Job Manager Task signifies completion of the entire Job.setOutputFiles
(List<OutputFile> outputFiles) Set the outputFiles property: A list of files that the Batch service will upload from the Compute Node after running the command line.setRequiredSlots
(Integer requiredSlots) Set the requiredSlots property: The number of scheduling slots that the Task requires to run.setResourceFiles
(List<ResourceFile> resourceFiles) Set the resourceFiles property: A list of files that the Batch service will download to the Compute Node before running the command line.setRunExclusive
(Boolean runExclusive) Set the runExclusive property: Whether the Job Manager Task requires exclusive use of the Compute Node where it runs.setUserIdentity
(UserIdentity userIdentity) Set the userIdentity property: The user identity under which the Job Manager Task runs.com.azure.json.JsonWriter
toJson
(com.azure.json.JsonWriter jsonWriter) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.azure.json.JsonSerializable
toJson, toJson, toJsonBytes, toJsonString
-
Constructor Details
-
BatchJobManagerTask
Creates an instance of BatchJobManagerTask class.- Parameters:
id
- the id value to set.commandLine
- the commandLine value to set.
-
-
Method Details
-
getId
Get the id property: A string that uniquely identifies the Job Manager Task within the Job. The ID can contain any combination of alphanumeric characters including hyphens and underscores and cannot contain more than 64 characters.- Returns:
- the id value.
-
getDisplayName
Get the displayName property: The display name of the Job Manager Task. It need not be unique and can contain any Unicode characters up to a maximum length of 1024.- Returns:
- the displayName value.
-
setDisplayName
Set the displayName property: The display name of the Job Manager Task. It need not be unique and can contain any Unicode characters up to a maximum length of 1024.- Parameters:
displayName
- the displayName value to set.- Returns:
- the BatchJobManagerTask object itself.
-
getCommandLine
Get the commandLine property: The command line of the Job Manager Task. 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://learn.microsoft.com/azure/batch/batch-compute-node-environment-variables).- Returns:
- the commandLine value.
-
getContainerSettings
Get the containerSettings property: The settings for the container under which the Job Manager Task runs. 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:
- the containerSettings value.
-
setContainerSettings
Set the containerSettings property: The settings for the container under which the Job Manager Task runs. 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:
containerSettings
- the containerSettings value to set.- Returns:
- the BatchJobManagerTask object itself.
-
getResourceFiles
Get the resourceFiles property: A list of files that the Batch service will download to the Compute Node before running the command line. 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:
- the resourceFiles value.
-
setResourceFiles
Set the resourceFiles property: A list of files that the Batch service will download to the Compute Node before running the command line. 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:
resourceFiles
- the resourceFiles value to set.- Returns:
- the BatchJobManagerTask object itself.
-
getOutputFiles
Get the outputFiles property: A list of files that the Batch service will upload from the Compute Node after running the command line. For multi-instance Tasks, the files will only be uploaded from the Compute Node on which the primary Task is executed.- Returns:
- the outputFiles value.
-
setOutputFiles
Set the outputFiles property: A list of files that the Batch service will upload from the Compute Node after running the command line. For multi-instance Tasks, the files will only be uploaded from the Compute Node on which the primary Task is executed.- Parameters:
outputFiles
- the outputFiles value to set.- Returns:
- the BatchJobManagerTask object itself.
-
getEnvironmentSettings
Get the environmentSettings property: A list of environment variable settings for the Job Manager Task.- Returns:
- the environmentSettings value.
-
setEnvironmentSettings
Set the environmentSettings property: A list of environment variable settings for the Job Manager Task.- Parameters:
environmentSettings
- the environmentSettings value to set.- Returns:
- the BatchJobManagerTask object itself.
-
getConstraints
Get the constraints property: Constraints that apply to the Job Manager Task.- Returns:
- the constraints value.
-
setConstraints
Set the constraints property: Constraints that apply to the Job Manager Task.- Parameters:
constraints
- the constraints value to set.- Returns:
- the BatchJobManagerTask object itself.
-
getRequiredSlots
Get the requiredSlots property: The number of scheduling slots that the Task requires to run. 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 property is not supported and must not be specified.- Returns:
- the requiredSlots value.
-
setRequiredSlots
Set the requiredSlots property: The number of scheduling slots that the Task requires to run. 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 property is not supported and must not be specified.- Parameters:
requiredSlots
- the requiredSlots value to set.- Returns:
- the BatchJobManagerTask object itself.
-
isKillJobOnCompletion
Get the killJobOnCompletion property: Whether completion of the Job Manager Task signifies completion of the entire Job. 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:
- the killJobOnCompletion value.
-
setKillJobOnCompletion
Set the killJobOnCompletion property: Whether completion of the Job Manager Task signifies completion of the entire Job. 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:
killJobOnCompletion
- the killJobOnCompletion value to set.- Returns:
- the BatchJobManagerTask object itself.
-
getUserIdentity
Get the userIdentity property: The user identity under which the Job Manager Task runs. If omitted, the Task runs as a non-administrative user unique to the Task.- Returns:
- the userIdentity value.
-
setUserIdentity
Set the userIdentity property: The user identity under which the Job Manager Task runs. If omitted, the Task runs as a non-administrative user unique to the Task.- Parameters:
userIdentity
- the userIdentity value to set.- Returns:
- the BatchJobManagerTask object itself.
-
isRunExclusive
Get the runExclusive property: Whether the Job Manager Task requires exclusive use of the Compute Node where it runs. If true, no other Tasks will run on the same 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 Compute Node's concurrent Task limit, so this is only relevant if the Compute Node allows multiple concurrent Tasks. The default value is true.- Returns:
- the runExclusive value.
-
setRunExclusive
Set the runExclusive property: Whether the Job Manager Task requires exclusive use of the Compute Node where it runs. If true, no other Tasks will run on the same 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 Compute Node's concurrent Task limit, so this is only relevant if the Compute Node allows multiple concurrent Tasks. The default value is true.- Parameters:
runExclusive
- the runExclusive value to set.- Returns:
- the BatchJobManagerTask object itself.
-
getApplicationPackageReferences
Get the applicationPackageReferences property: A list of Application Packages that the Batch service will deploy to the Compute Node before running the command line.Application Packages are downloaded and deployed to a shared directory, not the Task working directory. Therefore, if a referenced Application 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:
- the applicationPackageReferences value.
-
setApplicationPackageReferences
public BatchJobManagerTask setApplicationPackageReferences(List<BatchApplicationPackageReference> applicationPackageReferences) Set the applicationPackageReferences property: A list of Application Packages that the Batch service will deploy to the Compute Node before running the command line.Application Packages are downloaded and deployed to a shared directory, not the Task working directory. Therefore, if a referenced Application 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:
applicationPackageReferences
- the applicationPackageReferences value to set.- Returns:
- the BatchJobManagerTask object itself.
-
getAuthenticationTokenSettings
Get the authenticationTokenSettings property: The settings for an authentication token that the Task can use to perform Batch service operations. 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:
- the authenticationTokenSettings value.
-
setAuthenticationTokenSettings
public BatchJobManagerTask setAuthenticationTokenSettings(AuthenticationTokenSettings authenticationTokenSettings) Set the authenticationTokenSettings property: The settings for an authentication token that the Task can use to perform Batch service operations. 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:
authenticationTokenSettings
- the authenticationTokenSettings value to set.- Returns:
- the BatchJobManagerTask object itself.
-
isAllowLowPriorityNode
Get the allowLowPriorityNode property: Whether the Job Manager Task may run on a Spot/Low-priority Compute Node. The default value is true.- Returns:
- the allowLowPriorityNode value.
-
setAllowLowPriorityNode
Set the allowLowPriorityNode property: Whether the Job Manager Task may run on a Spot/Low-priority Compute Node. The default value is true.- Parameters:
allowLowPriorityNode
- the allowLowPriorityNode value to set.- Returns:
- the BatchJobManagerTask object itself.
-
toJson
- Specified by:
toJson
in interfacecom.azure.json.JsonSerializable<BatchJobManagerTask>
- Throws:
IOException
-
fromJson
Reads an instance of BatchJobManagerTask from the JsonReader.- Parameters:
jsonReader
- The JsonReader being read.- Returns:
- An instance of BatchJobManagerTask if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
- Throws:
IllegalStateException
- If the deserialized JSON object was missing any required properties.IOException
- If an error occurs while reading the BatchJobManagerTask.
-