Search in sources :

Example 6 with ActionExecutor

use of org.apache.oozie.action.ActionExecutor in project oozie by apache.

the class TestJavaActionExecutor method testExit0SubmitOK.

public void testExit0SubmitOK() throws Exception {
    String actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>" + getNameNodeUri() + "</name-node>" + "<main-class>" + LauncherMainTester.class.getName() + "</main-class>" + "<arg>exit0</arg>" + "</java>";
    Context context = createContext(actionXml, null);
    final String runningJob = submitAction(context);
    waitUntilYarnAppDoneAndAssertSuccess(runningJob);
    ActionExecutor ae = new JavaActionExecutor();
    ae.check(context, context.getAction());
    assertTrue(ae.isCompleted(context.getAction().getExternalStatus()));
    assertEquals("SUCCEEDED", context.getAction().getExternalStatus());
    assertNull(context.getAction().getData());
    ae.end(context, context.getAction());
    assertEquals(WorkflowAction.Status.OK, context.getAction().getStatus());
}
Also used : ActionExecutor(org.apache.oozie.action.ActionExecutor)

Example 7 with ActionExecutor

use of org.apache.oozie.action.ActionExecutor in project oozie by apache.

the class TestJavaActionExecutor method testKill.

public void testKill() throws Exception {
    String actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>" + getNameNodeUri() + "</name-node>" + "<main-class>" + LauncherMainTester.class.getName() + "</main-class>" + "</java>";
    final Context context = createContext(actionXml, null);
    final String runningJob = submitAction(context);
    ActionExecutor ae = new JavaActionExecutor();
    ae.kill(context, context.getAction());
    assertEquals(WorkflowAction.Status.DONE, context.getAction().getStatus());
    assertEquals("KILLED", context.getAction().getExternalStatus());
    assertTrue(ae.isCompleted(context.getAction().getExternalStatus()));
    waitUntilYarnAppKilledAndAssertSuccess(runningJob);
}
Also used : ActionExecutor(org.apache.oozie.action.ActionExecutor)

Example 8 with ActionExecutor

use of org.apache.oozie.action.ActionExecutor in project oozie by apache.

the class TestJavaActionExecutor method testSubmitOKWithLauncherEnvVars.

public void testSubmitOKWithLauncherEnvVars() throws Exception {
    String actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>" + getNameNodeUri() + "</name-node>" + "<configuration>" + "  <property><name>oozie.launcher.env</name><value>A=foo1" + File.pathSeparator + "B=foo2</value></property>" + "</configuration>" + "<main-class>" + LauncherMainTester.class.getName() + "</main-class>" + "</java>";
    Context context = createContext(actionXml, null);
    submitAction(context);
    waitUntilYarnAppDoneAndAssertSuccess(context.getAction().getExternalId());
    ActionExecutor ae = new JavaActionExecutor();
    ae.check(context, context.getAction());
    assertEquals("SUCCEEDED", context.getAction().getExternalStatus());
    assertNull(context.getAction().getData());
    ae.end(context, context.getAction());
    assertEquals(WorkflowAction.Status.OK, context.getAction().getStatus());
}
Also used : ActionExecutor(org.apache.oozie.action.ActionExecutor)

Example 9 with ActionExecutor

use of org.apache.oozie.action.ActionExecutor in project oozie by apache.

the class TestJavaActionExecutor method testIdSwapSubmitOK.

public void testIdSwapSubmitOK() throws Exception {
    String actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>" + getNameNodeUri() + "</name-node>" + "<main-class>" + LauncherMainTester.class.getName() + "</main-class>" + "<arg>id</arg>" + "<capture-output/>" + "</java>";
    Context context = createContext(actionXml, null);
    final String runningJob = submitAction(context);
    waitUntilYarnAppDoneAndAssertSuccess(runningJob);
    ActionExecutor ae = new JavaActionExecutor();
    try {
        ae.check(context, context.getAction());
    } catch (ActionExecutorException ex) {
        if (!ex.getMessage().contains("IDSWAP")) {
            fail();
        }
    }
}
Also used : ActionExecutor(org.apache.oozie.action.ActionExecutor) ActionExecutorException(org.apache.oozie.action.ActionExecutorException)

Example 10 with ActionExecutor

use of org.apache.oozie.action.ActionExecutor in project oozie by apache.

the class TestJavaActionExecutor method testExceptionSubmitThrowable.

public void testExceptionSubmitThrowable() throws Exception {
    String actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>" + getNameNodeUri() + "</name-node>" + "<main-class>" + LauncherMainTester.class.getName() + "</main-class>" + "<arg>throwable</arg>" + "</java>";
    Context context = createContext(actionXml, null);
    final String runningJob = submitAction(context);
    waitUntilYarnAppDoneAndAssertSuccess(runningJob);
    // FIXME  assertFalse(LauncherHelper.isMainSuccessful(runningJob));
    ActionExecutor ae = new JavaActionExecutor();
    ae.check(context, context.getAction());
    assertTrue(ae.isCompleted(context.getAction().getExternalStatus()));
    assertEquals("FAILED/KILLED", context.getAction().getExternalStatus());
    assertNull(context.getAction().getData());
    ae.end(context, context.getAction());
    assertEquals(WorkflowAction.Status.ERROR, context.getAction().getStatus());
}
Also used : ActionExecutor(org.apache.oozie.action.ActionExecutor)

Aggregations

ActionExecutor (org.apache.oozie.action.ActionExecutor)28 ActionService (org.apache.oozie.service.ActionService)5 IOException (java.io.IOException)4 ActionExecutorException (org.apache.oozie.action.ActionExecutorException)4 Path (org.apache.hadoop.fs.Path)3 WorkflowActionBean (org.apache.oozie.WorkflowActionBean)3 ForkActionExecutor (org.apache.oozie.action.control.ForkActionExecutor)3 StartActionExecutor (org.apache.oozie.action.control.StartActionExecutor)3 CommandException (org.apache.oozie.command.CommandException)3 StringReader (java.io.StringReader)2 Date (java.util.Date)2 SLAEventBean (org.apache.oozie.SLAEventBean)2 ControlNodeActionExecutor (org.apache.oozie.action.control.ControlNodeActionExecutor)2 EndActionExecutor (org.apache.oozie.action.control.EndActionExecutor)2 JoinActionExecutor (org.apache.oozie.action.control.JoinActionExecutor)2 KillActionExecutor (org.apache.oozie.action.control.KillActionExecutor)2 JavaActionExecutor (org.apache.oozie.action.hadoop.JavaActionExecutor)2 SubWorkflowActionExecutor (org.apache.oozie.action.oozie.SubWorkflowActionExecutor)2 JPAExecutorException (org.apache.oozie.executor.jpa.JPAExecutorException)2 WorkflowActionQuery (org.apache.oozie.executor.jpa.WorkflowActionQueryExecutor.WorkflowActionQuery)2