Package org.apache.oozie.client

Examples of org.apache.oozie.client.WorkflowJob


* EL function for fs action executor.
*/
public class FsELFunctions {

    private static FileSystem getFileSystem(URI uri) throws HadoopAccessorException {
        WorkflowJob workflow = DagELFunctions.getWorkflow();
        String user = workflow.getUser();
        String group = workflow.getGroup();
        HadoopAccessorService has = Services.get().get(HadoopAccessorService.class);
        JobConf conf = has.createJobConf(uri.getAuthority());
        return has.createFileSystem(user, uri, conf);
    }
View Full Code Here


        /* (non-Javadoc)
         * @see org.apache.oozie.action.ActionExecutor.Context#getAppFileSystem()
         */
        public FileSystem getAppFileSystem() throws HadoopAccessorException, IOException, URISyntaxException {
            WorkflowJob workflow = getWorkflow();
            URI uri = new URI(getWorkflow().getAppPath());
            HadoopAccessorService has = Services.get().get(HadoopAccessorService.class);
            Configuration fsConf = has.createJobConf(uri.getAuthority());
            return has.createFileSystem(workflow.getUser(), uri, fsConf);

        }
View Full Code Here


            final String jobId = wc.submit(conf);
            assertNotNull(jobId);

            WorkflowJob wf = wc.getJobInfo(jobId);
            assertNotNull(wf);
            assertEquals(WorkflowJob.Status.PREP, wf.getStatus());

            boolean dateTest = wf.getLastModifiedTime().compareTo(wf.getCreatedTime()) >= 0 ? true : false;
            assertEquals(true, dateTest);

            wc.start(jobId);
            wf = wc.getJobInfo(jobId);

            Date lastModTime = wf.getLastModifiedTime();

            wc.suspend(jobId);
            wf = wc.getJobInfo(jobId);

            dateTest = wf.getLastModifiedTime().compareTo(lastModTime) >= 0 ? true : false;
            assertEquals(true, dateTest);

            lastModTime = wf.getLastModifiedTime();

            sleep(1000);

            wc.resume(jobId);
            wf = wc.getJobInfo(jobId);

            dateTest = wf.getLastModifiedTime().compareTo(lastModTime) >= 0 ? true : false;
            assertEquals(true, dateTest);

            waitFor(600000, new Predicate() {
                public boolean evaluate() throws Exception {
                    WorkflowJob wf = wc.getJobInfo(jobId);
                    return wf.getStatus() == WorkflowJob.Status.SUCCEEDED;
                }
            });

            wf = wc.getJobInfo(jobId);
            assertNotNull(wf);
            assertEquals(WorkflowJob.Status.SUCCEEDED, wf.getStatus());

            dateTest = wf.getLastModifiedTime().compareTo(wf.getEndTime()) >= 0 ? true : false;
            assertEquals(true, dateTest);
        }
        finally {
            LocalOozie.stop();
        }
View Full Code Here

     */
    @Override
    public void streamLog(String jobId, Writer writer) throws IOException, DagEngineException {
        XLogStreamer.Filter filter = new XLogStreamer.Filter();
        filter.setParameter(DagXLogInfoService.JOB, jobId);
        WorkflowJob job = getJob(jobId);
        Date lastTime = job.getEndTime();
        if (lastTime == null) {
            lastTime = job.getLastModifiedTime();
        }
        Services.get().get(XLogService.class).streamLog(filter, job.getCreatedTime(), lastTime, writer);
    }
View Full Code Here


        final String jobId = wc.submit(conf);
        assertNotNull(jobId);

        WorkflowJob wf = wc.getJobInfo(jobId);
        assertNotNull(wf);
        assertEquals(WorkflowJob.Status.PREP, wf.getStatus());

        wc.start(jobId);

        waitFor(1000, new Predicate() {
            public boolean evaluate() throws Exception {
                WorkflowJob wf = wc.getJobInfo(jobId);
                return wf.getStatus() == WorkflowJob.Status.SUCCEEDED;
            }
        });

        wf = wc.getJobInfo(jobId);
        assertNotNull(wf);
        assertEquals(WorkflowJob.Status.SUCCEEDED, wf.getStatus());

    }
