use of org.apache.oozie.client.WorkflowAction in project oozie by apache.
the class TestHiveActionExecutor method submitAction.
private String submitAction(Context context, Namespace ns) throws Exception {
HiveActionExecutor ae = new HiveActionExecutor();
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);
return jobId;
}
use of org.apache.oozie.client.WorkflowAction in project oozie by apache.
the class OozieCLI method printJob.
@VisibleForTesting
void printJob(WorkflowJob job, String timeZoneId, boolean verbose) throws IOException {
System.out.println("Job ID : " + maskIfNull(job.getId()));
System.out.println(RULER);
System.out.println("Workflow Name : " + maskIfNull(job.getAppName()));
System.out.println("App Path : " + maskIfNull(job.getAppPath()));
System.out.println("Status : " + job.getStatus());
System.out.println("Run : " + job.getRun());
System.out.println("User : " + maskIfNull(job.getUser()));
System.out.println("Group : " + maskIfNull(job.getGroup()));
System.out.println("Created : " + maskDate(job.getCreatedTime(), timeZoneId, verbose));
System.out.println("Started : " + maskDate(job.getStartTime(), timeZoneId, verbose));
System.out.println("Last Modified : " + maskDate(job.getLastModifiedTime(), timeZoneId, verbose));
System.out.println("Ended : " + maskDate(job.getEndTime(), timeZoneId, verbose));
System.out.println("CoordAction ID: " + maskIfNull(job.getParentId()));
List<WorkflowAction> actions = job.getActions();
if (actions != null && actions.size() > 0) {
System.out.println();
System.out.println("Actions");
System.out.println(RULER);
if (verbose) {
System.out.println("ID" + VERBOSE_DELIMITER + "Console URL" + VERBOSE_DELIMITER + "Error Code" + VERBOSE_DELIMITER + "Error Message" + VERBOSE_DELIMITER + "External ID" + VERBOSE_DELIMITER + "External Status" + VERBOSE_DELIMITER + "Name" + VERBOSE_DELIMITER + "Retries" + VERBOSE_DELIMITER + "Tracker URI" + VERBOSE_DELIMITER + "Type" + VERBOSE_DELIMITER + "Started" + VERBOSE_DELIMITER + "Status" + VERBOSE_DELIMITER + "Ended");
System.out.println(RULER);
for (WorkflowAction action : job.getActions()) {
System.out.println(maskIfNull(action.getId()) + VERBOSE_DELIMITER + maskIfNull(action.getConsoleUrl()) + VERBOSE_DELIMITER + maskIfNull(action.getErrorCode()) + VERBOSE_DELIMITER + maskIfNull(action.getErrorMessage()) + VERBOSE_DELIMITER + maskIfNull(action.getExternalId()) + VERBOSE_DELIMITER + maskIfNull(action.getExternalStatus()) + VERBOSE_DELIMITER + maskIfNull(action.getName()) + VERBOSE_DELIMITER + action.getRetries() + VERBOSE_DELIMITER + maskIfNull(action.getTrackerUri()) + VERBOSE_DELIMITER + maskIfNull(action.getType()) + VERBOSE_DELIMITER + maskDate(action.getStartTime(), timeZoneId, verbose) + VERBOSE_DELIMITER + action.getStatus() + VERBOSE_DELIMITER + maskDate(action.getEndTime(), timeZoneId, verbose));
System.out.println(RULER);
}
} else {
System.out.println(String.format(WORKFLOW_ACTION_FORMATTER, "ID", "Status", "Ext ID", "Ext Status", "Err Code"));
System.out.println(RULER);
for (WorkflowAction action : job.getActions()) {
System.out.println(String.format(WORKFLOW_ACTION_FORMATTER, maskIfNull(action.getId()), action.getStatus(), maskIfNull(action.getExternalId()), maskIfNull(action.getExternalStatus()), maskIfNull(action.getErrorCode())));
System.out.println(RULER);
}
}
} else {
System.out.println(RULER);
}
System.out.println();
}
use of org.apache.oozie.client.WorkflowAction in project oozie by apache.
the class TestOozieCLIMethods method createWorkflowAction.
private static WorkflowAction createWorkflowAction(DataObject dtObject) {
WorkflowAction workflowActionMock = mock(WorkflowAction.class);
when(workflowActionMock.getId()).thenReturn(dtObject.deamonName);
when(workflowActionMock.getName()).thenReturn(dtObject.appName);
return workflowActionMock;
}
use of org.apache.oozie.client.WorkflowAction in project oozie by apache.
the class TestOozieCLIMethods method createWorkflowJob.
private WorkflowJob createWorkflowJob(DataObject dtObject) {
WorkflowJob workflowJobMock = mock(WorkflowJob.class);
when(workflowJobMock.getId()).thenReturn(dtObject.deamonName);
when(workflowJobMock.getAppName()).thenReturn(dtObject.appName);
when(workflowJobMock.getAppPath()).thenReturn(dtObject.appPath);
when(workflowJobMock.getStatus()).thenReturn(WorkflowJob.Status.RUNNING);
WorkflowAction ac = createWorkflowAction(dtObject);
WorkflowAction ac0 = createWorkflowAction(dtObject);
when(workflowJobMock.getActions()).thenReturn(Arrays.asList(ac, ac0));
return workflowJobMock;
}
use of org.apache.oozie.client.WorkflowAction in project oozie by apache.
the class TestJsonToBean method testParseWorkflowAction.
public void testParseWorkflowAction() {
JSONObject json = createJsonWorkflowAction();
WorkflowAction action = JsonToBean.createWorkflowAction(json);
assertEquals("a", action.getId());
assertEquals("b", action.getName());
assertEquals("c", action.getType());
assertEquals("d", action.getConf());
assertEquals(WorkflowAction.Status.RUNNING, action.getStatus());
assertEquals(1, action.getRetries());
assertEquals(JsonUtils.parseDateRfc822(START_TIME), action.getStartTime());
assertEquals(JsonUtils.parseDateRfc822(END_TIME), action.getEndTime());
assertEquals("e", action.getTransition());
assertEquals("ee", action.getData());
assertEquals("f", action.getExternalId());
assertEquals("g", action.getExternalStatus());
assertEquals("h", action.getTrackerUri());
assertEquals("i", action.getConsoleUrl());
assertEquals("j", action.getErrorCode());
assertEquals("k", action.getErrorMessage());
}
Aggregations