Package org.apache.oozie.client

Examples of org.apache.oozie.client.OozieClient$JobDefinition


    public void testRedeploy() throws IOException, OozieClientException, InterruptedException {
        Reader reader = IOUtils.getResourceAsReader("rerun-elerr-wf.xml", -1);
        Writer writer = new FileWriter(getTestCaseDir() + "/workflow.xml");
        IOUtils.copyCharStream(reader, writer);

        final OozieClient wfClient = LocalOozie.getClient();
        Properties conf = wfClient.createConfiguration();
        conf.setProperty(OozieClient.APP_PATH, getTestCaseDir() + File.separator + "workflow.xml");
        conf.setProperty(OozieClient.USER_NAME, getTestUser());
        injectKerberosInfo(conf);

        conf.setProperty("inPath", getFsTestCaseDir().toString());
        conf.setProperty("checkDir", getFsTestCaseDir().toString() + "/check");

        final String jobId1 = wfClient.submit(conf);
        wfClient.start(jobId1);
        waitFor(15 * 1000, new Predicate() {
            public boolean evaluate() throws Exception {
                return wfClient.getJobInfo(jobId1).getStatus() == WorkflowJob.Status.FAILED;
            }
        });
        assertEquals(WorkflowJob.Status.FAILED, wfClient.getJobInfo(jobId1).getStatus());

        reader = IOUtils.getResourceAsReader("rerun-el-wf.xml", -1);
        writer = new FileWriter(getTestCaseDir() + "/workflow.xml");
        IOUtils.copyCharStream(reader, writer);

        Thread.sleep(5000);

        conf.setProperty(OozieClient.RERUN_SKIP_NODES, "hdfs11");
        wfClient.reRun(jobId1, conf);
        waitFor(15 * 1000, new Predicate() {
            public boolean evaluate() throws Exception {
                return wfClient.getJobInfo(jobId1).getStatus() == WorkflowJob.Status.SUCCEEDED;
            }
        });
        assertEquals(WorkflowJob.Status.SUCCEEDED, wfClient.getJobInfo(jobId1).getStatus());
    }
View Full Code Here


            fail();
        }
        try {
            LocalOozie.stop();
            LocalOozie.start();
            OozieClient wc = LocalOozie.getClient();
            assertNotNull(wc);
            assertEquals("localoozie", wc.getOozieUrl());
        }
        finally {
            LocalOozie.stop();
        }
    }
View Full Code Here

        writer.write(wfApp);
        writer.close();

        try {
            LocalOozie.start();
            final OozieClient wc = LocalOozie.getClient();
            Properties conf = wc.createConfiguration();
            conf.setProperty(OozieClient.APP_PATH, appPath.toString() + File.separator + "workflow.xml");
            conf.setProperty(OozieClient.USER_NAME, getTestUser());
            conf.setProperty(OozieClient.GROUP_NAME, getTestGroup());
            injectKerberosInfo(conf);

            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();

            Thread.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);
View Full Code Here

        Path path = getFsTestCaseDir();

        getFileSystem().create(new Path(path, "p2"));

        final OozieClient wfClient = LocalOozie.getClient();
        Properties conf = wfClient.createConfiguration();
        conf.setProperty(OozieClient.APP_PATH, getTestCaseDir() + File.separator + "workflow.xml");
        conf.setProperty(OozieClient.USER_NAME, getTestUser());
        injectKerberosInfo(conf);

        conf.setProperty("nnbase", path.toString());
        conf.setProperty("base", path.toUri().getPath());

        final String jobId1 = wfClient.submit(conf);
        wfClient.start(jobId1);
        waitFor(15 * 1000, new Predicate() {
            public boolean evaluate() throws Exception {
                return wfClient.getJobInfo(jobId1).getStatus() == WorkflowJob.Status.KILLED;
            }
        });
        assertEquals(WorkflowJob.Status.KILLED, wfClient.getJobInfo(jobId1).getStatus());

        //Skip a non-executed node
        conf.setProperty(OozieClient.RERUN_SKIP_NODES, "fs1,fs2,dec3");

        boolean failed = false;
        try {
            wfClient.reRun(jobId1, conf);
        }
        catch (OozieClientException e) {
            failed = true;
            assertTrue(e.getCause().getMessage().contains(ErrorCode.E0807.toString()));
        }
        assertEquals(true, failed);

        //Skip executed nodes
        getFileSystem().delete(new Path(path, "p2"), true);
        conf.setProperty(OozieClient.RERUN_SKIP_NODES, "fs1");

        wfClient.reRun(jobId1, conf);
        waitFor(15 * 1000, new Predicate() {
            public boolean evaluate() throws Exception {
                return wfClient.getJobInfo(jobId1).getStatus() == WorkflowJob.Status.SUCCEEDED;
            }
        });
        assertEquals(WorkflowJob.Status.SUCCEEDED, wfClient.getJobInfo(jobId1).getStatus());
    }
