/**
* Constructor
*/
public AzkabanWebServer(Server server, Props props) throws Exception {
this.props = props;
this.server = server;
velocityEngine =
configureVelocityEngine(props
.getBoolean(VELOCITY_DEV_MODE_PARAM, false));
sessionCache = new SessionCache(props);//SessionCache是用来保存session的,google.common.Cache
userManager = loadUserManager(props);//加载用户管理类,默认是XmlUserManager,可以实现UserManager接口,
alerters = loadAlerters(props);
executorManager = loadExecutorManager(props);//executor管理器,获取所有executor,更新executor,获取executor整在跑的flow,获取当前flow在跑的个数等
projectManager = loadProjectManager(props);
triggerManager = loadTriggerManager(props);
loadBuiltinCheckersAndActions();
// load all trigger agents here
scheduleManager = loadScheduleManager(triggerManager, props);
String triggerPluginDir =
props.getString("trigger.plugin.dir", "plugins/triggers");
loadPluginCheckersAndActions(triggerPluginDir);
baseClassLoader = this.getClassLoader();
tempDir = new File(props.getString("azkaban.temp.dir", "temp"));
// Setup time zone
if (props.containsKey(DEFAULT_TIMEZONE_ID)) {
String timezone = props.getString(DEFAULT_TIMEZONE_ID);
System.setProperty("user.timezone", timezone);
TimeZone.setDefault(TimeZone.getTimeZone(timezone));
DateTimeZone.setDefault(DateTimeZone.forID(timezone));
logger.info("Setting timezone to " + timezone);
}
configureMBeanServer();
if (props.getBoolean(ServerProperties.IS_METRICS_ENABLED, false)) {
startWebMetrics();
}
}
上面是AzkabanWebServer的构造函数,AzkabanWebServer有如下的管理器:
- userManager
- projectManager
- executorManager
- scheduleManager
- triggerManager
Usermanager
用户管理器,管理当前用户是否存在,获取该用户详细信息,比如所在的组,角色.可以通过它实现当前可以操作、查看哪些project
ProjectManager
工程管理器,管理工程创建、上传、下载、存储project,flow,properties信息.获取工程的所有流,获取流的所有job,解析zip包成flows,job
ExecutorManager
executor管理器,它有两种模式,单机版或集群版.如果单机版,获取executor,获取executor正在执行的flow,向executor提交flow、取消job、提交job等
scheduleManager
调度管理器
triggerManager
触发管理器.