学习作业启动
This commit is contained in:
parent
60ae030016
commit
a3980b8012
@ -239,9 +239,9 @@ protected void startJobs() {
|
|||||||
|
|
||||||
核心处理逻辑如下,主要是触发了几个事件:
|
核心处理逻辑如下,主要是触发了几个事件:
|
||||||
|
|
||||||
- JobHistoryEvent:
|
- JobHistoryEvent:事件处理的handler为JobHistoryEventHandler。
|
||||||
- JobInfoChangeEvent:
|
- JobInfoChangeEvent:
|
||||||
- CommitterJobSetupEvent:
|
- CommitterJobSetupEvent:作业启动的事件,核心处理逻辑在EventProcessor中的函数handleJobSetup中。
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public void transition(JobImpl job, JobEvent event) {
|
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)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user