Azkaban的Web Server源码探究系列24: 一次性执行execute任务取出处理

血红的双手。 提交于 2019-12-05 07:43:35

提交之后,很不幸,有个问题如下:

抓包分析:

请求和响应分别如下:

所以接下来需要对这个URL进行debug

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

GET /executor?execid=6&ajax=fetchexecflow

stop in azkaban.webapp.servlet.ExecutorServlet.doGet

stop in  azkaban.webapp.servlet.ExecutorServlet.ajaxFetchExecutableFlow

run

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

经过研究,发现这样的行为

看来是需要跟踪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上呢?

欲知后事,且听下回分解!




标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!