/** * 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"); }
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); }
/** * 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"); }
@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); }
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); }
@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); }
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) {
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) {
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); } }
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); } }
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()); }
/** * 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()); }
/** * 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()); }
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); } }
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); } }
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; }
action.getExternalId()); if (action.getTrackerUri() != null) { workflowInstance.setVar(action.getName() + WorkflowInstance.NODE_VAR_SEPARATOR + ACTION_TRACKER_URI, action.getTrackerUri());
action.getExternalId()); if (action.getTrackerUri() != null) { workflowInstance.setVar(action.getName() + WorkflowInstance.NODE_VAR_SEPARATOR + ACTION_TRACKER_URI, action.getTrackerUri());
/** * 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; } }
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(); }