Azkaban的Web Server源碼探究系列24: 一次性執行execute任務取出處理

提交以後,很不幸,有個問題以下:web

抓包分析:ajax

請求和響應分別以下:app

因此接下來須要對這個URL進行debugwebapp

==============================================================================fetch

GET /executor?execid=6&ajax=fetchexecflowspa

stop in azkaban.webapp.servlet.ExecutorServlet.doGet線程

stop in  azkaban.webapp.servlet.ExecutorServlet.ajaxFetchExecutableFlowdebug

runcode

==============================================================================ci

通過研究,發現這樣的行爲

看來是須要跟蹤QueueProcessorThread了。


stop  in  azkaban.executor.ExecutorManager$QueueProcessorThread.run

stop in azkaban.executor.ExecutorManager$QueueProcessorThread.handle


這個線程執行的是

selectExecutorAndDispatchFlow(reference, exflow, new HashSet<Executor>(activeExecutors));

往下就是:

Executor selectedExecutor = selectExecutor(exflow, availableExecutors);

//用戶若是指定了executor,就導向對應的executor

Executor choosenExecutor = getUserSpecifiedExecutor(exflow.getExecutionOptions(), exflow.getExecutionId());

// 

// If no executor was specified by admin

if (choosenExecutor == null) {//不然的話

ExecutorSelector selector = new ExecutorSelector(filterList, comparatorWeightsMap);

choosenExecutor = selector.getBest(availableExecutors, exflow);

}

return choosenExecutor;

那麼,究竟是如何選出來的呢?

若是沒有指定comparator的話,就是基於executor自身的hashcode來算的,蛋疼!

===========================================================================================================

好,下一個問題就是任務如何發到指定的executor上呢?

欲知後事,且聽下回分解!

相關文章
相關標籤/搜索