学习作业启动

This commit is contained in:
LingZhaoHui 2023-12-06 00:22:29 +08:00
parent 60ae030016
commit a3980b8012
Signed by: zeekling
GPG Key ID: D96E4E75267CA2CC

View File

@ -239,9 +239,9 @@ protected void startJobs() {
核心处理逻辑如下,主要是触发了几个事件:
- JobHistoryEvent
- JobHistoryEvent事件处理的handler为JobHistoryEventHandler。
- JobInfoChangeEvent
- CommitterJobSetupEvent
- CommitterJobSetupEvent作业启动的事件核心处理逻辑在EventProcessor中的函数handleJobSetup中。
```java
public void transition(JobImpl job, JobEvent event) {
@ -268,3 +268,23 @@ public void transition(JobImpl job, JobEvent event) {
}
```
handleJobSetup的核心处理逻辑
- 创建attempt路径。
- 触发JobSetupCompletedEvent事件。从事件实现来看会触发JobImpl里面的JOB_SETUP_COMPLETED事件类型由SetupCompletedTransition来处理当前事件。
```java
protected void handleJobSetup(CommitterJobSetupEvent event) {
try {
// 主要是创建attempt路径
committer.setupJob(event.getJobContext());
context.getEventHandler().handle(
new JobSetupCompletedEvent(event.getJobID()));
} catch (Exception e) {
LOG.warn("Job setup failed", e);
context.getEventHandler().handle(new JobSetupFailedEvent(
event.getJobID(), StringUtils.stringifyException(e)));
}
}
```