Share via


BatchTaskCreateParameters Class

  • java.lang.Object
    • com.azure.compute.batch.models.BatchTaskCreateParameters

Implements

public final class BatchTaskCreateParameters
implements JsonSerializable<BatchTaskCreateParameters>

Parameters for creating an Azure Batch Task.

Constructor Summary

Constructor Description
BatchTaskCreateParameters(String id, String commandLine)

Creates an instance of BatchTaskCreateParameters class.

Method Summary

Modifier and Type Method and Description
static BatchTaskCreateParameters fromJson(JsonReader jsonReader)

Reads an instance of BatchTaskCreateParameters from the JsonReader.

BatchAffinityInfo 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.

List<BatchApplicationPackageReference> getApplicationPackageReferences()

Get the applicationPackageReferences property: A list of Packages that the Batch service will deploy to the Compute Node before running the command line.

AuthenticationTokenSettings getAuthenticationTokenSettings()

Get the authenticationTokenSettings property: The settings for an authentication token that the Task can use to perform Batch service operations.

String getCommandLine()

Get the commandLine property: The command line of the Task.

BatchTaskConstraints getConstraints()

Get the constraints property: The execution constraints that apply to this Task.

BatchTaskContainerSettings getContainerSettings()

Get the containerSettings property: The settings for the container under which the Task runs.

BatchTaskDependencies getDependsOn()

Get the dependsOn property: The Tasks that this Task depends on.

String getDisplayName()

Get the displayName property: A display name for the Task.

List<EnvironmentSetting> getEnvironmentSettings()

Get the environmentSettings property: A list of environment variable settings for the Task.

ExitConditions getExitConditions()

Get the exitConditions property: How the Batch service should respond when the Task completes.

String getId()

Get the id property: A string that uniquely identifies the Task within the Job.

MultiInstanceSettings 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.

List<OutputFile> getOutputFiles()

Get the outputFiles property: A list of files that the Batch service will upload from the Compute Node after running the command line.

Integer getRequiredSlots()

Get the requiredSlots property: The number of scheduling slots that the Task required to run.

List<ResourceFile> getResourceFiles()

Get the resourceFiles property: A list of files that the Batch service will download to the Compute Node before running the command line.

UserIdentity getUserIdentity()

Get the userIdentity property: The user identity under which the Task runs.

BatchTaskCreateParameters setAffinityInfo(BatchAffinityInfo affinityInfo)

Set 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.

BatchTaskCreateParameters setApplicationPackageReferences(List<BatchApplicationPackageReference> applicationPackageReferences)

Set the applicationPackageReferences property: A list of Packages that the Batch service will deploy to the Compute Node before running the command line.

BatchTaskCreateParameters setAuthenticationTokenSettings(AuthenticationTokenSettings authenticationTokenSettings)

Set the authenticationTokenSettings property: The settings for an authentication token that the Task can use to perform Batch service operations.

BatchTaskCreateParameters setConstraints(BatchTaskConstraints constraints)

Set the constraints property: The execution constraints that apply to this Task.

BatchTaskCreateParameters setContainerSettings(BatchTaskContainerSettings containerSettings)

Set the containerSettings property: The settings for the container under which the Task runs.

BatchTaskCreateParameters setDependsOn(BatchTaskDependencies dependsOn)

Set the dependsOn property: The Tasks that this Task depends on.

BatchTaskCreateParameters setDisplayName(String displayName)

Set the displayName property: A display name for the Task.

BatchTaskCreateParameters setEnvironmentSettings(List<EnvironmentSetting> environmentSettings)

Set the environmentSettings property: A list of environment variable settings for the Task.

BatchTaskCreateParameters setExitConditions(ExitConditions exitConditions)

Set the exitConditions property: How the Batch service should respond when the Task completes.

BatchTaskCreateParameters setMultiInstanceSettings(MultiInstanceSettings multiInstanceSettings)

Set 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.

BatchTaskCreateParameters 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.

BatchTaskCreateParameters setRequiredSlots(Integer requiredSlots)

Set the requiredSlots property: The number of scheduling slots that the Task required to run.

BatchTaskCreateParameters 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.

BatchTaskCreateParameters setUserIdentity(UserIdentity userIdentity)

Set the userIdentity property: The user identity under which the Task runs.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from java.lang.Object

Constructor Details

BatchTaskCreateParameters

public BatchTaskCreateParameters(String id, String commandLine)

Creates an instance of BatchTaskCreateParameters class.

Parameters:

id - the id value to set.
commandLine - the commandLine value to set.

Method Details

fromJson

public static BatchTaskCreateParameters fromJson(JsonReader jsonReader)

Reads an instance of BatchTaskCreateParameters from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of BatchTaskCreateParameters if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If the deserialized JSON object was missing any required properties.

getAffinityInfo

public BatchAffinityInfo 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.

getApplicationPackageReferences

