這篇文章給大家介紹FlowRunner是如何推動(dòng)Graph的前進(jìn),內(nèi)容非常詳細(xì),感興趣的小伙伴們可以參考借鑒,希望對(duì)大家能有所幫助。
專注于為中小企業(yè)提供做網(wǎng)站、網(wǎng)站建設(shè)服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)城中免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動(dòng)了上千余家企業(yè)的穩(wěn)健成長(zhǎng),幫助中小企業(yè)通過(guò)網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。
現(xiàn)在,我們知道一個(gè)job的執(zhí)行過(guò)程,那么整個(gè)flow是一個(gè)圖,圖是如何推進(jìn)的,如何推進(jìn)下一個(gè)job的執(zhí)行呢?這就是本節(jié)需要解決的問(wèn)題!
jdb azkaban.execapp.AzkabanExecutorServer -conf /root/azkb/azkaban_3.
0
.0_debug/conf
stop in azkaban.execapp.FlowRunner.progressGraph
這個(gè)用圖的算法就可以解決,下面研究下flow的結(jié)束部分
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());
}
}
這個(gè)很簡(jiǎn)單!
那么,問(wèn)題來(lái)了,一個(gè)Flow如何結(jié)束呢? 收尾工作要做好!
if (outNodeIds.isEmpty()) {
//
// There's no outnodes means it's the end of a flow, so we
// finalize
// and fire an event.
finalizeFlow(parentFlow);
然后這個(gè)函數(shù)里,
// If the finalized flow is actually the top level flow, than we finish
// the main loop.
if (flow instanceof ExecutableFlow) {
flowFinished = true;
}
這樣就設(shè)置了flowFinished = true;
=======跳出for循環(huán)
private void runFlow() throws Exception {
logger.info("Starting flows");
runReadyJob(this.flow);
updateFlow();
// 跳出這個(gè)循環(huán)
while (!flowFinished) {
===跳出來(lái)之后,執(zhí)行
logger.info("Finishing up flow. Awaiting Termination");
executorService.shutdown();
updateFlow();
logger.info("Finished Flow");
關(guān)閉當(dāng)前的進(jìn)程,整個(gè)flowRunner這個(gè)task就結(jié)束了,順利!
關(guān)于FlowRunner是如何推動(dòng)Graph的前進(jìn)就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到。