Package azkaban.app

Examples of azkaban.app.JobManager


                                                            ImmutableMap.<String, Class<? extends Job>>of("java", JavaJob.class,
                                                                                                          "command", ProcessJob.class,
                                                                                                          "javaprocess", JavaProcessJob.class,
                                                                                                          "pig", PigProcessJob.class));

        JobManager jobManager = new JobManager(factory,
                                               cl.getLogDir().getAbsolutePath(),
                                               cl.getDefaultProps(),
                                               cl.getJobDirs(),
                                               cl.getClassloader());

        File executionsStorageFile = new File(".");
        if(!executionsStorageFile.exists()) {
            executionsStorageFile.mkdirs();
        }

        long lastId = 0;
        for(File file: executionsStorageFile.listFiles()) {
            final String filename = file.getName();
            if(filename.endsWith(".json")) {
                try {
                    lastId = Math.max(lastId,
                                      Long.parseLong(filename.substring(0, filename.length() - 5)));
                } catch(NumberFormatException e) {}
            }
        }

        final ExecutableFlowSerializer flowSerializer = new DefaultExecutableFlowSerializer();
        final ExecutableFlowDeserializer flowDeserializer = new DefaultExecutableFlowDeserializer(jobManager, factory);
        FlowExecutionSerializer flowExecutionSerializer = new FlowExecutionSerializer(flowSerializer);
        FlowExecutionDeserializer flowExecutionDeserializer = new FlowExecutionDeserializer(flowDeserializer);


        FlowManager allFlows = new RefreshableFlowManager(jobManager,
                                                          flowExecutionSerializer,
                                                          flowExecutionDeserializer,
                                                          executionsStorageFile,
                                                          lastId);
        jobManager.setFlowManager(allFlows);

        final CountDownLatch countDown = new CountDownLatch(jobNames.size());

        for(String jobName: jobNames) {
            try {
View Full Code Here


            addError(req, "Can only run flow instance on one job.");
                return "";
          }
         
          String jobName = jobNames[0];
            JobManager jobManager = app.getJobManager();
            JobDescriptor descriptor = jobManager.getJobDescriptor(jobName);
            if (descriptor == null) {
              addError(req, "Can only run flow instance on one job.");
                return "";
            }
            else {
View Full Code Here

        Map<String, Object> params = this._multipartParser.parseMultipart(request);

        try {
            final AzkabanApplication app = getApplication();
            final JobManager jobManager = app.getJobManager();

            FileItem item = (FileItem) params.get("file");
            String deployPath = (String) params.get("path");
            File jobDir = unzipFile(item);

            jobManager.deployJobDir(jobDir.getAbsolutePath(), deployPath);
        } catch (Exception e) {
            log.info("Installation Failed.", e);
            String redirectError = (String)params.get("redirect_error");
            setMessagedUrl(response, redirectError, "Installation Failed: " + e.getLocalizedMessage());
View Full Code Here

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
            IOException {
        AzkabanApplication app = getApplication();
        String jobId = req.getParameter("id");
        JobManager jobManager = app.getJobManager();
        Map<String, JobDescriptor> descriptors = jobManager.loadJobDescriptors();
        boolean isEditing = req.getParameter("edit") != null;
        if(jobId == null) {
            Page page = newPage(req, resp, "azkaban/web/pages/edit_job.vm");
            page.add("jsonData", getJSONText(new Props()));
            page.render();
        } else if(isEditing) {
            Page page = newPage(req, resp, "azkaban/web/pages/edit_job.vm");
            JobDescriptor jdesc = descriptors.get(jobId);

            page.add("job", jdesc);
            page.add("jsonData", getJSONText(jdesc.getProps()));
            page.render();
        } else {
            Page page = newPage(req, resp, "azkaban/web/pages/job_detail.vm");
            JobDescriptor jdesc = descriptors.get(jobId);
            page.add("job", jdesc);
            page.add("descriptors", descriptors);
            page.add("jsonData", getJSONText(jdesc.getProps()));
          if (req.getParameter("logs") != null) {
            page.add("tab", "logs");
          }
           
            List<JobExecution> execs = jobManager.loadJobExecutions(jobId);
            int successes = 0;
            for(JobExecution exec: execs)
                if(exec.isSucceeded())
                    successes++;
            page.add("executions", execs);
View Full Code Here

  @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        AzkabanApplication app = getApplication();
       
        JobManager jobManager = app.getJobManager();
        String jobName = req.getParameter("job_name");
        String jobPath = req.getParameter("job_path");
        Map<String, String> props = new HashMap<String, String>();
        for(int i = 0;; i++) {
            String key = req.getParameter("key" + i);
            String val = req.getParameter("val" + i);
            if(key == null || val == null)
                break;
            if(key.length() > 0)
                props.put(key, val);
        }
        try {
            jobManager.deployJob(jobName, jobPath, new Props(null, props));
            addMessage(req, jobName + " has been deployed to " + jobPath);
            resp.sendRedirect(req.getContextPath() + "/job?id=" + jobName);
        } catch(Exception e) {
            logger.error("Failed to deploy job.", e);
            addError(req, "Failed to deploy job: " + e.getMessage());
View Full Code Here

    @Test
    public void testAllBaseJobsCompleted() throws Exception
    {
        EasyMock.replay(mockFlow1, mockFlow2, props);

        final JobManager factory = EasyMock.createStrictMock(JobManager.class);
        EasyMock.replay(factory);

        final IndividualJobExecutableFlow completedJob1 = new IndividualJobExecutableFlow("blah", "blah", factory);
        final IndividualJobExecutableFlow completedJob2 = new IndividualJobExecutableFlow("blah", "blah", factory);
View Full Code Here

TOP

Related Classes of azkaban.app.JobManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.