学习作业启动

This commit is contained in:
LingZhaoHui 2023-12-07 22:54:36 +08:00
parent 9a5a33e0b2
commit e9090ffc74
Signed by: zeekling
GPG Key ID: D96E4E75267CA2CC

View File

@ -288,6 +288,22 @@ protected void handleJobSetup(CommitterJobSetupEvent event) {
} }
``` ```
SetupCompletedTransition的处理逻辑如下可以看到会定时启动MapTask和ReduceTask。
```java
public void transition(JobImpl job, JobEvent event) {
job.setupProgress = 1.0f;
job.scheduleTasks(job.mapTasks, job.numReduceTasks == 0);
job.scheduleTasks(job.reduceTasks, true);
// If we have no tasks, just transition to job completed
if (job.numReduceTasks == 0 && job.numMapTasks == 0) {
job.eventHandler.handle(new JobEvent(job.jobId,
JobEventType.JOB_COMPLETED));
}
}
```
checkReadyForCommit函数的实现如下可以看到在触发了CommitterJobCommitEvent事件,在CommitterJobCommitEvent里面会触发JOB_COMMIT事件。主要处理逻辑在handleJobCommit里面。 checkReadyForCommit函数的实现如下可以看到在触发了CommitterJobCommitEvent事件,在CommitterJobCommitEvent里面会触发JOB_COMMIT事件。主要处理逻辑在handleJobCommit里面。
```java ```java
@ -344,3 +360,14 @@ protected void handleJobCommit(CommitterJobCommitEvent event) {
} }
} }
``` ```
##### CommitSucceededTransition
提交成功的事件处理handler为CommitSucceededTransition核心处理逻辑如下
```java
job.logJobHistoryFinishedEvent();
job.finished(JobStateInternal.SUCCEEDED);
```