public int run(String[] arguments) throws Exception {
try {
ARGS args = new ARGS();
setupArgs(arguments, args);
OozieClient client = new OozieClient(args.oozieUrl);
WorkflowJob jobInfo;
try {
jobInfo = client.getJobInfo(args.subflowId);
} catch (OozieClientException e) {
LOG.error("Error getting jobinfo for: " + args.subflowId, e);
return 0;
}
Path path = new Path(args.logDir + "/"
+ String.format("%03d", Integer.parseInt(args.runId)));
FileSystem fs = path.getFileSystem(getConf());
if (args.entityType.equalsIgnoreCase(EntityType.FEED.name())
|| notUserWorkflowEngineIsOozie(args.userWorkflowEngine)) {
// if replication wf, retention wf or PIG Process
copyOozieLog(client, fs, path, jobInfo.getId());
List<WorkflowAction> workflowActions = jobInfo.getActions();
for (int i=0; i < workflowActions.size(); i++) {
if (FALCON_ACTIONS.contains(workflowActions.get(i).getName())) {
copyTTlogs(fs, path, jobInfo.getActions().get(i));
break;
}
}
} else {
// if process wf with oozie engine
String subflowId = jobInfo.getExternalId();
copyOozieLog(client, fs, path, subflowId);
WorkflowJob subflowInfo = client.getJobInfo(subflowId);
List<WorkflowAction> actions = subflowInfo.getActions();
for (WorkflowAction action : actions) {
if (action.getType().equals("pig")
|| action.getType().equals("java")) {
copyTTlogs(fs, path, action);