本文整理了Java中org.apache.oozie.client.WorkflowAction.getExternalId()
方法的一些代码示例,展示了WorkflowAction.getExternalId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorkflowAction.getExternalId()
方法的具体详情如下:
包路径:org.apache.oozie.client.WorkflowAction
类名称:WorkflowAction
方法名:getExternalId
[英]Return the external ID of the action.
[中]返回操作的外部ID。
代码示例来源:origin: apache/oozie
/**
* Useful for overriding in actions that do subsequent job runs
* such as the MapReduce Action, where the launcher job is not the
* actual job that then gets monitored.
* @param action
* @return external ID.
*/
protected String getActualExternalId(WorkflowAction action) {
return action.getExternalId();
}
代码示例来源:origin: apache/oozie
/**
* For every {@link JavaActionExecutor} that is not {@link MapReduceActionExecutor}, the effective YARN application ID of the
* action is the one where {@link LauncherAM} is run, hence this default implementation.
* @param context the execution context
* @param action the workflow action
* @return a {@code String} that depicts the application ID of the launcher ApplicationMaster of this action
* @throws ActionExecutorException
*/
protected String findYarnApplicationId(final Context context, final WorkflowAction action)
throws ActionExecutorException {
return action.getExternalId();
}
代码示例来源:origin: org.apache.oozie/oozie-core
/**
* For every {@link JavaActionExecutor} that is not {@link MapReduceActionExecutor}, the effective YARN application ID of the
* action is the one where {@link LauncherAM} is run, hence this default implementation.
* @param context the execution context
* @param action the workflow action
* @return a {@code String} that depicts the application ID of the launcher ApplicationMaster of this action
* @throws ActionExecutorException
*/
protected String findYarnApplicationId(final Context context, final WorkflowAction action)
throws ActionExecutorException {
return action.getExternalId();
}
代码示例来源:origin: org.apache.oozie/oozie-core
/**
* Useful for overriding in actions that do subsequent job runs
* such as the MapReduce Action, where the launcher job is not the
* actual job that then gets monitored.
* @param action
* @return external ID.
*/
protected String getActualExternalId(WorkflowAction action) {
return action.getExternalId();
}
代码示例来源:origin: apache/oozie
@Override
protected String getActualExternalId(WorkflowAction action) {
String launcherJobId = action.getExternalId();
String childId = action.getExternalChildIDs();
if (childId != null && !childId.isEmpty()) {
return childId;
} else {
return launcherJobId;
}
}
代码示例来源:origin: org.apache.oozie/oozie-core
@Override
protected String getActualExternalId(WorkflowAction action) {
String launcherJobId = action.getExternalId();
String childId = action.getExternalChildIDs();
if (childId != null && !childId.isEmpty()) {
return childId;
} else {
return launcherJobId;
}
}
代码示例来源:origin: org.apache.oozie/oozie-tools
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());
}
}
代码示例来源:origin: apache/oozie
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;
}
代码示例来源:origin: apache/oozie
/**
* Kill ssh action.
*
* @param context action execution context.
* @param action object.
* @throws org.apache.oozie.action.ActionExecutorException
*/
@Override
public void kill(Context context, WorkflowAction action) throws ActionExecutorException {
LOG.info("Killing action");
String command = "ssh " + action.getTrackerUri() + " kill -KILL " + action.getExternalId();
int returnValue = getReturnValue(command);
if (returnValue != 0) {
throw new ActionExecutorException(ActionExecutorException.ErrorType.ERROR, "FAILED_TO_KILL", XLog.format(
"Unable to kill process {0} on {1}", action.getExternalId(), action.getTrackerUri()));
}
context.setEndData(WorkflowAction.Status.KILLED, "ERROR");
}
代码示例来源:origin: YahooArchive/oozie
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);
}
代码示例来源:origin: org.apache.oozie/oozie-core
/**
* Kill ssh action.
*
* @param context action execution context.
* @param action object.
* @throws org.apache.oozie.action.ActionExecutorException
*/
@Override
public void kill(Context context, WorkflowAction action) throws ActionExecutorException {
LOG.info("Killing action");
String command = "ssh " + action.getTrackerUri() + " kill -KILL " + action.getExternalId();
int returnValue = getReturnValue(command);
if (returnValue != 0) {
throw new ActionExecutorException(ActionExecutorException.ErrorType.ERROR, "FAILED_TO_KILL", XLog.format(
"Unable to kill process {0} on {1}", action.getExternalId(), action.getTrackerUri()));
}
context.setEndData(WorkflowAction.Status.KILLED, "ERROR");
}
代码示例来源:origin: apache/oozie
public void kill(Context context, WorkflowAction action) throws ActionExecutorException {
LOG.info("Killing action");
try {
String subWorkflowId = action.getExternalId();
String oozieUri = action.getTrackerUri();
if (subWorkflowId != null && oozieUri != null) {
OozieClient oozieClient = getWorkflowClient(context, oozieUri);
oozieClient.kill(subWorkflowId);
}
context.setEndData(WorkflowAction.Status.KILLED, getActionSignal(WorkflowAction.Status.KILLED));
}
catch (Exception ex) {
throw convertException(ex);
}
}
代码示例来源:origin: org.apache.oozie/oozie-core
public void kill(Context context, WorkflowAction action) throws ActionExecutorException {
LOG.info("Killing action");
try {
String subWorkflowId = action.getExternalId();
String oozieUri = action.getTrackerUri();
if (subWorkflowId != null && oozieUri != null) {
OozieClient oozieClient = getWorkflowClient(context, oozieUri);
oozieClient.kill(subWorkflowId);
}
context.setEndData(WorkflowAction.Status.KILLED, getActionSignal(WorkflowAction.Status.KILLED));
}
catch (Exception ex) {
throw convertException(ex);
}
}
代码示例来源:origin: apache/oozie
public void testSubWorkflowSuspend() throws Exception {
try {
String workflowUri = createSubWorkflowWithLazyAction(true);
LocalOozie.start();
final OozieClient wfClient = LocalOozie.getClient();
final String jobId = submitWorkflow(workflowUri, wfClient);
waitForWorkflowToStart(wfClient, jobId);
WorkflowJob wf = wfClient.getJobInfo(jobId);
// Suspending subworkflow
new SuspendXCommand(wf.getActions().get(1).getExternalId()).call();
// Check suspend for base workflow
assertEquals(WorkflowJob.Status.SUSPENDED, wfClient.getJobInfo(jobId).getStatus());
//Check suspend for sub workflow
assertEquals(WorkflowJob.Status.SUSPENDED, wfClient.getJobInfo(wf.getActions().get(1).getExternalId()).getStatus());
} finally {
LocalOozie.stop();
}
}
代码示例来源:origin: apache/oozie
protected String submitAction(Context context) throws Exception {
DistcpActionExecutor ae = new DistcpActionExecutor();
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);
ae.submitLauncher(getFileSystem(), context, context.getAction());
return context.getAction().getExternalId();
}
代码示例来源:origin: apache/oozie
protected String submitAction(Context context, JavaActionExecutor javaActionExecutor) throws ActionExecutorException {
WorkflowAction action = context.getAction();
javaActionExecutor.prepareActionDir(getFileSystem(), context);
javaActionExecutor.submitLauncher(getFileSystem(), context, action);
String jobId = action.getExternalId();
String jobTracker = action.getTrackerUri();
String consoleUrl = action.getConsoleUrl();
assertNotNull(jobId);
assertNotNull(jobTracker);
assertNotNull(consoleUrl);
return jobId;
}
代码示例来源:origin: apache/oozie
public void testSimpestSleSubmitOK() throws Exception {
String actionXml = "<java>" +
"<job-tracker>" + getJobTrackerUri() + "</job-tracker>" +
"<name-node>" + getNameNodeUri() + "</name-node>" +
"<main-class>" + LauncherMainTester.class.getName() + "</main-class>" +
"</java>";
Context context = createContext(actionXml, null);
submitAction(context);
waitUntilYarnAppDoneAndAssertSuccess(context.getAction().getExternalId());
ActionExecutor ae = new JavaActionExecutor();
ae.check(context, context.getAction());
assertEquals("SUCCEEDED", context.getAction().getExternalStatus());
assertNull(context.getAction().getData());
ae.end(context, context.getAction());
assertEquals(WorkflowAction.Status.OK, context.getAction().getStatus());
}
代码示例来源:origin: apache/oozie
public void testSimplestSubmitWithResourceManagerOK() throws Exception {
final String actionXml = "<java>" +
"<resource-manager>" + getJobTrackerUri() + "</resource-manager>" +
"<name-node>" + getNameNodeUri() + "</name-node>" +
"<main-class>" + LauncherMainTester.class.getName() + "</main-class>" +
"</java>";
final Context context = createContext(actionXml, null);
submitAction(context);
waitUntilYarnAppDoneAndAssertSuccess(context.getAction().getExternalId());
final ActionExecutor ae = new JavaActionExecutor();
ae.check(context, context.getAction());
assertEquals("SUCCEEDED", context.getAction().getExternalStatus());
assertNull(context.getAction().getData());
ae.end(context, context.getAction());
assertEquals(WorkflowAction.Status.OK, context.getAction().getStatus());
}
代码示例来源:origin: apache/oozie
public void testSubmitOKWithLauncherEnvVars() throws Exception {
String actionXml = "<java>" +
"<job-tracker>" + getJobTrackerUri() + "</job-tracker>" +
"<name-node>" + getNameNodeUri() + "</name-node>" +
"<configuration>" +
" <property><name>oozie.launcher.env</name><value>A=foo1" + File.pathSeparator + "B=foo2</value></property>" +
"</configuration>" +
"<main-class>" + LauncherMainTester.class.getName() + "</main-class>" +
"</java>";
Context context = createContext(actionXml, null);
submitAction(context);
waitUntilYarnAppDoneAndAssertSuccess(context.getAction().getExternalId());
ActionExecutor ae = new JavaActionExecutor();
ae.check(context, context.getAction());
assertEquals("SUCCEEDED", context.getAction().getExternalStatus());
assertNull(context.getAction().getData());
ae.end(context, context.getAction());
assertEquals(WorkflowAction.Status.OK, context.getAction().getStatus());
}
代码示例来源:origin: apache/oozie
public void testSubmitOKWithLauncherJavaOpts() throws Exception {
String actionXml = "<java>" +
"<job-tracker>" + getJobTrackerUri() + "</job-tracker>" +
"<name-node>" + getNameNodeUri() + "</name-node>" +
"<configuration>" +
" <property><name>oozie.launcher.javaopts</name><value>-DtestJavaOpts=true</value></property>" +
"</configuration>" +
"<main-class>" + LauncherMainTester.class.getName() + "</main-class>" +
"</java>";
Context context = createContext(actionXml, null);
submitAction(context);
waitUntilYarnAppDoneAndAssertSuccess(context.getAction().getExternalId());
ActionExecutor ae = new JavaActionExecutor();
ae.check(context, context.getAction());
assertEquals("FAILED/KILLED", context.getAction().getExternalStatus());
assertNull(context.getAction().getData());
ae.end(context, context.getAction());
assertEquals(WorkflowAction.Status.ERROR, context.getAction().getStatus());
}
内容来源于网络,如有侵权,请联系作者删除!