gpt4 book ai didi

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

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

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

WorkflowAction.getId介绍

[英]Return the action action ID.
[中]返回操作ID。

代码示例

代码示例来源: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-core

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: apache/oozie

protected HashMap<String, CredentialsProperties> getActionCredentialsProperties(Context context,
    WorkflowAction action) throws Exception {
  HashMap<String, CredentialsProperties> props = new HashMap<String, CredentialsProperties>();
  if (context != null && action != null) {
    String credsInAction = action.getCred();
    if (credsInAction != null) {
      LOG.debug("Get credential '" + credsInAction + "' properties for action : " + action.getId());
      String[] credNames = credsInAction.split(",");
      for (String credName : credNames) {
        CredentialsProperties credProps = getCredProperties(context, credName);
        props.put(credName, credProps);
      }
    }
  }
  else {
    LOG.warn("context or action is null");
  }
  return props;
}

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

protected HashMap<String, CredentialsProperties> getActionCredentialsProperties(Context context,
    WorkflowAction action) throws Exception {
  HashMap<String, CredentialsProperties> props = new HashMap<String, CredentialsProperties>();
  if (context != null && action != null) {
    String credsInAction = action.getCred();
    if (credsInAction != null) {
      LOG.debug("Get credential '" + credsInAction + "' properties for action : " + action.getId());
      String[] credNames = credsInAction.split(",");
      for (String credName : credNames) {
        CredentialsProperties credProps = getCredProperties(context, credName);
        props.put(credName, credProps);
      }
    }
  }
  else {
    LOG.warn("context or action is null");
  }
  return props;
}

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

/**
   * Creating and forwarding the tag, It will be useful during repeat attempts of Launcher, to ensure only
   * one child job is running. Tag is formed as follows:
   * For workflow job, tag = action-id
   * For Coord job, tag = coord-action-id@action-name (if not part of sub flow), else
   * coord-action-id@subflow-action-name@action-name.
   * @param conf the conf
   * @param wfJob the wf job
   * @param action the action
   * @return the action yarn tag
   */
  public static String getActionYarnTag(Configuration conf, WorkflowJob wfJob, WorkflowAction action) {
    if (conf != null && conf.get(OOZIE_ACTION_YARN_TAG) != null) {
      return conf.get(OOZIE_ACTION_YARN_TAG) + "@" + action.getName();
    }
    else if (wfJob.getParentId() != null) {
      return wfJob.getParentId() + "@" + action.getName();
    }
    else {
      return action.getId();
    }
  }
}

代码示例来源: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();
}

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

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

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

/**
   * Creating and forwarding the tag, It will be useful during repeat attempts of Launcher, to ensure only
   * one child job is running. Tag is formed as follows:
   * For workflow job, tag = action-id
   * For Coord job, tag = coord-action-id@action-name (if not part of sub flow), else
   * coord-action-id@subflow-action-name@action-name.
   * @param conf the conf
   * @param wfJob the wf job
   * @param action the action
   * @return the action yarn tag
   */
  public static String getActionYarnTag(Configuration conf, WorkflowJob wfJob, WorkflowAction action) {
    if (conf != null && conf.get(OOZIE_ACTION_YARN_TAG) != null) {
      return conf.get(OOZIE_ACTION_YARN_TAG) + "@" + action.getName();
    }
    else if (wfJob.getParentId() != null) {
      return wfJob.getParentId() + "@" + action.getName();
    }
    else {
      return action.getId();
    }
  }
}

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

@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

void killExternalChildApp(WorkflowAction action, YarnClient yarnClient, String appExternalId)
    throws YarnException, IOException {
  String externalChildIDs = action.getExternalChildIDs();
  if (externalChildIDs != null) {
    for (String childId : externalChildIDs.split(",")) {
      ApplicationId appChildId = ConverterUtils.toApplicationId(childId.trim());
      if (finalAppStatusUndefined(yarnClient.getApplicationReport(appChildId))) {
        try {
          LOG.info("Killing action {0}''s external child application {1}", action.getId(), childId);
          yarnClient.killApplication(appChildId);
        } catch (Exception e) {
          LOG.warn("Could not kill external child of {0}, {1}",
              appExternalId, childId, e);
        }
      }
    }
  }
}

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

void killExternalChildApp(WorkflowAction action, YarnClient yarnClient, String appExternalId)
    throws YarnException, IOException {
  String externalChildIDs = action.getExternalChildIDs();
  if (externalChildIDs != null) {
    for (String childId : externalChildIDs.split(",")) {
      ApplicationId appChildId = ConverterUtils.toApplicationId(childId.trim());
      if (finalAppStatusUndefined(yarnClient.getApplicationReport(appChildId))) {
        try {
          LOG.info("Killing action {0}''s external child application {1}", action.getId(), childId);
          yarnClient.killApplication(appChildId);
        } catch (Exception e) {
          LOG.warn("Could not kill external child of {0}, {1}",
              appExternalId, childId, e);
        }
      }
    }
  }
}

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

