Condividi tramite


StartTask Class

Definition

A Task which is run when a Node joins a Pool in the Azure Batch service, or when the Compute Node is rebooted or reimaged.

public class StartTask
type StartTask = class
Public Class StartTask
Inheritance
StartTask

Remarks

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. In some cases the StartTask may be re-run even though the Compute Node was not rebooted. Special care should be taken to avoid StartTasks which create breakaway process or install/launch services from the StartTask working directory, as this will block Batch from being able to re-run the StartTask.

Constructors

StartTask()

Initializes a new instance of the StartTask class.

StartTask(String, TaskContainerSettings, IList<ResourceFile>, IList<EnvironmentSetting>, UserIdentity, Nullable<Int32>, Nullable<Boolean>)

Initializes a new instance of the StartTask class.

Properties

CommandLine

Gets or sets the command line of the StartTask.

ContainerSettings

Gets or sets the settings for the container under which the StartTask runs.

EnvironmentSettings

Gets or sets a list of environment variable settings for the StartTask.

MaxTaskRetryCount

Gets or sets the maximum number of times the Task may be retried.

ResourceFiles

Gets or sets 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.

UserIdentity

Gets or sets the user identity under which the StartTask runs.

WaitForSuccess

Gets or sets whether the Batch service should wait for the StartTask to complete successfully (that is, to exit with exit code 0) before scheduling any Tasks on the Compute Node.

Applies to