public List<BatchApplicationPackageReference> 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

public AuthenticationTokenSettings 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.

getCommandLine

public String 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.

getConstraints

public BatchTaskConstraints getConstraints()

Get the constraints property: The execution constraints that apply to this Task. 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:

the constraints value.

getContainerSettings

public BatchTaskContainerSettings 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.

getDependsOn

public BatchTaskDependencies 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. If the Job does not have usesTaskDependencies set to true, and this element is present, the request fails with error code TaskDependenciesNotSpecifiedOnJob.

Returns:

the dependsOn value.

getDisplayName

public String 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.

getEnvironmentSettings

public List<EnvironmentSetting> getEnvironmentSettings()

Get the environmentSettings property: A list of environment variable settings for the Task.

Returns:

the environmentSettings value.

getExitConditions

public ExitConditions getExitConditions()

Get the exitConditions property: How the Batch service should respond when the Task completes.

Returns:

the exitConditions value.

getId

public String 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. 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:

the id value.

getMultiInstanceSettings

public MultiInstanceSettings 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.

getOutputFiles

public List<OutputFile> 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.

getRequiredSlots

public Integer getRequiredSlots()

Get the requiredSlots property: The number of scheduling slots that the Task required 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.

getResourceFiles

public List<ResourceFile> 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.

getUserIdentity

public UserIdentity 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.

setAffinityInfo

public BatchTaskCreateParameters setAffinityInfo(BatchAffinityInfo affinityInfo)

Set 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.

Parameters:

affinityInfo - the affinityInfo value to set.

Returns:

the BatchTaskCreateParameters object itself.

setApplicationPackageReferences

public BatchTaskCreateParameters setApplicationPackageReferences(List<BatchApplicationPackageReference> applicationPackageReferences)

Set 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.

Parameters:

applicationPackageReferences - the applicationPackageReferences value to set.

Returns:

the BatchTaskCreateParameters object itself.

setAuthenticationTokenSettings

public BatchTaskCreateParameters 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 BatchTaskCreateParameters object itself.

setConstraints

public BatchTaskCreateParameters setConstraints(BatchTaskConstraints constraints)

Set the constraints property: The execution constraints that apply to this Task. 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:

constraints - the constraints value to set.

Returns:

the BatchTaskCreateParameters object itself.

setContainerSettings

public BatchTaskCreateParameters setContainerSettings(BatchTaskContainerSettings containerSettings)

Set 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.

Parameters:

containerSettings - the containerSettings value to set.

Returns:

the BatchTaskCreateParameters object itself.

setDependsOn

public BatchTaskCreateParameters setDependsOn(BatchTaskDependencies dependsOn)

Set 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. If the Job does not have usesTaskDependencies set to true, and this element is present, the request fails with error code TaskDependenciesNotSpecifiedOnJob.

Parameters:

dependsOn - the dependsOn value to set.

Returns:

the BatchTaskCreateParameters object itself.

setDisplayName

public BatchTaskCreateParameters setDisplayName(String displayName)

Set 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.

Parameters:

displayName - the displayName value to set.

Returns:

the BatchTaskCreateParameters object itself.

setEnvironmentSettings

public BatchTaskCreateParameters setEnvironmentSettings(List<EnvironmentSetting> environmentSettings)

Set the environmentSettings property: A list of environment variable settings for the Task.

Parameters:

environmentSettings - the environmentSettings value to set.

Returns:

the BatchTaskCreateParameters object itself.

setExitConditions

public BatchTaskCreateParameters setExitConditions(ExitConditions exitConditions)

Set the exitConditions property: How the Batch service should respond when the Task completes.

Parameters:

exitConditions - the exitConditions value to set.

Returns:

the BatchTaskCreateParameters object itself.

setMultiInstanceSettings

public BatchTaskCreateParameters setMultiInstanceSettings(MultiInstanceSettings multiInstanceSettings)

Set 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.

Parameters:

multiInstanceSettings - the multiInstanceSettings value to set.

Returns:

the BatchTaskCreateParameters object itself.

setOutputFiles

public BatchTaskCreateParameters 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. 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 BatchTaskCreateParameters object itself.

setRequiredSlots

public BatchTaskCreateParameters setRequiredSlots(Integer requiredSlots)

Set the requiredSlots property: The number of scheduling slots that the Task required 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.

Parameters:

requiredSlots - the requiredSlots value to set.

Returns:

the BatchTaskCreateParameters object itself.

setResourceFiles

public BatchTaskCreateParameters 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. 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:

resourceFiles - the resourceFiles value to set.

Returns:

the BatchTaskCreateParameters object itself.

setUserIdentity

public BatchTaskCreateParameters setUserIdentity(UserIdentity userIdentity)

Set 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.

Parameters:

userIdentity - the userIdentity value to set.

Returns:

the BatchTaskCreateParameters object itself.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to