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; }
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; }
/** * Return the path that will be used to store action specific data * * @param jobId Worfklow ID * @param action Action * @param key An Identifier * @param temp temp directory flag * @return A string that has the path */ protected String getActionDirPath(String jobId, WorkflowAction action, String key, boolean temp) { String name = jobId + "/" + action.getName() + "--" + key; if (temp) { name += ".temp"; } return getOozieSystemId() + "/" + name; }
/** * Return the path that will be used to store action specific data * * @param jobId Worfklow ID * @param action Action * @param key An Identifier * @param temp temp directory flag * @return A string that has the path */ protected String getActionDirPath(String jobId, WorkflowAction action, String key, boolean temp) { String name = jobId + "/" + action.getName() + "--" + key; if (temp) { name += ".temp"; } return getOozieSystemId() + "/" + name; }
private void storeOozieLauncherLog(final File outputDir, final WorkflowAction action, final String user) { try (PrintStream fw = new PrintStream(new File(outputDir, "launcher_" + action.getName() + ".log"), StandardCharsets.UTF_8.toString())) { final ApplicationId appId = ConverterUtils.toApplicationId(action.getExternalId()); oozieLauncherLogFetcher.dumpAllContainersLogs(appId, user, fw); } catch (IOException e) { System.err.printf("Exception occurred during the retrieval of Oozie launcher logs for workflow(s): %s%n", e.getMessage()); } }
/** * 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(); } } }
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(); } }
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; }
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(); }
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; }
private void persistResolvedActionDefinition(final WorkflowAction action, final File resolvedActionsDir) throws IOException { persistWorkflowDefinition(resolvedActionsDir, action.getName(), action.getConf()); }
private Map<String, String> loadExtIds(List<WorkflowAction> actions) { Map<String, String> extIds = new HashMap<String, String>(); for (WorkflowAction action : actions) { extIds.put(action.getName(), action.getExternalId()); } return extIds; }
private void addActionInfo(StringBuffer sb) { addJobInfo(sb, ACTION_NAME, action.getName()); addJobInfo(sb, ACTION_TYPE, action.getType()); }
private void addActionInfo(StringBuffer sb) { addJobInfo(sb, ACTION_NAME, action.getName()); addJobInfo(sb, ACTION_TYPE, action.getType()); }
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); }
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); }
private String getYarnApplicationName(final Context context, final WorkflowAction action, final String prefix) { return XLog.format("{0}:T={1}:W={2}:A={3}:ID={4}", prefix, getType(), context.getWorkflow().getAppName(), action.getName(), context.getWorkflow().getId()); }
private String getYarnApplicationName(final Context context, final WorkflowAction action, final String prefix) { return XLog.format("{0}:T={1}:W={2}:A={3}:ID={4}", prefix, getType(), context.getWorkflow().getAppName(), action.getName(), context.getWorkflow().getId()); }
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()); }