View Full Code Here

    public void testRedeploy() throws IOException, OozieClientException, InterruptedException {
        Reader reader = IOUtils.getResourceAsReader("rerun-elerr-wf.xml", -1);
        Writer writer = new FileWriter(getTestCaseDir() + "/workflow.xml");
        IOUtils.copyCharStream(reader, writer);

        final OozieClient wfClient = LocalOozie.getClient();
        Properties conf = wfClient.createConfiguration();
        conf.setProperty(OozieClient.APP_PATH, getTestCaseDir() + File.separator + "workflow.xml");
        conf.setProperty(OozieClient.USER_NAME, getTestUser());
        injectKerberosInfo(conf);

        conf.setProperty("inPath", getFsTestCaseDir().toString());
        conf.setProperty("checkDir", getFsTestCaseDir().toString() + "/check");

        final String jobId1 = wfClient.submit(conf);
        wfClient.start(jobId1);
        waitFor(15 * 1000, new Predicate() {
            public boolean evaluate() throws Exception {
                return wfClient.getJobInfo(jobId1).getStatus() == WorkflowJob.Status.FAILED;
            }
        });
        assertEquals(WorkflowJob.Status.FAILED, wfClient.getJobInfo(jobId1).getStatus());

        reader = IOUtils.getResourceAsReader("rerun-el-wf.xml", -1);
        writer = new FileWriter(getTestCaseDir() + "/workflow.xml");
        IOUtils.copyCharStream(reader, writer);

        Thread.sleep(5000);

        conf.setProperty(OozieClient.RERUN_SKIP_NODES, "hdfs11");
        wfClient.reRun(jobId1, conf);
        waitFor(15 * 1000, new Predicate() {
            public boolean evaluate() throws Exception {
                return wfClient.getJobInfo(jobId1).getStatus() == WorkflowJob.Status.SUCCEEDED;
            }
        });
        assertEquals(WorkflowJob.Status.SUCCEEDED, wfClient.getJobInfo(jobId1).getStatus());
    }
View Full Code Here

        Path path = getFsTestCaseDir();

        getFileSystem().create(new Path(path, "p2"));

        final OozieClient wfClient = LocalOozie.getClient();
        Properties conf = wfClient.createConfiguration();
        conf.setProperty(OozieClient.APP_PATH, getTestCaseDir() + File.separator + "workflow.xml");
        conf.setProperty(OozieClient.USER_NAME, getTestUser());
        injectKerberosInfo(conf);

        conf.setProperty("nnbase", path.toString());
        conf.setProperty("base", path.toUri().getPath());

        final String jobId1 = wfClient.submit(conf);
        wfClient.start(jobId1);
        waitFor(15 * 1000, new Predicate() {
            public boolean evaluate() throws Exception {
                return wfClient.getJobInfo(jobId1).getStatus() == WorkflowJob.Status.KILLED;
            }
        });
        assertEquals(WorkflowJob.Status.KILLED, wfClient.getJobInfo(jobId1).getStatus());

        // Skip a non-executed node
        conf.setProperty(OozieClient.RERUN_SKIP_NODES, "fs1,fs2,dec3");

        boolean failed = false;
        try {
            wfClient.reRun(jobId1, conf);
        }
        catch (OozieClientException e) {
            failed = true;
            assertTrue(e.getCause().getMessage().contains(ErrorCode.E0807.toString()));
        }
        assertEquals(true, failed);

        // Skip executed nodes
        getFileSystem().delete(new Path(path, "p2"), true);
        conf.setProperty(OozieClient.RERUN_SKIP_NODES, "fs1");

        wfClient.reRun(jobId1, conf);
        waitFor(15 * 1000, new Predicate() {
            public boolean evaluate() throws Exception {
                return wfClient.getJobInfo(jobId1).getStatus() == WorkflowJob.Status.SUCCEEDED;
            }
        });
        assertEquals(WorkflowJob.Status.SUCCEEDED, wfClient.getJobInfo(jobId1).getStatus());
    }
