美文网首页
azkaban 开发环境搭建

azkaban 开发环境搭建

作者: wangqiaoshi | 来源:发表于2017-01-09 20:06 被阅读0次
    • 使用工具intelij

    启动AzkabanWebServer

    azkaban webServer的入口函数是AzkabanWebServer.

     String staticDir =
            azkabanSettings.getString("web.resource.dir", DEFAULT_STATIC_DIR);
        logger.info("Setting up web resource dir " + staticDir);
        Context root = new Context(server, "/", Context.SESSIONS);
        root.setMaxFormContentSize(MAX_FORM_CONTENT_SIZE);
    
        String defaultServletPath =
            azkabanSettings.getString("azkaban.default.servlet.path", "/index");
        root.setResourceBase(staticDir);
        ServletHolder indexRedirect =
            new ServletHolder(new IndexRedirectServlet(defaultServletPath));
        root.addServlet(indexRedirect, "/");
        ServletHolder index = new ServletHolder(new ProjectServlet());
        root.addServlet(index, "/index");
    
        ServletHolder staticServlet = new ServletHolder(new DefaultServlet());
        root.addServlet(staticServlet, "/css/*");
        root.addServlet(staticServlet, "/js/*");
        root.addServlet(staticServlet, "/images/*");
        root.addServlet(staticServlet, "/fonts/*");
        root.addServlet(staticServlet, "/favicon.ico");
    
        root.addServlet(new ServletHolder(new ProjectManagerServlet()), "/manager");
        root.addServlet(new ServletHolder(new ExecutorServlet()), "/executor");
        root.addServlet(new ServletHolder(new HistoryServlet()), "/history");
        root.addServlet(new ServletHolder(new ScheduleServlet()), "/schedule");
        root.addServlet(new ServletHolder(new JMXHttpServlet()), "/jmx");
        root.addServlet(new ServletHolder(new TriggerManagerServlet()), "/triggers");
        root.addServlet(new ServletHolder(new StatsServlet()), "/stats");
    
        ServletHolder restliHolder = new ServletHolder(new RestliServlet());
        restliHolder.setInitParameter("resourcePackages", "azkaban.restli");
        root.addServlet(restliHolder, "/restli/*");
    
        String viewerPluginDir =
            azkabanSettings.getString("viewer.plugin.dir", "plugins/viewer");
        loadViewerPlugins(root, viewerPluginDir, app.getVelocityEngine());
    
        // triggerplugin
        String triggerPluginDir =
            azkabanSettings.getString("trigger.plugin.dir", "plugins/triggers");
        Map<String, TriggerPlugin> triggerPlugins =
            loadTriggerPlugins(root, triggerPluginDir, app);
        app.setTriggerPlugins(triggerPlugins);
        // always have basic time trigger
        // TODO: find something else to do the job
        app.getTriggerManager().start();
    

    从代码中可以看出来,web.resource.dir默认是"",那么会加载工作目录下的css,js,images,fonts.
    所以intelij设置working directory,设为azkaban-web-server/src
    最好更改azkaban.properties

    web.resource.dir=/Users/wqs/workplace/azkaban/azkaban-web-server/build/install/azkaban-web-server/web/
    

    设置intelij 入口函数AzkabanWebServer参数为-conf /Users/wqs/workplace/azkaban/azkaban-web-server/src/main/config/conf

    接着就可以直接运行了

    问题

    • Error:(23, 27) java: 程序包azkaban.restli.user不存在
      azkaban采用了rest.li来实现rest。
      步骤:
      gradle build,先把azkaban.restli.user编译成类文件 rest.li

    • executor接收不到web-server的执行任务的请求
      原因:
      缺失:moment.min.js ,bootstrap-datetimepicker.min.js,moment-timezone-with-data-2010- 2020.min.js,later.min.js,在mac上无法获取mem,cpu等信息.

    if (exists_Bash && exists_Cat && exists_Grep && exists_Meminfo) {
          java.lang.ProcessBuilder processBuilder =
              new java.lang.ProcessBuilder("/bin/bash", "-c",
                  "/bin/cat /proc/meminfo | grep -E \"^MemTotal:|^MemFree:|^Buffers:|^Cached:|^SwapCached:\"");
          try {
            ArrayList<String> output = new ArrayList<String>();
            Process process = processBuilder.start();
            process.waitFor();
            InputStream inputStream = process.getInputStream();
            try {
              java.io.BufferedReader reader = new java.io.BufferedReader(new InputStreamReader(inputStream));
              String line = null;
              while ((line = reader.readLine()) != null) {
                output.add(line);
              }
            } finally {
              inputStream.close();
            }
    ..........
    

    步骤:
    1./bin/cat /proc/meminfo | grep -E MemTotal:|MemFree:|Buffers:|Cached:|^SwapCached
    命令在mac上执行不了,所以如果在mac上执行,需要重新改造
    2.通过执行gradle install,从web/查找缺少的css,js

    相关文章

      网友评论

          本文标题:azkaban 开发环境搭建

          本文链接:https://www.haomeiwen.com/subject/tjcpvttx.html