[
https://issues.apache.org/jira/browse/OOZIE-2582?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15365318#comment-15365318
]
Satish Subhashrao Saley commented on OOZIE-2582:
------------------------------------------------
Patch looks good. I also had a patch for OOZIE-2561, but did not get chance to
finish and upload it, but I had finished a test case in
TestHive2ActionExecutor.java. Please include as well since it would cover the
complete trip for hive action.
{code}
private String getHive2BadScript(String inputPath, String outputPath) {
StringBuilder buffer = new StringBuilder(NEW_LINE);
buffer.append("set -v;").append(NEW_LINE);
buffer.append("DROP TABLE IF EXISTS test;").append(NEW_LINE);
buffer.append("CREATE EXTERNAL TABLE test (a INT) STORED AS");
buffer.append(NEW_LINE).append("TEXTFILE LOCATION '");
buffer.append(inputPath).append("';").append(NEW_LINE);
buffer.append("INSERT OVERWRITE DIRECTORY '");
buffer.append(outputPath).append("'").append(NEW_LINE);
buffer.append("SELECT (a-1) FROM test-bad;").append(NEW_LINE);
return buffer.toString();
}
public void testExternalChildIdsInFailure() throws Exception {
setupHiveServer2();
Path inputDir = new Path(getFsTestCaseDir(), INPUT_DIRNAME);
Path outputDir = new Path(getFsTestCaseDir(), OUTPUT_DIRNAME);
FileSystem fs = getFileSystem();
String query = getHive2BadScript(inputDir.toString(),
outputDir.toString());
Writer dataWriter = new OutputStreamWriter(fs.create(new Path(inputDir,
DATA_FILENAME)));
dataWriter.write(SAMPLE_DATA_TEXT);
dataWriter.close();
Context context = createContext(getQueryActionXml(query));
final RunningJob launcherJob = submitAction(context,
Namespace.getNamespace("uri:oozie:hive2-action:0.2"));
String launcherId = context.getAction().getExternalId();
waitFor(200 * 1000, new Predicate() {
@Override
public boolean evaluate() throws Exception {
return launcherJob.isComplete();
}
});
assertTrue(launcherJob.isSuccessful());
Configuration conf = new XConfiguration();
conf.set("user.name", getTestUser());
Map<String, String> actionData =
LauncherMapperHelper.getActionData(getFileSystem(), context.getActionDir(),
conf);
assertFalse(LauncherMapperHelper.hasIdSwap(actionData));
Hive2ActionExecutor ae = new Hive2ActionExecutor();
ae.check(context, context.getAction());
assertTrue(launcherId.equals(context.getAction().getExternalId()));
assertEquals("FAILED/KILLED", context.getAction().getExternalStatus());
ae.end(context, context.getAction());
assertEquals(WorkflowAction.Status.ERROR,
context.getAction().getStatus());
assertNotNull(context.getAction().getExternalChildIDs());
}
{code}
> Populating external child Ids for action failures
> -------------------------------------------------
>
> Key: OOZIE-2582
> URL: https://issues.apache.org/jira/browse/OOZIE-2582
> Project: Oozie
> Issue Type: Bug
> Components: core
> Reporter: abhishek bafna
> Assignee: abhishek bafna
> Attachments: OOZIE-2582-00.patch, OOZIE-2582-01.patch
>
>
> Currently Oozie external child ids are populated into workflow bean, when the
> job/action completes successfully. It should populate external child ids in
> case of job failures as well.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)