任务开始事件Task start event

当任务已计划由计划程序在计算节点上启动时,会发出此事件。This event is emitted once a task has been scheduled to start on a compute node by the scheduler. 请注意,如果重试任务或对其进行重新排队,此事件将再次发出,但重试计数和系统任务版本将相应更新。Note that if the task is retried or requeued this event will be emitted again for the same task, but the retry count and system task version will be updated accordingly.

以下示例显示任务开始事件的正文。The following example shows the body of a task start event.

{
    "jobId": "myJob",
    "id": "myTask",
    "taskType": "User",
    "systemTaskVersion": 220192842,
    "nodeInfo": {
        "poolId": "pool-001",
        "nodeId": "tvm-257509324_1-20160908t162728z"
    },
    "multiInstanceSettings": {
        "numberOfInstances": 1
    },
    "constraints": {
        "maxTaskRetryCount": 2
    },
    "executionInfo": {
        "retryCount": 0
    }
}
元素名称Element name 类型Type 说明Notes
jobId StringString 包含任务的作业的 ID。The ID of the job containing the task.
id StringString 任务的 ID。The ID of the task.
taskType StringString 任务的类型。The type of the task. 它可以是“JobManager”(指示它是作业管理器任务),也可以是“User”(指示它并非作业管理器任务)。This can either be 'JobManager' indicating it is a job manager task or 'User' indicating it is not a job manager task.
systemTaskVersion Int32Int32 这是任务上的内部重试计数器。This is the internal retry counter on a task. 批处理服务可能会在内部重试任务来解决暂时性问题。Internally the Batch service can retry a task to account for transient issues. 这些问题可能包括内部计划错误或尝试恢复处于错误状态的计算节点。These issues can include internal scheduling errors or attempts to recover from compute nodes in a bad state.
nodeInfo 复杂类型Complex Type 包含有关运行任务的计算节点的信息。Contains information about the compute node on which the task ran.
multiInstanceSettings 复杂类型Complex Type 指定任务是需要多个计算节点的多实例任务。Specifies that the task is Multi-Instance Task requiring multiple compute nodes. 有关详细信息,请参阅 multiInstanceSettingsSee multiInstanceSettings for details.
constraints 复杂类型Complex Type 应用到此任务的执行约束。The execution constraints that apply to this task.
executionInfo 复杂类型Complex Type 包含有关任务执行的信息。Contains information about the execution of the task.

nodeInfonodeInfo

元素名称Element name 类型Type 说明Notes
poolId StringString 运行任务的池的 ID。The ID of the pool on which the task ran.
nodeId StringString 运行任务的节点的 ID。The ID of the node on which the task ran.

multiInstanceSettingsmultiInstanceSettings

元素名称Element name 类型Type 说明Notes
numberOfInstances IntInt 任务所需的计算节点数。The number of compute nodes required by the task.

constraintsconstraints

元素名称Element name 类型Type 说明Notes
maxTaskRetryCount Int32Int32 可以重试任务的最大次数。The maximum number of times the task may be retried. 批处理服务在其退出代码非零时重试任务。The Batch service retries a task if its exit code is nonzero.

请注意,此值专门用于控制重试的次数。Note that this value specifically controls the number of retries. 批处理服务将尝试任务一次,然后重试,直至达到此上限为止。The Batch service will try the task once, and may then retry up to this limit. 例如,如果最大重试计数为 3,则批处理任务最多尝试任务 4 次(一次是初始尝试,其余 3 次是重试)。For example, if the maximum retry count is 3, Batch tries a task up to 4 times (one initial try and 3 retries).

如果最大重试计数为 0,则批处理服务不会重试任务。If the maximum retry count is 0, the Batch service does not retry tasks.

如果最大重试计数为 -1,则批处理服务会无限制地重试任务。If the maximum retry count is -1, the Batch service retries tasks without limit.

默认值为 0(不重试)。The default value is 0 (no retries).

executionInfoexecutionInfo

元素名称Element name 类型Type 说明Notes
retryCount Int32Int32 批处理服务重试任务的次数。The number of times the task has been retried by the Batch service. 如果任务使用非零退出代码退出,该任务会重试,直至达到指定的 MaxTaskRetryCountThe task is retried if it exits with a nonzero exit code, up to the specified MaxTaskRetryCount