Search in sources :

Example 21 with ActionExecutor

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

the class TestJavaActionExecutor method testExit1SubmitError.

public void testExit1SubmitError() throws Exception {
    String actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>" + getNameNodeUri() + "</name-node>" + "<main-class>" + LauncherMainTester.class.getName() + "</main-class>" + "<arg>exit1</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());
    assertEquals("1", context.getAction().getErrorCode());
    assertNull(context.getAction().getData());
    ae.end(context, context.getAction());
    assertEquals(WorkflowAction.Status.ERROR, context.getAction().getStatus());
}
Also used : ActionExecutor(org.apache.oozie.action.ActionExecutor)

Example 22 with ActionExecutor

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

the class TestJavaActionExecutor method testExceptionSubmitException.

public void testExceptionSubmitException() throws Exception {
    String actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>" + getNameNodeUri() + "</name-node>" + "<main-class>" + LauncherMainTester.class.getName() + "</main-class>" + "<arg>exception</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)

Example 23 with ActionExecutor

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

the class TestJavaActionExecutor method testPrepare.

public void testPrepare() throws Exception {
    FileSystem fs = getFileSystem();
    Path mkdir = new Path(getFsTestCaseDir(), "mkdir");
    Path delete = new Path(getFsTestCaseDir(), "delete");
    fs.mkdirs(delete);
    String actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>" + getNameNodeUri() + "</name-node>" + "<prepare>" + "<mkdir path='" + mkdir + "'/>" + "<delete path='" + delete + "'/>" + "</prepare>" + "<configuration>" + "<property>" + "<name>dfs.umaskmode</name>" + "<value>026</value>" + "</property>" + "<property>" + "<name>fs.hdfs.impl.disable.cache</name>" + "<value>true</value>" + "</property>" + "</configuration>" + "<main-class>" + LauncherMainTester.class.getName() + "</main-class>" + "</java>";
    Context context = createContext(actionXml, null);
    final String runningJob = submitAction(context);
    waitUntilYarnAppDoneAndAssertSuccess(runningJob);
    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());
    assertTrue(fs.exists(mkdir));
    // Check if the action configuration is applied in the prepare block
    assertEquals("rwxr-x--x", fs.getFileStatus(mkdir).getPermission().toString());
    assertFalse(fs.exists(delete));
}
Also used : Path(org.apache.hadoop.fs.Path) ActionExecutor(org.apache.oozie.action.ActionExecutor) FileSystem(org.apache.hadoop.fs.FileSystem)

Example 24 with ActionExecutor

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

the class TestJavaActionExecutor method testEnvVarsPropagatedFromLauncherConfig.

public void testEnvVarsPropagatedFromLauncherConfig() throws Exception {
    String actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>" + getNameNodeUri() + "</name-node>" + "<configuration>" + "  <property><name>oozie.launcher.env</name><value>LAUNCHER_ENVIRON=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("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)

Example 25 with ActionExecutor

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

the class TestJavaActionExecutor method testAdditionalJarSubmitOK.

public void testAdditionalJarSubmitOK() throws Exception {
    Path appJarPath = new Path("test-extra.jar");
    File jarFile = IOUtils.createJar(new File(getTestCaseDir()), appJarPath.getName(), LauncherMainTester2.class);
    InputStream is = new FileInputStream(jarFile);
    OutputStream os = getFileSystem().create(new Path(getAppPath(), appJarPath.toString()));
    IOUtils.copyStream(is, os);
    String actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>" + getNameNodeUri() + "</name-node>" + "<main-class>" + LauncherMainTester2.class.getName() + "</main-class>" + "<file>" + appJarPath.toString() + "</file>" + "</java>";
    Context context = createContext(actionXml, null);
    final String runningJobId = submitAction(context);
    ActionExecutor ae = new JavaActionExecutor();
    assertFalse(ae.isCompleted(context.getAction().getExternalStatus()));
    waitUntilYarnAppDoneAndAssertSuccess(runningJobId);
    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 : Path(org.apache.hadoop.fs.Path) ActionExecutor(org.apache.oozie.action.ActionExecutor) ByteArrayInputStream(java.io.ByteArrayInputStream) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) FSDataOutputStream(org.apache.hadoop.fs.FSDataOutputStream) OutputStream(java.io.OutputStream) FileOutputStream(java.io.FileOutputStream) File(java.io.File) FileInputStream(java.io.FileInputStream)

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