Search in sources :

Example 11 with CoordMaterializeTransitionXCommand

use of org.apache.oozie.command.coord.CoordMaterializeTransitionXCommand in project oozie by apache.

the class TestCoordInputLogicPush method startCoordAction.

private void startCoordAction(final String jobId) throws CommandException, JPAExecutorException {
    new CoordMaterializeTransitionXCommand(jobId, 3600).call();
    new CoordActionInputCheckXCommand(jobId + "@1", jobId).call();
    new CoordPushDependencyCheckXCommand(jobId + "@1").call();
    new CoordActionInputCheckXCommand(jobId + "@1", jobId).call();
    waitFor(50 * 1000, new Predicate() {

        public boolean evaluate() throws Exception {
            CoordinatorActionBean actionBean = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, jobId + "@1");
            return !actionBean.getStatus().equals(CoordinatorAction.Status.WAITING);
        }
    });
    CoordinatorAction actionBean = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, jobId + "@1");
    assertFalse("Action status should not be waiting", actionBean.getStatus().equals(CoordinatorAction.Status.WAITING));
    waitFor(50 * 1000, new Predicate() {

        public boolean evaluate() throws Exception {
            CoordinatorActionBean actionBean = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, jobId + "@1");
            return !actionBean.getStatus().equals(CoordinatorAction.Status.READY);
        }
    });
    CoordinatorJob coordJob = CoordJobQueryExecutor.getInstance().get(CoordJobQuery.GET_COORD_JOB, jobId);
    new CoordActionStartXCommand(actionBean.getId(), coordJob.getUser(), coordJob.getAppName(), actionBean.getJobId()).call();
}
Also used : CoordinatorJob(org.apache.oozie.client.CoordinatorJob) CoordPushDependencyCheckXCommand(org.apache.oozie.command.coord.CoordPushDependencyCheckXCommand) CoordinatorActionBean(org.apache.oozie.CoordinatorActionBean) CoordinatorAction(org.apache.oozie.client.CoordinatorAction) CoordActionStartXCommand(org.apache.oozie.command.coord.CoordActionStartXCommand) CoordMaterializeTransitionXCommand(org.apache.oozie.command.coord.CoordMaterializeTransitionXCommand) CoordActionInputCheckXCommand(org.apache.oozie.command.coord.CoordActionInputCheckXCommand) JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) JDOMException(org.jdom.JDOMException) IOException(java.io.IOException) CommandException(org.apache.oozie.command.CommandException)

Example 12 with CoordMaterializeTransitionXCommand

use of org.apache.oozie.command.coord.CoordMaterializeTransitionXCommand in project oozie by apache.

the class TestCoordinatorInputLogic method testSimpleOr1.

public void testSimpleOr1() throws Exception {
    Configuration conf = getConf();
    // @formatter:off
    String inputLogic = "<or name=\"test\">" + "<and>" + "<data-in dataset=\"C\" />" + "<data-in dataset=\"D\" />" + "</and>" + "<or>" + "<data-in dataset=\"A\" />" + "<data-in dataset=\"B\" />" + "</or>" + "</or>";
    String jobId = _testCoordSubmit("coord-inputlogic.xml", conf, inputLogic);
    new CoordMaterializeTransitionXCommand(jobId, 3600).call();
    CoordinatorActionBean actionBean = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, jobId + "@1");
    assertEquals(actionBean.getStatus(), CoordinatorAction.Status.WAITING);
    new CoordActionInputCheckXCommand(jobId + "@1", jobId).call();
    String input1 = createTestCaseSubDir("input-data/b/2014/10/08/00/_SUCCESS".split("/"));
    startCoordAction(jobId);
    actionBean = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, jobId + "@1");
    XConfiguration runConf = new XConfiguration(new StringReader(actionBean.getRunConf()));
    String dataSets = runConf.get("inputLogicData");
    assertEquals(dataSets.split(",").length, 1);
    checkDataSets(dataSets, input1);
}
Also used : XConfiguration(org.apache.oozie.util.XConfiguration) XConfiguration(org.apache.oozie.util.XConfiguration) Configuration(org.apache.hadoop.conf.Configuration) CoordinatorActionBean(org.apache.oozie.CoordinatorActionBean) StringReader(java.io.StringReader) CoordMaterializeTransitionXCommand(org.apache.oozie.command.coord.CoordMaterializeTransitionXCommand) CoordActionInputCheckXCommand(org.apache.oozie.command.coord.CoordActionInputCheckXCommand)

