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

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

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

WorkflowAction.getTrackerUri介绍

[英]Return the URL to programmatically track the status of the action.
[中]返回URL以编程方式跟踪操作的状态。

代码示例

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

/**
 * 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

@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: 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: org.apache.oozie/oozie-client

@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

String command = SSH_COMMAND_BASE + action.getTrackerUri() + " ps -p " + action.getExternalId();
Status aStatus;
int returnValue = getReturnValue(command);
        "Failed to connect to host [" + action.getTrackerUri() + "] for ssh action status check.");
  String checkErrorCmd = SSH_COMMAND_BASE + action.getTrackerUri() + " ls " + outFile;
  int retVal = getReturnValue(checkErrorCmd);
  if (retVal == 0) {

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

String command = SSH_COMMAND_BASE + action.getTrackerUri() + " ps -p " + action.getExternalId();
Status aStatus;
int returnValue = getReturnValue(command);
        "Failed to connect to host [" + action.getTrackerUri() + "] for ssh action status check.");
  String checkErrorCmd = SSH_COMMAND_BASE + action.getTrackerUri() + " ls " + outFile;
  int retVal = getReturnValue(checkErrorCmd);
  if (retVal == 0) {

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

public void kill(Context context, WorkflowAction action) throws ActionExecutorException {
  LOG.info("Killing action");
  try {
    String subWorkflowId = action.getExternalId();
    String oozieUri = action.getTrackerUri();
    if (subWorkflowId != null && oozieUri != null) {
      OozieClient oozieClient = getWorkflowClient(context, oozieUri);
      oozieClient.kill(subWorkflowId);
    }
    context.setEndData(WorkflowAction.Status.KILLED, getActionSignal(WorkflowAction.Status.KILLED));
  }
  catch (Exception ex) {
    throw convertException(ex);
  }
}

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

public void kill(Context context, WorkflowAction action) throws ActionExecutorException {
  LOG.info("Killing action");
  try {
    String subWorkflowId = action.getExternalId();
    String oozieUri = action.getTrackerUri();
    if (subWorkflowId != null && oozieUri != null) {
      OozieClient oozieClient = getWorkflowClient(context, oozieUri);
      oozieClient.kill(subWorkflowId);
    }
    context.setEndData(WorkflowAction.Status.KILLED, getActionSignal(WorkflowAction.Status.KILLED));
  }
  catch (Exception ex) {
    throw convertException(ex);
  }
}

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

/**
 * End action execution.
 *
 * @param context action execution context.
 * @param action action object.
 * @throws ActionExecutorException thrown if action end execution fails.
 */
public void end(final Context context, final WorkflowAction action) throws ActionExecutorException {
  if (action.getExternalStatus().equals("OK")) {
    context.setEndData(WorkflowAction.Status.OK, WorkflowAction.Status.OK.toString());
  }
  else {
    context.setEndData(WorkflowAction.Status.ERROR, WorkflowAction.Status.ERROR.toString());
  }
  boolean deleteTmpDir = ConfigurationService.getBoolean(DELETE_TMP_DIR);
  if (deleteTmpDir) {
    String tmpDir = getRemoteFileName(context, action, null, true, false);
    String removeTmpDirCmd = SSH_COMMAND_BASE + action.getTrackerUri() + " rm -rf " + tmpDir;
    int retVal = getReturnValue(removeTmpDirCmd);
    if (retVal != 0) {
      XLog.getLog(getClass()).warn("Cannot delete temp dir {0}", tmpDir);
    }
  }
  LOG.info("Action ended with external status [{0}]", action.getExternalStatus());
}

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

/**
 * End action execution.
 *
 * @param context action execution context.
 * @param action action object.
 * @throws ActionExecutorException thrown if action end execution fails.
 */
public void end(final Context context, final WorkflowAction action) throws ActionExecutorException {
  if (action.getExternalStatus().equals("OK")) {
    context.setEndData(WorkflowAction.Status.OK, WorkflowAction.Status.OK.toString());
  }
  else {
    context.setEndData(WorkflowAction.Status.ERROR, WorkflowAction.Status.ERROR.toString());
  }
  boolean deleteTmpDir = ConfigurationService.getBoolean(DELETE_TMP_DIR);
  if (deleteTmpDir) {
    String tmpDir = getRemoteFileName(context, action, null, true, false);
    String removeTmpDirCmd = SSH_COMMAND_BASE + action.getTrackerUri() + " rm -rf " + tmpDir;
    int retVal = getReturnValue(removeTmpDirCmd);
    if (retVal != 0) {
      XLog.getLog(getClass()).warn("Cannot delete temp dir {0}", tmpDir);
    }
  }
  LOG.info("Action ended with external status [{0}]", action.getExternalStatus());
}

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

public void check(Context context, WorkflowAction action) throws ActionExecutorException {
  try {
    String subWorkflowId = action.getExternalId();
    String oozieUri = action.getTrackerUri();
    OozieClient oozieClient = getWorkflowClient(context, oozieUri);
    WorkflowJob subWorkflow = oozieClient.getJobInfo(subWorkflowId);
    WorkflowJob.Status status = subWorkflow.getStatus();
    switch (status) {
      case FAILED:
      case KILLED:
      case SUCCEEDED:
        context.setExecutionData(status.toString(), null);
        break;
      default:
        context.setExternalStatus(status.toString());
        break;
    }
  }
  catch (Exception ex) {
    throw convertException(ex);
  }
}

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

public void check(Context context, WorkflowAction action) throws ActionExecutorException {
  try {
    String subWorkflowId = action.getExternalId();
    String oozieUri = action.getTrackerUri();
    OozieClient oozieClient = getWorkflowClient(context, oozieUri);
    WorkflowJob subWorkflow = oozieClient.getJobInfo(subWorkflowId);
    WorkflowJob.Status status = subWorkflow.getStatus();
    switch (status) {
      case FAILED:
      case KILLED:
      case SUCCEEDED:
        context.setExecutionData(status.toString(), null);
        break;
      default:
        context.setExternalStatus(status.toString());
        break;
    }
  }
  catch (Exception ex) {
    throw convertException(ex);
  }
}

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

action.getExternalId());
if (action.getTrackerUri() != null) {
  workflowInstance.setVar(action.getName() + WorkflowInstance.NODE_VAR_SEPARATOR + ACTION_TRACKER_URI,
              action.getTrackerUri());

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

action.getExternalId());
if (action.getTrackerUri() != null) {
  workflowInstance.setVar(action.getName() + WorkflowInstance.NODE_VAR_SEPARATOR + ACTION_TRACKER_URI,
              action.getTrackerUri());

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

/**
   * Submit the Shell action using Shell ActionExecutor
   *
   * @param context
   * @return The RunningJob of the Launcher Mapper
   * @throws Exception
   */
  private String submitAction(Context context) throws Exception {
    ShellActionExecutor ae = new ShellActionExecutor();

    WorkflowAction action = context.getAction();

    ae.prepareActionDir(getFileSystem(), context);
    ae.submitLauncher(getFileSystem(), context, action); // Submit the action

    String jobId = action.getExternalId();
    String jobTracker = action.getTrackerUri();
    String consoleUrl = action.getConsoleUrl();

    assertNotNull(jobId);
    assertNotNull(jobTracker);
    assertNotNull(consoleUrl);

    return jobId;
  }
}

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

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

相关文章