View Full Code Here


        final String jobId = wc.submit(conf);
        assertNotNull(jobId);

        WorkflowJob wf = wc.getJobInfo(jobId);
        assertNotNull(wf);
        assertEquals(WorkflowJob.Status.PREP, wf.getStatus());

        wc.start(jobId);

        waitFor(15 * 1000, new Predicate() {
            public boolean evaluate() throws Exception {
                WorkflowJob wf = wc.getJobInfo(jobId);
                return wf.getStatus() == WorkflowJob.Status.SUCCEEDED;
            }
        });

        wf = wc.getJobInfo(jobId);
        assertNotNull(wf);
        assertEquals(WorkflowJob.Status.SUCCEEDED, wf.getStatus());

    }
View Full Code Here

        conf.set("d", "${c}${c}");
        conf.set("f", "${e}${e}");

        final String jobId1 = engine.submitJob(conf, true);

        WorkflowJob wf = engine.getJob(jobId1);
        XConfiguration wfConf = new XConfiguration(new StringReader(wf.getConf()));
        assertEquals("AA", wfConf.get("a"));
        assertEquals("B", wfConf.get("b"));
        assertEquals("C", conf.get("c"));
        assertEquals("CC", conf.get("d"));
        assertEquals("CCCC", conf.get("e"));
        assertEquals("CCCCCCCC", conf.get("f"));

        waitFor(10000, new Predicate() {
            public boolean evaluate() throws Exception {
                WorkflowJobBean bean = Services.get().get(WorkflowStoreService.class).create().getWorkflow(jobId1, false);
                return bean.getWorkflowInstance().getStatus().isEndState();
            }
        });
        assertEquals(WorkflowJob.Status.KILLED, engine.getJob(jobId1).getStatus());
        waitFor(10000, new Predicate() {
            public boolean evaluate() throws Exception {
                return CallbackServlet.JOB_ID != null;
            }
        });
        assertEquals(wf.getId(), CallbackServlet.JOB_ID);
        assertEquals("kill", CallbackServlet.NODE_NAME);
        assertEquals("T:null", CallbackServlet.STATUS);
    }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public void testParseWorkflowJob() {
        JSONObject json = createJsonWorkflowJob();
        WorkflowJob wf = JsonToBean.createWorkflowJob(json);

        assertEquals("a", wf.getAppPath());
        assertEquals("b", wf.getAppName());
        assertEquals("c", wf.getId());
        assertEquals("d", wf.getConf());
        assertEquals(WorkflowJob.Status.PREP, wf.getStatus());
        assertEquals(JsonUtils.parseDateRfc822(CREATED_TIME), wf.getCreatedTime());
        assertEquals(JsonUtils.parseDateRfc822(START_TIME), wf.getStartTime());
        assertEquals(JsonUtils.parseDateRfc822(END_TIME), wf.getEndTime());
        assertEquals("e", wf.getUser());
        assertEquals("f", wf.getGroup());
        assertEquals(1, wf.getRun());
        assertEquals("g", wf.getConsoleUrl());
        assertEquals(2, wf.getActions().size());
        assertEquals("a1", wf.getActions().get(0).getId());
        assertEquals("a2", wf.getActions().get(1).getId());
    }
View Full Code Here

                subWorkflowId = oozieClient.run(subWorkflowConf.toProperties());
            }
            else {
                subWorkflowId = runningJobId;
            }
            WorkflowJob workflow = oozieClient.getJobInfo(subWorkflowId);
            String consoleUrl = workflow.getConsoleUrl();
            context.setStartData(subWorkflowId, oozieUri, consoleUrl);
            if (runningJobId != null) {
                check(context, action);
            }
        }
View Full Code Here

    public void check(Context context, WorkflowAction action) throws ActionExecutorException {
        try {
            String subWorkflowId = action.getExternalId();
            String oozieUri = action.getTrackerUri();
            OozieClient oozieClient = getWorkflowClient(context, oozieUri);
            WorkflowJob subWorkflow = oozieClient.getJobInfo(subWorkflowId);
            WorkflowJob.Status status = subWorkflow.getStatus();
            switch (status) {
                case FAILED:
                case KILLED:
                case SUCCEEDED:
                    context.setExecutionData(status.toString(), null);
View Full Code Here

TOP

Related Classes of org.apache.oozie.client.WorkflowJob

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.