use of org.apache.oozie.client.OozieClientException in project oozie by apache.
the class TestLocalOozieClientCoord method testReRun2.
public void testReRun2() {
OozieClient client = LocalOozie.getCoordClient();
try {
client.reRun("foo-id", client.createConfiguration());
fail("OozieClientException expected.");
} catch (OozieClientException oce) {
assertEquals(ErrorCode.E0301.toString(), oce.getErrorCode());
}
}
use of org.apache.oozie.client.OozieClientException in project oozie by apache.
the class TestLocalOozieClientCoord method testGetJobsInfo.
public void testGetJobsInfo() {
OozieClient client = LocalOozie.getCoordClient();
try {
client.getJobsInfo("foo");
fail("OozieClientException expected.");
} catch (OozieClientException oce) {
assertEquals(ErrorCode.E0301.toString(), oce.getErrorCode());
}
try {
client.getJobsInfo("foo", 0, 5);
fail("OozieClientException expected.");
} catch (OozieClientException oce) {
assertEquals(ErrorCode.E0301.toString(), oce.getErrorCode());
}
try {
client.getJobInfo("foo-id");
fail("OozieClientException expected.");
} catch (OozieClientException oce) {
assertEquals(ErrorCode.E0301.toString(), oce.getErrorCode());
}
}
use of org.apache.oozie.client.OozieClientException in project oozie by apache.
the class TestWorkflow method runWorkflowFromFile.
private void runWorkflowFromFile(final String workflowFileName, final Properties additionalWorkflowProperties) throws IOException, OozieClientException {
final FileSystem fs = getFileSystem();
final Path appPath = new Path(getFsTestCaseDir(), "app");
fs.mkdirs(appPath);
fs.mkdirs(new Path(appPath, "lib"));
final Reader reader = getResourceAsReader(workflowFileName, -1);
final Writer writer = new OutputStreamWriter(fs.create(new Path(appPath, "workflow.xml")));
copyCharStream(reader, writer);
writer.close();
reader.close();
final Path path = getFsTestCaseDir();
final OozieClient oozieClient = LocalOozie.getClient();
final Properties conf = oozieClient.createConfiguration();
conf.setProperty(OozieClient.APP_PATH, new Path(appPath, "workflow.xml").toString());
conf.setProperty(OozieClient.USER_NAME, getTestUser());
conf.setProperty("nameNodeBasePath", path.toString());
conf.setProperty("base", path.toUri().getPath());
conf.setProperty("nameNode", getNameNodeUri());
conf.setProperty("jobTracker", getJobTrackerUri());
for (final String additionalKey : additionalWorkflowProperties.stringPropertyNames()) {
conf.setProperty(additionalKey, additionalWorkflowProperties.getProperty(additionalKey));
}
final String jobId = oozieClient.submit(conf);
assertNotNull(jobId);
WorkflowJob wf = oozieClient.getJobInfo(jobId);
assertNotNull(wf);
assertEquals(WorkflowJob.Status.PREP, wf.getStatus());
oozieClient.start(jobId);
waitFor(15 * 1000, new Predicate() {
public boolean evaluate() throws Exception {
final WorkflowJob wf = oozieClient.getJobInfo(jobId);
return wf.getStatus() == WorkflowJob.Status.SUCCEEDED;
}
});
wf = oozieClient.getJobInfo(jobId);
assertNotNull(wf);
assertEquals(WorkflowJob.Status.SUCCEEDED, wf.getStatus());
}
use of org.apache.oozie.client.OozieClientException in project oozie by apache.
the class DiagOozieClient method saveThreadDumpPage.
// Oozie has a jsp page with a thread dump, and the Oozie client normally doesn't have a way of getting it,
// so we're doing that here; reusing all the fancy HTTP handling code in AuthOozieClient
void saveThreadDumpPage(File file) throws OozieClientException, IOException {
final URL url = new URL(super.getOozieUrl() + "admin/jvminfo.jsp");
final HttpURLConnection retryableConnection = createRetryableConnection(url, "GET");
if ((retryableConnection.getResponseCode() == HttpURLConnection.HTTP_OK)) {
try (InputStream is = retryableConnection.getInputStream();
final FileOutputStream os = new FileOutputStream(file)) {
IOUtils.copyStream(is, os);
}
} else {
throw new OozieClientException("HTTP error", retryableConnection.getResponseMessage());
}
}
use of org.apache.oozie.client.OozieClientException in project oozie by apache.
the class ServerInfoCollector method storeThreadDump.
void storeThreadDump(final File outputDir) {
try {
System.out.print("Getting Thread Dump...");
client.saveThreadDumpPage(new File(outputDir, "thread-dump.html"));
System.out.println("Done");
} catch (OozieClientException | IOException e) {
System.err.printf("Exception occurred during the retrieval of Oozie server thread dump: %s%n", e.getMessage());
}
}
Aggregations