共用方式為


StartTask Class

Definition

A task which is run when a compute 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 compute node. Examples of recovery operations include (but are not limited to) when an unhealthy compute 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. Special care should be taken to avoid start tasks which create breakaway process or install/launch services from the start task working directory, as this will block Batch from being able to re-run the start task.

Constructors

StartTask()

Initializes a new instance of the StartTask class.

StartTask(String)

Initializes a new instance of the StartTask class.

Properties

CommandLine

Gets or sets the command line of the task.

ContainerSettings

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

EnvironmentSettings

Gets or sets a set of environment settings for the start task.

MaxTaskRetryCount

Gets or sets the maximum number of retries for the task.

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 task runs.

WaitForSuccess

Gets or sets a value indicating whether the Batch service should wait for the start task to complete before scheduling any tasks on the compute node.

Applies to