void killExternalApp(WorkflowAction action, YarnClient yarnClient, String appExternalId)
    throws YarnException, IOException {
  if (appExternalId != null) {
    ApplicationId appId = ConverterUtils.toApplicationId(appExternalId);
    if (finalAppStatusUndefined(yarnClient.getApplicationReport(appId))) {
      try {
        LOG.info("Killing action {0}''s external application {1}", action.getId(), appExternalId);
        yarnClient.killApplication(appId);
      } catch (Exception e) {
        LOG.warn("Could not kill {0}", appExternalId, e);
      }
    }
  }
}

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

void killExternalChildAppByTags(WorkflowAction action, YarnClient yarnClient, Configuration jobConf, String appExternalId)
    throws YarnException, IOException {
  for (ApplicationId id : LauncherMain.getChildYarnJobs(jobConf, ApplicationsRequestScope.ALL,
      action.getStartTime().getTime())) {
    if (finalAppStatusUndefined(yarnClient.getApplicationReport(id))) {
      try {
        LOG.info("Killing action {0}''s external child application {1} based on tags",
            action.getId(), id.toString());
        yarnClient.killApplication(id);
      } catch (Exception e) {
        LOG.warn("Could not kill child of {0}, {1}", appExternalId, id, e);
      }
    }
  }
}

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

void killExternalChildAppByTags(WorkflowAction action, YarnClient yarnClient, Configuration jobConf, String appExternalId)
    throws YarnException, IOException {
  for (ApplicationId id : LauncherMain.getChildYarnJobs(jobConf, ApplicationsRequestScope.ALL,
      action.getStartTime().getTime())) {
    if (finalAppStatusUndefined(yarnClient.getApplicationReport(id))) {
      try {
        LOG.info("Killing action {0}''s external child application {1} based on tags",
            action.getId(), id.toString());
        yarnClient.killApplication(id);
      } catch (Exception e) {
        LOG.warn("Could not kill child of {0}, {1}", appExternalId, id, e);
      }
    }
  }
}

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

void killExternalApp(WorkflowAction action, YarnClient yarnClient, String appExternalId)
    throws YarnException, IOException {
  if (appExternalId != null) {
    ApplicationId appId = ConverterUtils.toApplicationId(appExternalId);
    if (finalAppStatusUndefined(yarnClient.getApplicationReport(appId))) {
      try {
        LOG.info("Killing action {0}''s external application {1}", action.getId(), appExternalId);
        yarnClient.killApplication(appId);
      } catch (Exception e) {
        LOG.warn("Could not kill {0}", appExternalId, e);
      }
    }
  }
}

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

public Void call() throws Exception {
    String oozieUrl = getContextURL();
    OozieClient wc = new OozieClient(oozieUrl);
    String jobId = MockDagEngineService.JOB_ID + "1" + MockDagEngineService.JOB_ID_END;
    assertEquals(RestConstants.JOB_SHOW_LOG, wc.getJobLog(jobId));
    WorkflowAction wfAction = wc.getWorkflowActionInfo(jobId);
    assertEquals(jobId, wfAction.getId());
    CoordinatorJob job = wc.getCoordJobInfo(MockCoordinatorEngineService.JOB_ID + "1"
        + MockCoordinatorEngineService.JOB_ID_END);
    assertEquals("group", job.getAcl());
    assertEquals("RUNNING", job.getStatus().toString());
    assertEquals("user", job.getUser());
    assertEquals(MockCoordinatorEngineService.offset, new Integer(1));
    assertEquals(MockCoordinatorEngineService.length, new Integer(1000));
    BundleJob bundleJob = wc.getBundleJobInfo(jobId);
    assertEquals("SUCCEEDED", bundleJob.getStatus().toString());
    assertEquals("user", bundleJob.getUser());
    return null;
  }
});

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

private void _testGetWFInfo() throws StoreException {
  store.beginTrx();
  WorkflowJobBean wfBean = store.getWorkflowInfo(wfBean1.getId());
  assertEquals(wfBean.getId(), wfBean1.getId());
  assertEquals(wfBean.getStatus(), wfBean1.getStatus());
  assertEquals(wfBean.getActions().size(), 1);
  assertEquals(wfBean.getActions().get(0).getId(), actionId);
  store.commitTrx();
}

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