static void handleError(HttpURLConnection conn) throws IOException, OozieClientException { int status = conn.getResponseCode(); String error = conn.getHeaderField(RestConstants.OOZIE_ERROR_CODE); String message = conn.getHeaderField(RestConstants.OOZIE_ERROR_MESSAGE); if (error == null) { error = "HTTP error code: " + status; } if (message == null) { message = conn.getResponseMessage(); } throw new OozieClientException(error, message); }
public void testErrorCodeMessage() { OozieClientException ex = new OozieClientException("errorCode", "message"); assertEquals("errorCode", ex.getErrorCode()); assertEquals("message", ex.getMessage()); assertNull(ex.getCause()); assertTrue(ex.toString().contains("errorCode") && ex.toString().contains("message")); }
private void slaCommand(CommandLine commandLine) throws IOException, OozieCLIException { XOozieClient wc = createXOozieClient(commandLine); String s = commandLine.getOptionValue(OFFSET_OPTION); int start = Integer.parseInt((s != null) ? s : "0"); s = commandLine.getOptionValue(LEN_OPTION); int len = Integer.parseInt((s != null) ? s : "100"); String filter = commandLine.getOptionValue(FILTER_OPTION); try { wc.getSlaInfo(start, len, filter); } catch (OozieClientException ex) { throw new OozieCLIException(ex.toString(), ex); } }
@Override public String getJobLog() throws OozieClientException { try { return oozieClient.getJobLog( id ); } catch ( org.apache.oozie.client.OozieClientException e ) { throw new OozieClientException( e, e.getErrorCode() ); } }
@Override public Void call() throws Exception { String oozieUrl = getContextURL() + "dummy"; OozieClient wc = new OozieClient(oozieUrl); try { wc.getJobInfo(MockDagEngineService.JOB_ID + 1); fail(); } catch (OozieClientException e) { assertNotNull(e.getErrorCode()); assertNotNull(e.getMessage()); } return null; }
void storeLastCoordinators(final File outputDir, int numCoordinators, int maxChildActions) { if (numCoordinators == 0) { return; } try { final List<CoordinatorJob> jobs = client.getCoordJobsInfo(null, 0, numCoordinators); for (CoordinatorJob job : jobs) { getCoordJob(outputDir, job.getId(), maxChildActions); } } catch (OozieClientException e) { System.err.printf("Exception occurred during the retrieval of information on the last %d coordinator(s): %s.%n", numCoordinators, e.getMessage()); } }
/** * rerun <jobId> -action 1 -nocleanup. Coordinator job is killed, but actions are able to rerun. * * @throws Exception */ public void testCoordRerunKilledCoord() throws Exception { final String jobId = "0000000-" + new Date().getTime() + "-testCoordRerun-C"; final int actionNum = 1; final String actionId = jobId + "@" + actionNum; try { addRecordToJobTable(jobId, CoordinatorJob.Status.KILLED); addRecordToActionTable(jobId, actionNum, actionId, CoordinatorAction.Status.SUCCEEDED, "coord-rerun-action1.xml"); } catch (Exception e) { e.printStackTrace(); fail("Could not update db."); } try { final OozieClient coordClient = LocalOozie.getCoordClient(); coordClient.reRunCoord(jobId, RestConstants.JOB_COORD_SCOPE_ACTION, Integer.toString(actionNum), false, true); } catch (OozieClientException ex) { ex.printStackTrace(); fail("Coord rerun failed"); } CoordinatorActionBean action2 = getCoordinatorAction(actionId); assertEquals(action2.getStatus(), CoordinatorAction.Status.WAITING); }
assertTrue(e.getCause().getMessage().contains(ErrorCode.E0401.toString()));
private void slaCommand(CommandLine commandLine) throws IOException, OozieCLIException { XOozieClient wc = createXOozieClient(commandLine); String s = commandLine.getOptionValue(OFFSET_OPTION); int start = Integer.parseInt((s != null) ? s : "0"); s = commandLine.getOptionValue(LEN_OPTION); int len = Integer.parseInt((s != null) ? s : "100"); try { wc.getSlaInfo(start, len); } catch (OozieClientException ex) { throw new OozieCLIException(ex.toString(), ex); } }
@Override public String getProtocolUrl() throws OozieClientException { try { return delegate.getProtocolUrl(); } catch ( org.apache.oozie.client.OozieClientException e ) { throw new OozieClientException( e, e.getErrorCode() ); } }
void storeLastBundles(final File outputDir, int numBundles, int maxChildActions) { if (numBundles == 0) { return; } try { final List<BundleJob> jobs = client.getBundleJobsInfo(null, 0, numBundles); for (BundleJob job : jobs) { getBundleJob(outputDir, job.getId(), maxChildActions); } } catch (OozieClientException e) { System.err.printf("Exception occurred during the retrieval of information on the last %d bundle(s): %s.%n", numBundles, e.getMessage()); } }
public void testCoordRerunFailedCoordAction() throws Exception { final String jobId = "0000000-" + new Date().getTime() + "-testCoordRerun-C"; final int actionNum = 1; final String actionId = jobId + "@" + actionNum; try { addRecordToJobTable(jobId, CoordinatorJob.Status.RUNNING); addRecordToActionTable(jobId, actionNum, actionId, CoordinatorAction.Status.FAILED, "coord-rerun-action1.xml"); } catch (Exception e) { e.printStackTrace(); fail("Could not update db."); } try { final OozieClient coordClient = LocalOozie.getCoordClient(); coordClient.reRunCoord(jobId, RestConstants.JOB_COORD_SCOPE_ACTION, Integer.toString(actionNum), false, true); } catch (OozieClientException ex) { ex.printStackTrace(); fail("Coord rerun failed"); } CoordinatorActionBean action2 = getCoordinatorAction(actionId); assertEquals(action2.getStatus(), CoordinatorAction.Status.WAITING); assertEquals(action2.getErrorCode(), ""); assertEquals(action2.getErrorMessage(), ""); }
assertTrue(e.getCause().getMessage().contains(ErrorCode.E0807.toString()));
static void handleError(HttpURLConnection conn) throws IOException, OozieClientException { int status = conn.getResponseCode(); String error = conn.getHeaderField(RestConstants.OOZIE_ERROR_CODE); String message = conn.getHeaderField(RestConstants.OOZIE_ERROR_MESSAGE); if (error == null) { error = "HTTP error code: " + status; } if (message == null) { message = conn.getResponseMessage(); } throw new OozieClientException(error, message); }
public void testErrorCodeCause() { OozieClientException ex = new OozieClientException("errorCode", new Exception("message")); assertEquals("errorCode", ex.getErrorCode()); assertTrue(ex.getMessage().contains("message")); assertNotNull(ex.getCause()); assertTrue(ex.toString().contains("errorCode") && ex.toString().contains("message")); }
private void slaCommand(CommandLine commandLine) throws IOException, OozieCLIException { XOozieClient wc = createXOozieClient(commandLine); String s = commandLine.getOptionValue(OFFSET_OPTION); int start = Integer.parseInt((s != null) ? s : "0"); s = commandLine.getOptionValue(LEN_OPTION); int len = Integer.parseInt((s != null) ? s : "100"); try { wc.getSlaInfo(start, len); } catch (OozieClientException ex) { throw new OozieCLIException(ex.toString(), ex); } }
@Override public String getJobLog() throws OozieClientException { try { return oozieClient.getJobLog( id ); } catch ( org.apache.oozie.client.OozieClientException e ) { throw new OozieClientException( e, e.getErrorCode() ); } }
void storeLastWorkflows(final File outputDir, int numWorkflows, int maxChildActions) { if (numWorkflows == 0) { return; } try { final List<WorkflowJob> jobs = client.getJobsInfo(null, 0, numWorkflows); for (WorkflowJob job : jobs) { storeWorkflowJobDetails(outputDir, job.getId(), maxChildActions); } } catch (OozieClientException e) { System.err.printf("Exception occurred during the retrieval of information on the last %d workflow(s): %s.%n", numWorkflows, e.getMessage()); } }
static void handleError(HttpURLConnection conn) throws IOException, OozieClientException { int status = conn.getResponseCode(); String error = conn.getHeaderField(RestConstants.OOZIE_ERROR_CODE); String message = conn.getHeaderField(RestConstants.OOZIE_ERROR_MESSAGE); if (error == null) { error = "HTTP error code: " + status; } if (message == null) { message = conn.getResponseMessage(); } throw new OozieClientException(error, message); }
public void testErrorCodeMessageCause() { OozieClientException ex = new OozieClientException("errorCode", "message", new Exception()); assertEquals("errorCode", ex.getErrorCode()); assertTrue(ex.getMessage().contains("message")); assertNotNull(ex.getCause()); assertTrue(ex.toString().contains("errorCode") && ex.toString().contains("message")); }