use of org.apache.oozie.client.WorkflowAction in project oozie by apache.
the class TestPigActionExecutor method testExternalChildIds.
/*
* Test the Hadoop IDs obtained from the Pig job
*/
public void testExternalChildIds() throws Exception {
// Set the action xml with the option for retrieving stats to false
String actionXml = setPigActionXml(PIG_SCRIPT, false);
Context context = createContext(actionXml);
final String launcherId = submitAction(context);
waitUntilYarnAppDoneAndAssertSuccess(launcherId);
PigActionExecutor ae = new PigActionExecutor();
WorkflowAction wfAction = context.getAction();
ae.check(context, wfAction);
ae.end(context, wfAction);
assertEquals("SUCCEEDED", wfAction.getExternalStatus());
String externalIds = wfAction.getExternalChildIDs();
assertNotNull(externalIds);
assertNotSame("", externalIds);
// check for the expected prefix of hadoop jobIDs
assertTrue(externalIds.contains("job_"));
}
use of org.apache.oozie.client.WorkflowAction in project oozie by apache.
the class TestPigActionExecutor method testExecutionStatsWithRetrieveStatsFalse.
/*
* Test the stats with retrieve stats option set to false
*/
public void testExecutionStatsWithRetrieveStatsFalse() throws Exception {
// Set the action xml with the option for retrieving stats to false
String actionXml = setPigActionXml(PIG_SCRIPT, false);
Context context = createContext(actionXml);
final String launcherId = submitAction(context);
waitUntilYarnAppDoneAndAssertSuccess(launcherId);
Configuration conf = new XConfiguration();
conf.set("user.name", getTestUser());
Map<String, String> actionData = LauncherHelper.getActionData(getFileSystem(), context.getActionDir(), conf);
assertFalse(LauncherHelper.hasStatsData(actionData));
PigActionExecutor ae = new PigActionExecutor();
WorkflowAction wfAction = context.getAction();
ae.check(context, wfAction);
ae.end(context, wfAction);
assertEquals("SUCCEEDED", wfAction.getExternalStatus());
assertNotNull(wfAction.getExternalChildIDs());
}
use of org.apache.oozie.client.WorkflowAction in project oozie by apache.
the class TestPigActionExecutor method submitAction.
private String submitAction(Context context) throws Exception {
PigActionExecutor ae = new PigActionExecutor();
WorkflowAction action = context.getAction();
ae.prepareActionDir(getFileSystem(), context);
ae.submitLauncher(getFileSystem(), context, action);
String jobId = action.getExternalId();
return jobId;
}
use of org.apache.oozie.client.WorkflowAction in project oozie by apache.
the class TestPigActionExecutor method testExecutionStats.
/*
* Test the stats retrieved from a Pig job
*/
public void testExecutionStats() throws Exception {
// Set the action xml with the option for retrieving stats to true
String actionXml = setPigActionXml(PIG_SCRIPT, true);
Context context = createContext(actionXml);
final String launcherId = submitAction(context);
waitUntilYarnAppDoneAndAssertSuccess(launcherId);
Configuration conf = new XConfiguration();
conf.set("user.name", getTestUser());
Map<String, String> actionData = LauncherHelper.getActionData(getFileSystem(), context.getActionDir(), conf);
assertTrue(LauncherHelper.hasStatsData(actionData));
PigActionExecutor ae = new PigActionExecutor();
WorkflowAction wfAction = context.getAction();
ae.check(context, wfAction);
ae.end(context, wfAction);
assertEquals(JavaActionExecutor.SUCCEEDED, wfAction.getExternalStatus());
String stats = wfAction.getStats();
assertNotNull(stats);
// check for some of the expected key values in the stats
Map m = (Map) JSONValue.parse(stats);
// check for expected 1st level JSON keys
assertTrue(m.containsKey("PIG_VERSION"));
String expectedChildIDs = wfAction.getExternalChildIDs();
String[] childIDs = expectedChildIDs.split(",");
assertTrue(m.containsKey(childIDs[0]));
Map q = (Map) m.get(childIDs[0]);
// check for expected 2nd level JSON keys
assertTrue(q.containsKey("HADOOP_COUNTERS"));
}
use of org.apache.oozie.client.WorkflowAction in project oozie by apache.
the class LocalOozieExample method printWorkflowInfo.
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();
}
Aggregations