这篇文章给大家介绍FlowRunner是如何推动Graph的前进,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。
现在,我们知道一个job的执行过程,那么整个flow是一个图,图是如何推进的,如何推进下一个job的执行呢?这就是本节需要解决的问题!
jdb azkaban.execapp.AzkabanExecutorServer -conf /root/azkb/azkaban_3.
0
.0_debug/conf
stop in azkaban.execapp.FlowRunner.progressGraph
这个用图的算法就可以解决,下面研究下flow的结束部分
stop in azkaban.execapp.FlowRunner.finishExecutableNode
azkaban.execapp.FlowRunnerManager --- flow的listener
@Override
public void handleEvent(Event event) {
if (event.getType() == Event.Type.FLOW_FINISHED) {
FlowRunner flowRunner = (FlowRunner) event.getRunner();
ExecutableFlow flow = flowRunner.getExecutableFlow();
recentlyFinishedFlows.put(flow.getExecutionId(), flow);
logger.info("Flow " + flow.getExecutionId() + " is finished. Adding it to recently finished flows list.");
runningFlows.remove(flow.getExecutionId());
}
}
这个很简单!
那么,问题来了,一个Flow如何结束呢? 收尾工作要做好!
if (outNodeIds.isEmpty()) {
//
// There's no outnodes means it's the end of a flow, so we
// finalize
// and fire an event.
finalizeFlow(parentFlow);
然后这个函数里,
// If the finalized flow is actually the top level flow, than we finish
// the main loop.
if (flow instanceof ExecutableFlow) {
flowFinished = true;
}
这样就设置了flowFinished = true;
=======跳出for循环
private void runFlow() throws Exception {
logger.info("Starting flows");
runReadyJob(this.flow);
updateFlow();
// 跳出这个循环
while (!flowFinished) {
===跳出来之后,执行
logger.info("Finishing up flow. Awaiting Termination");
executorService.shutdown();
updateFlow();
logger.info("Finished Flow");
关闭当前的进程,整个flowRunner这个task就结束了,顺利!
关于FlowRunner是如何推动Graph的前进就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。