Search in sources :

Example 1 with CoordPushDependencyCheckXCommand

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

the class TestCoordInputLogicPush method testHcatHdfs.

public void testHcatHdfs() throws Exception {
    Configuration conf = getConfForCombine();
    conf.set("initial_instance_a", "2014-10-07T00:00Z");
    conf.set("initial_instance_b", "2014-10-07T00:00Z");
    String inputLogic = // @formatter:off
    "<and name=\"test\">" + "<data-in name=\"testA\" dataset=\"A\" />" + "<data-in name=\"testB\" dataset=\"B\" />" + "</and>";
    // @formatter:on
    String jobId = submitCoord("coord-inputlogic-combine.xml", conf, inputLogic, TEST_TYPE.CURRENT_SINGLE);
    String input1 = createTestCaseSubDir("input-data/b/2014/10/08/_SUCCESS".split("/"));
    String input2 = addPartition("db_a", "table1", "dt=20141008;country=usa");
    new CoordMaterializeTransitionXCommand(jobId, 3600).call();
    new CoordPushDependencyCheckXCommand(jobId + "@1").call();
    new CoordActionInputCheckXCommand(jobId + "@1", jobId).call();
    startCoordAction(jobId);
    CoordinatorActionBean actionBean = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, jobId + "@1");
    assertFalse(CoordinatorAction.Status.WAITING.equals(actionBean.getStatus()));
    XConfiguration runConf = new XConfiguration(new StringReader(actionBean.getRunConf()));
    String dataSets = runConf.get("inputLogicData");
    assertEquals(dataSets.split(",").length, 2);
    checkDataSets(dataSets, input1, input2);
}
Also used : XConfiguration(org.apache.oozie.util.XConfiguration) CoordPushDependencyCheckXCommand(org.apache.oozie.command.coord.CoordPushDependencyCheckXCommand) 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 2 with CoordPushDependencyCheckXCommand

use of org.apache.oozie.command.coord.CoordPushDependencyCheckXCommand 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)

Aggregations

CoordinatorActionBean (org.apache.oozie.CoordinatorActionBean)2 CoordActionInputCheckXCommand (org.apache.oozie.command.coord.CoordActionInputCheckXCommand)2 CoordMaterializeTransitionXCommand (org.apache.oozie.command.coord.CoordMaterializeTransitionXCommand)2 CoordPushDependencyCheckXCommand (org.apache.oozie.command.coord.CoordPushDependencyCheckXCommand)2 IOException (java.io.IOException)1 StringReader (java.io.StringReader)1 Configuration (org.apache.hadoop.conf.Configuration)1 CoordinatorAction (org.apache.oozie.client.CoordinatorAction)1 CoordinatorJob (org.apache.oozie.client.CoordinatorJob)1 CommandException (org.apache.oozie.command.CommandException)1 CoordActionStartXCommand (org.apache.oozie.command.coord.CoordActionStartXCommand)1 JPAExecutorException (org.apache.oozie.executor.jpa.JPAExecutorException)1 XConfiguration (org.apache.oozie.util.XConfiguration)1 JDOMException (org.jdom.JDOMException)1