共用方式為


JobPreparationTask Class

Definition

A Job Preparation Task to run before any Tasks of the Job on any given Compute Node.

public class JobPreparationTask
type JobPreparationTask = class
Public Class JobPreparationTask
Inheritance
JobPreparationTask

Remarks

You can use Job Preparation to prepare a Node to run Tasks for the Job. Activities commonly performed in Job Preparation include: Downloading common resource files used by all the Tasks in the Job. The Job Preparation Task can download these common resource files to the shared location on the Node. (AZ_BATCH_NODE_ROOT_DIR\shared), or starting a local service on the Node so that all Tasks of that Job can communicate with it. If the Job Preparation Task fails (that is, exhausts its retry count before exiting with exit code 0), Batch will not run Tasks of this Job on the Node. The Compute Node remains ineligible to run Tasks of this Job until it is reimaged. The Compute Node remains active and can be used for other Jobs. The Job Preparation Task can run multiple times on the same Node. Therefore, you should write the Job Preparation Task to handle re-execution. If the Node is rebooted, the Job Preparation Task is run again on the Compute Node before scheduling any other Task of the Job, if rerunOnNodeRebootAfterSuccess is true or if the Job Preparation Task did not previously complete. If the Node is reimaged, the Job Preparation Task is run again before scheduling any Task of the 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.

Constructors

JobPreparationTask()

Initializes a new instance of the JobPreparationTask class.

JobPreparationTask(String, String, TaskContainerSettings, IList<ResourceFile>, IList<EnvironmentSetting>, TaskConstraints, Nullable<Boolean>, UserIdentity, Nullable<Boolean>)

Initializes a new instance of the JobPreparationTask class.

Properties

CommandLine

Gets or sets the command line of the Job Preparation Task.

Constraints

Gets or sets constraints that apply to the Job Preparation Task.

ContainerSettings

Gets or sets the settings for the container under which the Job Preparation Task runs.

EnvironmentSettings

Gets or sets a list of environment variable settings for the Job Preparation Task.

Id

Gets or sets a string that uniquely identifies the Job Preparation Task within the Job.

RerunOnNodeRebootAfterSuccess

Gets or sets whether the Batch service should rerun the Job Preparation Task after a Compute Node reboots.

ResourceFiles

Gets or sets a list of files that the Batch service will download to the Compute Node before running the command line.

UserIdentity

Gets or sets the user identity under which the Job Preparation Task runs.

WaitForSuccess

Gets or sets whether the Batch service should wait for the Job Preparation Task to complete successfully before scheduling any other Tasks of the Job on the Compute Node. A Job Preparation Task has completed successfully if it exits with exit code 0.

Applies to