gpt4 book ai didi

org.apache.oozie.client.WorkflowAction类的使用及代码示例

转载 作者:知者 更新时间:2024-03-27 05:09:05 26 4
gpt4 key购买 nike

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

WorkflowAction介绍

[英]Bean that represents a workflow action in a workflow job.
[中]表示工作流作业中的工作流操作的Bean。

代码示例

代码示例来源: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: apache/oozie

@Override
protected String getActualExternalId(WorkflowAction action) {
  String launcherJobId = action.getExternalId();
  String childId = action.getExternalChildIDs();
  if (childId != null && !childId.isEmpty()) {
    return childId;
  } else {
    return launcherJobId;
  }
}

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

public static String getActionYarnTag(Configuration conf, String parentId, WorkflowAction wfAction) {
  String tag;
  if ( conf != null && conf.get(OOZIE_ACTION_YARN_TAG) != null) {
    tag = conf.get(OOZIE_ACTION_YARN_TAG) + "@" + wfAction.getName();
  } else if (parentId != null) {
    tag = parentId + "@" + wfAction.getName();
  } else {
    tag = wfAction.getId();
  }
  return tag;
}

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

private void persistResolvedActionDefinition(final WorkflowAction action, final File resolvedActionsDir) throws IOException {
  persistWorkflowDefinition(resolvedActionsDir, action.getName(), action.getConf());
}

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

@VisibleForTesting
void printWorkflowAction(WorkflowAction action, String timeZoneId, boolean verbose) {
  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.getUserRetryCount());
  System.out.println("Tracker URI       : " + maskIfNull(action.getTrackerUri()));
  System.out.println("Type              : " + maskIfNull(action.getType()));
  System.out.println("Started           : " + maskDate(action.getStartTime(), timeZoneId, verbose));
  System.out.println("Status            : " + action.getStatus());
  System.out.println("Ended             : " + maskDate(action.getEndTime(), timeZoneId, verbose));
  if (verbose) {
    System.out.println("External Stats    : " + action.getStats());
    System.out.println("External ChildIDs : " + action.getExternalChildIDs());
  }
  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: org.apache.oozie/oozie-tools

