org.apache.oozie.client.WorkflowAction.getExternalStatus()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(14.7k)|赞(0)|评价(0)|浏览(136)

本文整理了Java中org.apache.oozie.client.WorkflowAction.getExternalStatus()方法的一些代码示例,展示了WorkflowAction.getExternalStatus()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorkflowAction.getExternalStatus()方法的具体详情如下:
包路径:org.apache.oozie.client.WorkflowAction
类名称:WorkflowAction
方法名:getExternalStatus

WorkflowAction.getExternalStatus介绍

[英]Return the external status of the action.
[中]返回操作的外部状态。

代码示例

代码示例来源:origin: apache/oozie

public void end(Context context, WorkflowAction action) throws ActionExecutorException {
  context.setEndData(WorkflowAction.Status.OK, action.getExternalStatus());
  LOG.info("Action ended with external status [{0}]", action.getExternalStatus());
}

代码示例来源:origin: org.apache.oozie/oozie-core

public void end(Context context, WorkflowAction action) throws ActionExecutorException {
  context.setEndData(WorkflowAction.Status.OK, action.getExternalStatus());
  LOG.info("Action ended with external status [{0}]", action.getExternalStatus());
}

代码示例来源:origin: apache/oozie

@Override
public void end(Context context, WorkflowAction action) throws ActionExecutorException {
  String externalStatus = action.getExternalStatus();
  WorkflowAction.Status status = externalStatus.equals("OK") ? WorkflowAction.Status.OK :
                  WorkflowAction.Status.ERROR;
  context.setEndData(status, getActionSignal(status));
  LOG.info("Action ended with external status [{0}]", action.getExternalStatus());
}

代码示例来源:origin: org.apache.oozie/oozie-core

@Override
public void end(Context context, WorkflowAction action) throws ActionExecutorException {
  String externalStatus = action.getExternalStatus();
  WorkflowAction.Status status = externalStatus.equals("OK") ? WorkflowAction.Status.OK :
                  WorkflowAction.Status.ERROR;
  context.setEndData(status, getActionSignal(status));
  LOG.info("Action ended with external status [{0}]", action.getExternalStatus());
}

代码示例来源:origin: apache/oozie

public void end(Context context, WorkflowAction action) throws ActionExecutorException {
  try {
    String externalStatus = action.getExternalStatus();
    WorkflowAction.Status status = externalStatus.equals("SUCCEEDED") ? WorkflowAction.Status.OK
                    : WorkflowAction.Status.ERROR;
    context.setEndData(status, getActionSignal(status));
    LOG.info("Action ended with external status [{0}]", action.getExternalStatus());
  }
  catch (Exception ex) {
    throw convertException(ex);
  }
}

代码示例来源:origin: org.apache.oozie/oozie-core

public void end(Context context, WorkflowAction action) throws ActionExecutorException {
  try {
    String externalStatus = action.getExternalStatus();
    WorkflowAction.Status status = externalStatus.equals("SUCCEEDED") ? WorkflowAction.Status.OK
                    : WorkflowAction.Status.ERROR;
    context.setEndData(status, getActionSignal(status));
    LOG.info("Action ended with external status [{0}]", action.getExternalStatus());
  }
  catch (Exception ex) {
    throw convertException(ex);
  }
}

代码示例来源:origin: apache/oozie

@Override
public void end(Context context, WorkflowAction action) throws ActionExecutorException {
  String externalStatus = action.getExternalStatus();
  WorkflowAction.Status status = externalStatus.equals("OK") ? WorkflowAction.Status.OK :
                  WorkflowAction.Status.ERROR;
  context.setEndData(status, getActionSignal(status));
  if (!context.getProtoActionConf().getBoolean(WorkflowXCommand.KEEP_WF_ACTION_DIR, false)) {
    try {
      FileSystem fs = context.getAppFileSystem();
      fs.delete(context.getActionDir(), true);
    }
    catch (Exception ex) {
      throw convertException(ex);
    }
  }
  LOG.info("Action ended with external status [{0}]", action.getExternalStatus());
}

代码示例来源:origin: apache/oozie

public void end(Context context, WorkflowAction action) throws ActionExecutorException {
  context.setEndData(WorkflowAction.Status.OK, getActionSignal(WorkflowAction.Status.OK));
  LOG.info("Action ended with external status [{0}]", action.getExternalStatus());
}

代码示例来源:origin: org.apache.oozie/oozie-core

@Override
public void end(Context context, WorkflowAction action) throws ActionExecutorException {
  String externalStatus = action.getExternalStatus();
  WorkflowAction.Status status = externalStatus.equals("OK") ? WorkflowAction.Status.OK :
                  WorkflowAction.Status.ERROR;
  context.setEndData(status, getActionSignal(status));
  if (!context.getProtoActionConf().getBoolean(WorkflowXCommand.KEEP_WF_ACTION_DIR, false)) {
    try {
      FileSystem fs = context.getAppFileSystem();
      fs.delete(context.getActionDir(), true);
    }
    catch (Exception ex) {
      throw convertException(ex);
    }
  }
  LOG.info("Action ended with external status [{0}]", action.getExternalStatus());
}

代码示例来源:origin: org.apache.oozie/oozie-core

public void end(Context context, WorkflowAction action) throws ActionExecutorException {
  context.setEndData(WorkflowAction.Status.OK, getActionSignal(WorkflowAction.Status.OK));
  LOG.info("Action ended with external status [{0}]", action.getExternalStatus());
}