View Full Code Here

                "          <value>A</value>" +
                "        </property>" +
                "      </configuration>" +
                "</sub-workflow>");

        OozieClient oozieClient = subWorkflow.getWorkflowClient(new Context(workflow, action),
                                                                SubWorkflowActionExecutor.LOCAL);
        assertNotNull(oozieClient);

        oozieClient = subWorkflow.getWorkflowClient(new Context(workflow, action), "http://localhost:8080/oozie");
View Full Code Here

                "</sub-workflow>");

        SubWorkflowActionExecutor subWorkflow = new SubWorkflowActionExecutor();
        subWorkflow.start(new Context(workflow, action), action);

        final OozieClient oozieClient = subWorkflow.getWorkflowClient(new Context(workflow, action),
                                                                      SubWorkflowActionExecutor.LOCAL);
        waitFor(JOB_TIMEOUT, new Predicate() {
            public boolean evaluate() throws Exception {
                return oozieClient.getJobInfo(action.getExternalId()).getStatus() == WorkflowJob.Status.SUCCEEDED;
            }
        });

        assertEquals(WorkflowJob.Status.SUCCEEDED, oozieClient.getJobInfo(action.getExternalId()).getStatus());

        subWorkflow.check(new Context(workflow, action), action);

        assertEquals(WorkflowAction.Status.DONE, action.getStatus());
View Full Code Here

        Path path = getFsTestCaseDir();

        getFileSystem().create(new Path(path, "p2"));

        final OozieClient wfClient = LocalOozie.getClient();
        Properties conf = wfClient.createConfiguration();
        conf.setProperty(OozieClient.APP_PATH, getTestCaseDir() + File.separator + "workflow.xml");
        conf.setProperty(OozieClient.USER_NAME, getTestUser());
        injectKerberosInfo(conf);

        conf.setProperty("nnbase", path.toString());
        conf.setProperty("base", path.toUri().getPath());

        final String jobId1 = wfClient.submit(conf);
        wfClient.start(jobId1);
        waitFor(15 * 1000, new Predicate() {
            public boolean evaluate() throws Exception {
                return wfClient.getJobInfo(jobId1).getStatus() == WorkflowJob.Status.KILLED;
            }
        });
        assertEquals(WorkflowJob.Status.KILLED, wfClient.getJobInfo(jobId1).getStatus());

        // Skip succeeded nodes
        getFileSystem().delete(new Path(path, "p2"), true);
        conf.setProperty(OozieClient.RERUN_FAIL_NODES, "true");

        wfClient.reRun(jobId1, conf);
        waitFor(15 * 1000, new Predicate() {
            public boolean evaluate() throws Exception {
                return wfClient.getJobInfo(jobId1).getStatus() == WorkflowJob.Status.SUCCEEDED;
            }
        });
        assertEquals(WorkflowJob.Status.SUCCEEDED, wfClient.getJobInfo(jobId1).getStatus());
    }
View Full Code Here

                "</sub-workflow>");

        SubWorkflowActionExecutor subWorkflow = new SubWorkflowActionExecutor();
        subWorkflow.start(new Context(workflow, action), action);

        final OozieClient oozieClient = subWorkflow.getWorkflowClient(new Context(workflow, action),
                                                                      SubWorkflowActionExecutor.LOCAL);
        waitFor(JOB_TIMEOUT, new Predicate() {
            public boolean evaluate() throws Exception {
                return oozieClient.getJobInfo(action.getExternalId()).getStatus() == WorkflowJob.Status.SUCCEEDED;
            }
        });
        String extId = action.getExternalId();
        assertEquals(WorkflowJob.Status.SUCCEEDED, oozieClient.getJobInfo(extId).getStatus());
        WorkflowActionBean action1 = new WorkflowActionBean();
        action1.setId(action.getId());
        action1.setName(action.getName());
        action1.setConf("<sub-workflow xmlns='uri:oozie:workflow:0.1'>" +
                "      <app-path>wrongAppPath</app-path>" +
View Full Code Here

TOP

Related Classes of org.apache.oozie.client.OozieClient$JobDefinition

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.