for (int actionCount = 0; actionCount != workflowActions.size() && actionCount < maxChildActions; ++actionCount) {
  final WorkflowAction action = workflowActions.get(actionCount);
  bundleEntryWriter.writeStringValue("Action Id          : ", action.getId())
           .writeStringValue("Name               : ", action.getName())
           .writeStringValue("Type               : ", action.getType())
           .writeStringValue("Status             : ", action.getStatus().toString())
           .writeStringValue("Transition         : ", action.getTransition())
           .writeDateValue("Start Time         : ", action.getStartTime())
           .writeDateValue("End Time           : ", action.getEndTime())
           .writeStringValue("Error Code         : ", action.getErrorCode())
           .writeStringValue("Error Message      : ", action.getErrorMessage())
           .writeStringValue("Console URL        : ", action.getConsoleUrl())
           .writeStringValue("Tracker URI        : ", action.getTrackerUri())
           .writeStringValue("External Child Ids : ", action.getExternalChildIDs())
           .writeStringValue("External Id        : ", action.getExternalId())
           .writeStringValue("External Status    : ", action.getExternalStatus())
           .writeStringValue("Data               : ", action.getData())
           .writeStringValue("Stats              : ", action.getStats())
           .writeStringValue("Credentials        : ", action.getCred())
           .writeIntValue("Retries            : ", action.getRetries())
           .writeIntValue("User Retry Int     : ", action.getUserRetryInterval())
           .writeIntValue("User Retry Count   : ", action.getUserRetryCount())
           .writeIntValue("User Retry Max     : ", action.getUserRetryMax())
           .writeNewLine()
           .flush();
  final String actionType = action.getType();
  persistResolvedActionDefinition(action, resolvedActionsDir);

代码示例来源: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 static void setActionInfo(WorkflowInstance workflowInstance, WorkflowAction action) {
  if (action.getExternalId() != null) {
    workflowInstance.setVar(action.getName() + WorkflowInstance.NODE_VAR_SEPARATOR + ACTION_EXTERNAL_ID,
                action.getExternalId());
  if (action.getTrackerUri() != null) {
    workflowInstance.setVar(action.getName() + WorkflowInstance.NODE_VAR_SEPARATOR + ACTION_TRACKER_URI,
                action.getTrackerUri());
  if (action.getExternalStatus() != null) {
    workflowInstance.setVar(action.getName() + WorkflowInstance.NODE_VAR_SEPARATOR + ACTION_EXTERNAL_STATUS,
                action.getExternalStatus());
  if (action.getData() != null) {
    workflowInstance
        .setVar(action.getName() + WorkflowInstance.NODE_VAR_SEPARATOR + ACTION_DATA, action.getData());
  if (action.getExternalChildIDs() != null) {
    workflowInstance.setVar(action.getName() + WorkflowInstance.NODE_VAR_SEPARATOR + ACTION_DATA,
        HADOOP_JOBS_PREFIX + action.getExternalChildIDs());
  if (action.getStats() != null) {
    workflowInstance.setVar(action.getName() + WorkflowInstance.NODE_VAR_SEPARATOR
        + MapReduceActionExecutor.HADOOP_COUNTERS,
        action.getStats());
  if (action.getErrorCode() != null) {
    workflowInstance.setVar(action.getName() + WorkflowInstance.NODE_VAR_SEPARATOR + ACTION_ERROR_CODE,
                action.getErrorCode());

代码示例来源:origin: jaibeermalik/searchanalytics-bigdata

workflowAction.getConsoleUrl());
LOG.debug("HiveActionWorkflowJob Action Name: {}",
    workflowAction.getName());
LOG.debug("HiveActionWorkflowJob Action error message: {}",
    workflowAction.getErrorMessage());
LOG.debug("HiveActionWorkflowJob Action Status: {}",
    workflowAction.getStats());
LOG.debug("HiveActionWorkflowJob Action data: {}",
    workflowAction.getData());
LOG.debug("HiveActionWorkflowJob Action conf: {}",
    workflowAction.getConf());
LOG.debug("HiveActionWorkflowJob Action retries: {}",
    workflowAction.getRetries());
LOG.debug("HiveActionWorkflowJob Action id: {}",
    workflowAction.getId());
LOG.debug("HiveActionWorkflowJob Action start time: {}",
    workflowAction.getStartTime());
LOG.debug("HiveActionWorkflowJob Action end time: {}",
    workflowAction.getEndTime());
LOG.debug("HiveActionWorkflowJob Oozie Url: {}",
    client.getOozieUrl());

代码示例来源: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: com.yahoo.oozie/oozie-examples

private static void printWorkflowInfo(WorkflowJob wf) {
  System.out.println("Application Path   : " + wf.getAppPath());
  System.out.println("Application Name   : " + wf.getAppName());
  System.out.println("Application Status : " + wf.getStatus());
  System.out.println("Application Actions:");
  for (WorkflowAction action : wf.getActions()) {
    System.out.println(MessageFormat.format("   Name: {0} Type: {1} Status: {2}", action.getName(),
                        action.getType(), action.getStatus()));
  }
  System.out.println();
}

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

protected String submitAction(Context context, JavaActionExecutor javaActionExecutor) throws ActionExecutorException {
  WorkflowAction action = context.getAction();
  javaActionExecutor.prepareActionDir(getFileSystem(), context);
  javaActionExecutor.submitLauncher(getFileSystem(), context, action);
  String jobId = action.getExternalId();
  String jobTracker = action.getTrackerUri();
  String consoleUrl = action.getConsoleUrl();
  assertNotNull(jobId);
  assertNotNull(jobTracker);
  assertNotNull(consoleUrl);
  return jobId;
}

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

private Map<String, WorkflowAction> fillWorkflowActions() {
  final Map<String, WorkflowAction> workflowActions = new LinkedHashMap<>();
  boolean found = false;
  for (final WorkflowAction wfAction : job.getActions()) {
    workflowActions.put(wfAction.getName(), wfAction);
    if (!found) {
      switch (wfAction.getStatus()) {
        case KILLED:
        case ERROR:
        case FAILED:
          showKill = true; // Assuming on error the workflow eventually ends with kill node
          found = true;
          break;
        default:
          // Look further
          break;
      }
    }
  }
  return workflowActions;
}

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

/**
 * Kill ssh action.
 *
 * @param context action execution context.
 * @param action object.
 * @throws org.apache.oozie.action.ActionExecutorException
 */
@Override
public void kill(Context context, WorkflowAction action) throws ActionExecutorException {
  LOG.info("Killing action");
  String command = "ssh " + action.getTrackerUri() + " kill  -KILL " + action.getExternalId();
  int returnValue = getReturnValue(command);
  if (returnValue != 0) {
    throw new ActionExecutorException(ActionExecutorException.ErrorType.ERROR, "FAILED_TO_KILL", XLog.format(
        "Unable to kill process {0} on {1}", action.getExternalId(), action.getTrackerUri()));
  }
  context.setEndData(WorkflowAction.Status.KILLED, "ERROR");
}

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

private void swapMRActionID(WorkflowAction waBean) {
  if (waBean.getType().equals("map-reduce")) {
    String childId = waBean.getExternalChildIDs();
    if (childId != null && !childId.equals("")) {
      String consoleBase = getConsoleBase(waBean.getConsoleUrl());
      ((WorkflowActionBean) waBean).setConsoleUrl(consoleBase + childId);
      ((WorkflowActionBean) waBean).setExternalId(childId);
      ((WorkflowActionBean) waBean).setExternalChildIDs("");
    }
  }
}

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

boolean exception = false;
try {
  if (action.getStatus() == WorkflowAction.Status.OK) {
    Element actionXml = XmlUtils.parseXml(action.getConf());
    Configuration jobConf = createBaseHadoopConf(context, actionXml);
    jobClient = createJobClient(context, jobConf);
    RunningJob runningJob = jobClient.getJob(JobID.forName(action.getExternalChildIDs()));
    if (runningJob == null) {
      throw new ActionExecutorException(ActionExecutorException.ErrorType.FAILED, "MR002",
          "Unknown hadoop job [{0}] associated with action [{1}].  Failing this action!",
          action.getExternalChildIDs(), action.getId());
      context.setVar(HADOOP_COUNTERS, "");
      XLog.getLog(getClass()).warn("Could not find Hadoop Counters for: [{0}]",
          action.getExternalChildIDs());

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

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

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

private void addActionInfo(StringBuffer sb) {
  addJobInfo(sb, ACTION_NAME, action.getName());
  addJobInfo(sb, ACTION_TYPE, action.getType());
}

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

public static void setLogInfo(WorkflowAction action) {
  String actionId = action.getId();
  XLog.Info.get().setParameter(DagXLogInfoService.JOB, actionId.substring(0, actionId.indexOf("@")));
  XLog.Info.get().setParameter(DagXLogInfoService.ACTION, actionId);
  XLog.Info.get().resetPrefix();
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com