代码示例来源:origin: YahooArchive/oozie

private void printWorkflowAction(WorkflowAction action, boolean contains) {
  System.out.println("ID : " + maskIfNull(action.getId()));
  System.out.println(RULER);
  System.out.println("Console URL     : " + maskIfNull(action.getConsoleUrl()));
  System.out.println("Error Code      : " + maskIfNull(action.getErrorCode()));
  System.out.println("Error Message   : " + maskIfNull(action.getErrorMessage()));
  System.out.println("External ID     : " + maskIfNull(action.getExternalId()));
  System.out.println("External Status : " + maskIfNull(action.getExternalStatus()));
  System.out.println("Name            : " + maskIfNull(action.getName()));
  System.out.println("Retries         : " + action.getRetries());
  System.out.println("Tracker URI     : " + maskIfNull(action.getTrackerUri()));
  System.out.println("Type            : " + maskIfNull(action.getType()));
  System.out.println("Started         : " + maskDate(action.getStartTime(), contains));
  System.out.println("Status          : " + action.getStatus());
  System.out.println("Ended           : " + maskDate(action.getEndTime(), contains));
  System.out.println(RULER);
}

代码示例来源:origin: com.yahoo.oozie/oozie-client

private void printWorkflowAction(WorkflowAction action, boolean contains) {
  System.out.println("ID : " + maskIfNull(action.getId()));
  System.out.println(RULER);
  System.out.println("Console URL     : " + maskIfNull(action.getConsoleUrl()));
  System.out.println("Error Code      : " + maskIfNull(action.getErrorCode()));
  System.out.println("Error Message   : " + maskIfNull(action.getErrorMessage()));
  System.out.println("External ID     : " + maskIfNull(action.getExternalId()));
  System.out.println("External Status : " + maskIfNull(action.getExternalStatus()));
  System.out.println("Name            : " + maskIfNull(action.getName()));
  System.out.println("Retries         : " + action.getRetries());
  System.out.println("Tracker URI     : " + maskIfNull(action.getTrackerUri()));
  System.out.println("Type            : " + maskIfNull(action.getType()));
  System.out.println("Started         : " + maskDate(action.getStartTime(), contains));
  System.out.println("Status          : " + action.getStatus());
  System.out.println("Ended           : " + maskDate(action.getEndTime(), contains));
  System.out.println(RULER);
}

代码示例来源:origin: apache/oozie

public void testProperties() {
  WorkflowAction action = createNode();
  Assert.assertEquals("a", action.getId());
  Assert.assertEquals("b", action.getName());
  Assert.assertEquals("c", action.getType());
  Assert.assertEquals("d", action.getConf());
  Assert.assertEquals(WorkflowAction.Status.RUNNING, action.getStatus());
  Assert.assertEquals(1, action.getRetries());
  Assert.assertEquals(JsonUtils.parseDateRfc822(START_TIME), action.getStartTime());
  Assert.assertEquals(JsonUtils.parseDateRfc822(END_TIME), action.getEndTime());
  Assert.assertEquals("e", action.getTransition());
  Assert.assertEquals("ee", action.getData());
  Assert.assertEquals("stats", action.getStats());
  Assert.assertEquals("extChIDs", action.getExternalChildIDs());
  Assert.assertEquals("f", action.getExternalId());
  Assert.assertEquals("g", action.getExternalStatus());
  Assert.assertEquals("h", action.getTrackerUri());
  Assert.assertEquals("i", action.getConsoleUrl());
  Assert.assertEquals("j", action.getErrorCode());
  Assert.assertEquals("k", action.getErrorMessage());
}

代码示例来源:origin: apache/oozie

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

代码示例来源:origin: apache/oozie

public void testOutputSubmitOK() throws Exception {
  String actionXml = "<java>" +
      "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" +
      "<name-node>" + getNameNodeUri() + "</name-node>" +
      "<main-class>" + LauncherMainTester.class.getName() + "</main-class>" +
      "<arg>out</arg>" +
      "<capture-output/>" +
      "</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());
  assertNotNull(context.getAction().getData());
  StringReader sr = new StringReader(context.getAction().getData());
  Properties props = new Properties();
  props.load(sr);
  assertEquals("A", props.get("a"));
  ae.end(context, context.getAction());
  assertEquals(WorkflowAction.Status.OK, context.getAction().getStatus());
}

代码示例来源:origin: apache/oozie

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

代码示例来源:origin: apache/oozie

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

代码示例来源:origin: apache/oozie

public void testSimpestSleSubmitOK() throws Exception {
  String actionXml = "<java>" +
      "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" +
      "<name-node>" + getNameNodeUri() + "</name-node>" +
      "<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());
}

代码示例来源:origin: apache/oozie

public void testSimplestSubmitWithResourceManagerOK() throws Exception {
  final String actionXml = "<java>" +
      "<resource-manager>" + getJobTrackerUri() + "</resource-manager>" +
      "<name-node>" + getNameNodeUri() + "</name-node>" +
      "<main-class>" + LauncherMainTester.class.getName() + "</main-class>" +
      "</java>";
  final Context context = createContext(actionXml, null);
  submitAction(context);
  waitUntilYarnAppDoneAndAssertSuccess(context.getAction().getExternalId());
  final 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());
}

代码示例来源:origin: apache/oozie

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

相关文章