Example 13 with CoordMaterializeTransitionXCommand

use of org.apache.oozie.command.coord.CoordMaterializeTransitionXCommand in project oozie by apache.

the class TestCoordinatorInputLogic method startCoordAction.

private void startCoordAction(final String jobId, final CoordinatorAction.Status coordActionStatus) throws CommandException, JPAExecutorException {
    new CoordMaterializeTransitionXCommand(jobId, 3600).call();
    new CoordActionInputCheckXCommand(jobId + "@1", jobId).call();
    waitFor(50 * 1000, new Predicate() {

        public boolean evaluate() throws Exception {
            CoordinatorActionBean actionBean = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, jobId + "@1");
            return !actionBean.getStatus().equals(CoordinatorAction.Status.WAITING);
        }
    });
    CoordinatorAction actionBean = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, jobId + "@1");
    assertFalse(actionBean.getStatus().equals(coordActionStatus));
    CoordinatorJob coordJob = CoordJobQueryExecutor.getInstance().get(CoordJobQuery.GET_COORD_JOB, jobId);
    new CoordActionStartXCommand(actionBean.getId(), coordJob.getUser(), coordJob.getAppName(), actionBean.getJobId()).call();
}
Also used : CoordinatorJob(org.apache.oozie.client.CoordinatorJob) CoordinatorActionBean(org.apache.oozie.CoordinatorActionBean) CoordinatorAction(org.apache.oozie.client.CoordinatorAction) CoordActionStartXCommand(org.apache.oozie.command.coord.CoordActionStartXCommand) CoordMaterializeTransitionXCommand(org.apache.oozie.command.coord.CoordMaterializeTransitionXCommand) CoordActionInputCheckXCommand(org.apache.oozie.command.coord.CoordActionInputCheckXCommand) JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) JDOMException(org.jdom.JDOMException) IOException(java.io.IOException) CommandException(org.apache.oozie.command.CommandException)

Aggregations

CoordMaterializeTransitionXCommand (org.apache.oozie.command.coord.CoordMaterializeTransitionXCommand)13 CoordinatorActionBean (org.apache.oozie.CoordinatorActionBean)11 CoordActionInputCheckXCommand (org.apache.oozie.command.coord.CoordActionInputCheckXCommand)11 Configuration (org.apache.hadoop.conf.Configuration)8 XConfiguration (org.apache.oozie.util.XConfiguration)8 StringReader (java.io.StringReader)6 CommandException (org.apache.oozie.command.CommandException)6 JPAExecutorException (org.apache.oozie.executor.jpa.JPAExecutorException)6 IOException (java.io.IOException)4 Date (java.util.Date)4 CoordinatorAction (org.apache.oozie.client.CoordinatorAction)4 JDOMException (org.jdom.JDOMException)4 CoordinatorJobBean (org.apache.oozie.CoordinatorJobBean)2 CoordinatorJob (org.apache.oozie.client.CoordinatorJob)2 CoordActionStartXCommand (org.apache.oozie.command.coord.CoordActionStartXCommand)2 CoordPushDependencyCheckXCommand (org.apache.oozie.command.coord.CoordPushDependencyCheckXCommand)2 Test (org.junit.Test)2 WorkflowJobBean (org.apache.oozie.WorkflowJobBean)1 Event (org.apache.oozie.client.event.Event)1 JobEvent (org.apache.oozie.client.event.JobEvent)1