Package com.azure.compute.batch.models
Class BatchTask
java.lang.Object
com.azure.compute.batch.models.BatchTask
- All Implemented Interfaces:
com.azure.json.JsonSerializable<BatchTask>
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BatchTask
fromJson
(com.azure.json.JsonReader jsonReader) Reads an instance of BatchTask from the JsonReader.Get the affinityInfo property: A locality hint that can be used by the Batch service to select a Compute Node on which to start the new Task.Get the applicationPackageReferences property: A list of Packages that the Batch service will deploy to the Compute Node before running the command line.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 Task.Get the constraints property: The execution constraints that apply to this Task.Get the containerSettings property: The settings for the container under which the Task runs.Get the creationTime property: The creation time of the Task.Get the dependsOn property: The Tasks that this Task depends on.Get the displayName property: A display name for the Task.Get the environmentSettings property: A list of environment variable settings for the Task.getETag()
Get the eTag property: The ETag of the Task.Get the executionInfo property: Information about the execution of the Task.Get the exitConditions property: How the Batch service should respond when the Task completes.getId()
Get the id property: A string that uniquely identifies the Task within the Job.Get the lastModified property: The last modified time of the Task.Get the multiInstanceSettings property: An object that indicates that the Task is a multi-instance Task, and contains information about how to run the multi-instance Task.Get the nodeInfo property: Information about the Compute Node on which the Task ran.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 previousState property: The previous state of the Task.Get the previousStateTransitionTime property: The time at which the Task entered its previous state.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.getState()
Get the state property: The current state of the Task.Get the stateTransitionTime property: The time at which the Task entered its current state.getStats()
Get the stats property: Resource usage statistics for the Task.getUrl()
Get the url property: The URL of the Task.Get the userIdentity property: The user identity under which the Task runs.setConstraints
(BatchTaskConstraints constraints) Set the constraints property: The execution constraints that apply to this Task.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
-
BatchTask
public BatchTask()Creates an instance of BatchTask class.
-
-
Method Details
-
getId
Get the id property: A string that uniquely identifies the 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: A display name for the Task. The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024.- Returns:
- the displayName value.
-
getUrl
Get the url property: The URL of the Task.- Returns:
- the url value.
-
getETag
Get the eTag property: The ETag of the Task. 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:
- the eTag value.
-
getLastModified
Get the lastModified property: The last modified time of the Task.- Returns:
- the lastModified value.
-
getCreationTime
Get the creationTime property: The creation time of the Task.- Returns:
- the creationTime value.
-
getExitConditions
Get the exitConditions property: How the Batch service should respond when the Task completes.- Returns:
- the exitConditions value.
-
getState
Get the state property: The current state of the Task.- Returns:
- the state value.
-
getStateTransitionTime
Get the stateTransitionTime property: The time at which the Task entered its current state.- Returns:
- the stateTransitionTime value.
-
getPreviousState
Get the previousState property: The previous state of the Task. This property is not set if the Task is in its initial Active state.- Returns:
- the previousState value.
-
getPreviousStateTransitionTime
Get the previousStateTransitionTime property: The time at which the Task entered its previous state. This property is not set if the Task is in its initial Active state.- Returns:
- the previousStateTransitionTime value.
-
getCommandLine
Get the commandLine property: The command line of the Task. 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://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 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.
-
getResourceFiles
Get the resourceFiles property: A list of files that the Batch service will download to the Compute Node before running the command line. 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:
- the resourceFiles value.
-
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.
-
getEnvironmentSettings
Get the environmentSettings property: A list of environment variable settings for the Task.- Returns:
- the environmentSettings value.
-
getAffinityInfo
Get the affinityInfo property: A locality hint that can be used by the Batch service to select a Compute Node on which to start the new Task.- Returns:
- the affinityInfo value.
-
getConstraints
Get the constraints property: The execution constraints that apply to this Task.- Returns:
- the constraints value.
-
setConstraints
Set the constraints property: The execution constraints that apply to this Task.- Parameters:
constraints
- the constraints value to set.- Returns:
- the BatchTask 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 must be 1.- Returns:
- the requiredSlots value.
-
getUserIdentity
Get the userIdentity property: The user identity under which the Task runs. If omitted, the Task runs as a non-administrative user unique to the Task.- Returns:
- the userIdentity value.
-
getExecutionInfo
Get the executionInfo property: Information about the execution of the Task.- Returns:
- the executionInfo value.
-
getNodeInfo
Get the nodeInfo property: Information about the Compute Node on which the Task ran.- Returns:
- the nodeInfo value.
-
getMultiInstanceSettings
Get the multiInstanceSettings property: An object that indicates that the Task is a multi-instance Task, and contains information about how to run the multi-instance Task.- Returns:
- the multiInstanceSettings value.
-
getStats
Get the stats property: Resource usage statistics for the Task.- Returns:
- the stats value.
-
getDependsOn
Get the dependsOn property: The Tasks that this Task depends on. 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:
- the dependsOn value.
-
getApplicationPackageReferences
Get the applicationPackageReferences property: A list of 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 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:
- the applicationPackageReferences value.
-
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.
-
toJson
- Specified by:
toJson
in interfacecom.azure.json.JsonSerializable<BatchTask>
- Throws:
IOException
-
fromJson
Reads an instance of BatchTask from the JsonReader.- Parameters:
jsonReader
- The JsonReader being read.- Returns:
- An instance of BatchTask if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
- Throws:
IOException
- If an error occurs while reading the BatchTask.
-