Share via


BatchJobReleaseTask Class

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

Implements

public final class BatchJobReleaseTask
implements JsonSerializable<BatchJobReleaseTask>

A Job Release Task to run on Job completion on any Compute Node where the Job has run. The Job Release Task runs when the Job ends, because of one of the following: The user calls the Terminate Job API, or the Delete Job API while the Job is still active, the Job's maximum wall clock time constraint is reached, and the Job is still active, or the Job's Job Manager Task completed, and the Job is configured to terminate when the Job Manager completes. The Job Release Task runs on each Node where Tasks of the Job have run and the Job Preparation Task ran and completed. If you reimage a Node after it has run the Job Preparation Task, and the Job ends without any further Tasks of the Job running on that Node (and hence the Job Preparation Task does not re-run), then the Job Release Task does not run on that Compute Node. If a Node reboots while the Job Release Task is still running, the Job Release Task runs again when the Compute Node starts up. The Job is not marked as complete until all Job Release Tasks have completed. The Job Release Task runs in the background. It does not occupy a scheduling slot; that is, it does not count towards the taskSlotsPerNode limit specified on the Pool.

Constructor Summary

Constructor Description
BatchJobReleaseTask(String commandLine)

Creates an instance of BatchJobReleaseTask class.

Method Summary

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

Reads an instance of BatchJobReleaseTask from the JsonReader.

String getCommandLine()

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

BatchTaskContainerSettings getContainerSettings()

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

List<EnvironmentSetting> getEnvironmentSettings()

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

String getId()

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

Duration getMaxWallClockTime()

Get the maxWallClockTime property: The maximum elapsed time that the Job Release Task may run on a given Compute Node, measured from the time the Task starts.

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.

Duration getRetentionTime()

Get the retentionTime property: The minimum time to retain the Task directory for the Job Release Task on the Compute Node.

UserIdentity getUserIdentity()

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

BatchJobReleaseTask setContainerSettings(BatchTaskContainerSettings containerSettings)

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

BatchJobReleaseTask setEnvironmentSettings(List<EnvironmentSetting> environmentSettings)

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

BatchJobReleaseTask setId(String id)

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

BatchJobReleaseTask setMaxWallClockTime(Duration maxWallClockTime)

Set the maxWallClockTime property: The maximum elapsed time that the Job Release Task may run on a given Compute Node, measured from the time the Task starts.

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

BatchJobReleaseTask setRetentionTime(Duration retentionTime)

Set the retentionTime property: The minimum time to retain the Task directory for the Job Release Task on the Compute Node.

BatchJobReleaseTask setUserIdentity(UserIdentity userIdentity)

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

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from java.lang.Object

Constructor Details

BatchJobReleaseTask

public BatchJobReleaseTask(String commandLine)

Creates an instance of BatchJobReleaseTask class.

Parameters:

commandLine - the commandLine value to set.

Method Details

fromJson

public static BatchJobReleaseTask fromJson(JsonReader jsonReader)

Reads an instance of BatchJobReleaseTask from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of BatchJobReleaseTask 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.

getCommandLine

public String getCommandLine()

Get the commandLine property: The command line of the Job Release 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

public BatchTaskContainerSettings getContainerSettings()

Get the containerSettings property: The settings for the container under which the Job Release Task runs. 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.

getEnvironmentSettings

public List<EnvironmentSetting> getEnvironmentSettings()

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

Returns:

the environmentSettings value.

getId

public String getId()

Get the id property: A string that uniquely identifies the Job Release Task within the Job. The ID can contain any combination of alphanumeric characters including hyphens and underscores and cannot contain more than 64 characters. If you do not specify this property, the Batch service assigns a default value of 'jobrelease'. No other Task in the Job can have the same ID as the Job Release Task. If you try to submit a Task with the same id, the Batch service rejects the request with error code TaskIdSameAsJobReleaseTask; if you are calling the REST API directly, the HTTP status code is 409 (Conflict).

Returns:

the id value.

getMaxWallClockTime

public Duration getMaxWallClockTime()

Get the maxWallClockTime property: The maximum elapsed time that the Job Release Task may run on a given Compute Node, measured from the time the Task starts. If the Task does not complete within the time limit, the Batch service terminates it. The default value is 15 minutes. You may not specify a timeout longer than 15 minutes. If you do, the Batch service rejects it with an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request).

Returns:

the maxWallClockTime 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. 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. Files listed under this element are located in the Task's working directory.

Returns:

the resourceFiles value.

getRetentionTime

public Duration getRetentionTime()

Get the retentionTime property: The minimum time to retain the Task directory for the Job Release Task on the Compute Node. After this time, the Batch service may delete the Task directory and all its contents. The default is 7 days, i.e. the Task directory will be retained for 7 days unless the Compute Node is removed or the Job is deleted.

Returns:

the retentionTime value.

getUserIdentity

public UserIdentity getUserIdentity()

Get the userIdentity property: The user identity under which the Job Release Task runs. If omitted, the Task runs as a non-administrative user unique to the Task.

Returns:

the userIdentity value.

setContainerSettings

public BatchJobReleaseTask setContainerSettings(BatchTaskContainerSettings containerSettings)

Set the containerSettings property: The settings for the container under which the Job Release Task runs. 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 BatchJobReleaseTask object itself.

setEnvironmentSettings

public BatchJobReleaseTask setEnvironmentSettings(List<EnvironmentSetting> environmentSettings)

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

Parameters:

environmentSettings - the environmentSettings value to set.

Returns:

the BatchJobReleaseTask object itself.

setId

public BatchJobReleaseTask setId(String id)

Set the id property: A string that uniquely identifies the Job Release Task within the Job. The ID can contain any combination of alphanumeric characters including hyphens and underscores and cannot contain more than 64 characters. If you do not specify this property, the Batch service assigns a default value of 'jobrelease'. No other Task in the Job can have the same ID as the Job Release Task. If you try to submit a Task with the same id, the Batch service rejects the request with error code TaskIdSameAsJobReleaseTask; if you are calling the REST API directly, the HTTP status code is 409 (Conflict).

Parameters:

id - the id value to set.

Returns:

the BatchJobReleaseTask object itself.

setMaxWallClockTime

public BatchJobReleaseTask setMaxWallClockTime(Duration maxWallClockTime)

Set the maxWallClockTime property: The maximum elapsed time that the Job Release Task may run on a given Compute Node, measured from the time the Task starts. If the Task does not complete within the time limit, the Batch service terminates it. The default value is 15 minutes. You may not specify a timeout longer than 15 minutes. If you do, the Batch service rejects it with an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request).

Parameters:

maxWallClockTime - the maxWallClockTime value to set.

Returns:

the BatchJobReleaseTask object itself.

setResourceFiles

public BatchJobReleaseTask 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. 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. Files listed under this element are located in the Task's working directory.

Parameters:

resourceFiles - the resourceFiles value to set.

Returns:

the BatchJobReleaseTask object itself.

setRetentionTime

public BatchJobReleaseTask setRetentionTime(Duration retentionTime)

Set the retentionTime property: The minimum time to retain the Task directory for the Job Release Task on the Compute Node. After this time, the Batch service may delete the Task directory and all its contents. The default is 7 days, i.e. the Task directory will be retained for 7 days unless the Compute Node is removed or the Job is deleted.

Parameters:

retentionTime - the retentionTime value to set.

Returns:

the BatchJobReleaseTask object itself.

setUserIdentity

public BatchJobReleaseTask setUserIdentity(UserIdentity userIdentity)

Set the userIdentity property: The user identity under which the Job Release 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 BatchJobReleaseTask object itself.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to