public void testGetJobInfoForTextAndStatus() throws Exception { BundleJobBean bundleJob = addRecordToBundleJobTable(BundleJob.Status.RUNNING, false); bundleJob.setAppName("bundle-job-1"); BundleJobQueryExecutor.getInstance().executeUpdate(BundleJobQueryExecutor.BundleJobQuery.UPDATE_BUNDLE_JOB, bundleJob); Map<String, List<String>> filter = new HashMap<String, List<String>>(); List<String> textFilterList = new ArrayList<String>(); textFilterList.add("bundle-job-1"); List<String> textStatusList = new ArrayList<String>(); textStatusList.add(BundleJob.Status.RUNNING.toString()); filter.put(OozieClient.FILTER_TEXT, textFilterList); filter.put(OozieClient.FILTER_STATUS, textStatusList); JPAService jpaService = Services.get().get(JPAService.class); BundleJobInfoGetJPAExecutor bundleInfoGetCmd = new BundleJobInfoGetJPAExecutor(filter, 1, 20); BundleJobInfo bundleJobsInfo = jpaService.execute(bundleInfoGetCmd); assertEquals(1, bundleJobsInfo.getBundleJobs().size()); }
public void testGetJobInfoForTextAndStatus() throws Exception { CoordinatorJobBean coordinatorJob = addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, false, false); coordinatorJob.setAppName("coord-job-1"); CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQueryExecutor.CoordJobQuery.UPDATE_COORD_JOB, coordinatorJob); Map<String, List<String>> filter = new HashMap<String, List<String>>(); List<String> textFilterList = new ArrayList<String>(); textFilterList.add("coord-job-1"); List<String> textStatusList = new ArrayList<String>(); textStatusList.add(CoordinatorJob.Status.RUNNING.toString()); filter.put(OozieClient.FILTER_TEXT, textFilterList); filter.put(OozieClient.FILTER_STATUS, textStatusList); JPAService jpaService = Services.get().get(JPAService.class); CoordJobInfoGetJPAExecutor coordInfoGetCmd = new CoordJobInfoGetJPAExecutor(filter, 1, 20); CoordinatorJobInfo coordJobsInfo = jpaService.execute(coordInfoGetCmd); assertEquals(1, coordJobsInfo.getCoordJobs().size()); }
public Void call() throws Exception { String oozieUrl = getContextURL(); OozieClient wc = new OozieClient(oozieUrl); String jobId = MockDagEngineService.JOB_ID + "1" + MockDagEngineService.JOB_ID_END; assertEquals(RestConstants.JOB_SHOW_LOG, wc.getJobLog(jobId)); WorkflowAction wfAction = wc.getWorkflowActionInfo(jobId); assertEquals(jobId, wfAction.getId()); CoordinatorJob job = wc.getCoordJobInfo(MockCoordinatorEngineService.JOB_ID + "1" + MockCoordinatorEngineService.JOB_ID_END); assertEquals("group", job.getAcl()); assertEquals("RUNNING", job.getStatus().toString()); assertEquals("user", job.getUser()); assertEquals(MockCoordinatorEngineService.offset, new Integer(1)); assertEquals(MockCoordinatorEngineService.length, new Integer(1000)); BundleJob bundleJob = wc.getBundleJobInfo(jobId); assertEquals("SUCCEEDED", bundleJob.getStatus().toString()); assertEquals("user", bundleJob.getUser()); return null; } });
@Override protected void eagerVerifyPrecondition() throws CommandException, PreconditionException { validateChangeValue(changeValue); if (bundleJob == null) { LOG.info("BundleChangeCommand not succeeded - " + "job " + jobId + " does not exist"); throw new PreconditionException(ErrorCode.E1314, jobId); } if (isChangePauseTime) { if (bundleJob.getStatus() == Job.Status.SUCCEEDED || bundleJob.getStatus() == Job.Status.FAILED || bundleJob.getStatus() == Job.Status.KILLED || bundleJob.getStatus() == Job.Status.DONEWITHERROR) { LOG.info("BundleChangeCommand not succeeded for changing pausetime- " + "job " + jobId + " finished, status is " + bundleJob.getStatusStr()); throw new PreconditionException(ErrorCode.E1312, jobId, bundleJob.getStatus().toString()); } } else if(isChangeEndTime){ if (bundleJob.getStatus() == Job.Status.KILLED) { LOG.info("BundleChangeCommand not succeeded for changing endtime- " + "job " + jobId + " finished, status is " + bundleJob.getStatusStr()); throw new PreconditionException(ErrorCode.E1312, jobId, bundleJob.getStatus().toString()); } } } }
private void persistBundleJobInfo(final BundleJob job, final DiagBundleEntryWriter bundleEntryWriter) throws IOException { bundleEntryWriter.writeString("BUNDLE\n") .writeString("-----------\n") .writeStringValue("Bundle Id : ", job.getId()) .writeStringValue("Name : ", job.getAppName()) .writeStringValue("App Path : ", job.getAppPath()) .writeStringValue("User : ", job.getUser()) .writeStringValue("Status : ", job.getStatus().toString()) .writeDateValue("Created Time : ", job.getCreatedTime()) .writeDateValue("Start Time : ", job.getStartTime()) .writeDateValue("End Time : ", job.getEndTime()) .writeDateValue("KickoffTime : ", job.getKickoffTime()) .writeDateValue("Pause Time : ", job.getPauseTime()) .writeIntValue("Timeout : ", job.getTimeout()) .writeStringValue("Console URL : ", job.getConsoleUrl()) .writeStringValue( "ACL : ", job.getAcl()) .flush(); }
@Override public void onCoordinatorJobEvent(CoordinatorJobEvent event) { sendEventToSLAService(event, event.getStatus().toString()); }
@Override public void setStatus(Status val) { this.statusStr = val.toString(); }
/** * Set the Status of the Bundle Action * * @param val the status to set */ public void setStatus(Status val) { this.statusStr = val.toString(); }
@Override protected void verifyPrecondition() throws CommandException, PreconditionException { super.eagerVerifyPrecondition(); if (coordJob.getStatus() == CoordinatorJob.Status.SUCCEEDED || coordJob.getStatus() == CoordinatorJob.Status.FAILED || coordJob.getStatus() == CoordinatorJob.Status.KILLED || coordJob.getStatus() == CoordinatorJob.Status.IGNORED) { LOG.info("CoordSuspendXCommand is not going to execute because " + "job finished or failed or killed, id = " + jobId + ", status = " + coordJob.getStatus()); throw new PreconditionException(ErrorCode.E0728, jobId, coordJob.getStatus().toString()); } }
/** * Set status * * @param status the status to set */ public void setStatus(Status status) { this.statusStr = status.toString(); }
private void checkCoordJobs(String jobId, CoordinatorJob.Status expectedStatus) { try { CoordinatorJobBean job = jpaService.execute(new CoordJobGetJPAExecutor(jobId)); if (job.getStatus() != expectedStatus) { fail("CoordJobMatLookupCommand didn't work because the status for job id" + jobId + " is : " + job.getStatusStr() + "; however expected status is : " + expectedStatus.toString()); } } catch (JPAExecutorException se) { fail("Job ID " + jobId + " was not stored properly in db"); } }
@Override public void setStatus(Status val) { this.statusStr = val.toString(); }
@Override public void onCoordinatorJobEvent(CoordinatorJobEvent event) { sendEventToSLAService(event, event.getStatus().toString()); }
/** * Set the Status of the Bundle Action * * @param val the status to set */ public void setStatus(Status val) { this.statusStr = val.toString(); }
@Override protected void verifyPrecondition() throws CommandException, PreconditionException { super.eagerVerifyPrecondition(); if (coordJob.getStatus() == CoordinatorJob.Status.SUCCEEDED || coordJob.getStatus() == CoordinatorJob.Status.FAILED || coordJob.getStatus() == CoordinatorJob.Status.KILLED || coordJob.getStatus() == CoordinatorJob.Status.IGNORED) { LOG.info("CoordSuspendXCommand is not going to execute because " + "job finished or failed or killed, id = " + jobId + ", status = " + coordJob.getStatus()); throw new PreconditionException(ErrorCode.E0728, jobId, coordJob.getStatus().toString()); } }
public boolean evaluate() throws Exception { List<WorkflowActionBean> actions = jpaService.execute(actionsGetExecutor); WorkflowActionBean action = null; for (WorkflowActionBean bean : actions) { if (bean.getName().contains("hadoop")) { action = bean; break; } } return action.getStatus().toString().equalsIgnoreCase(Job.Status.RUNNING.toString()); } });
@Override protected void verifyPrecondition() throws CommandException, PreconditionException { if (bundleJob.getStatus() == Job.Status.SUCCEEDED || bundleJob.getStatus() == Job.Status.FAILED || bundleJob.getStatus() == Job.Status.KILLED || bundleJob.getStatus() == Job.Status.DONEWITHERROR) { LOG.info("BundleJobSuspendXCommand is not going to execute because job either succeeded, failed, killed," + " or donewitherror; id = " + jobId + ", status = " + bundleJob.getStatus()); throw new PreconditionException(ErrorCode.E1312, jobId, bundleJob.getStatus().toString()); } }
/** * Set status * * @param status the status to set */ public void setStatus(Status status) { this.statusStr = status.toString(); }
@Override public String getJobStatus(String jobId) throws CoordinatorEngineException { did = RestConstants.JOB_SHOW_STATUS; int idx = validateCoordinatorIdx(jobId); return coordJobs.get(idx).getStatus().toString(); }
@Override protected void verifyPrecondition() throws CommandException, PreconditionException { if (bundleJob.getStatus() == Job.Status.SUCCEEDED || bundleJob.getStatus() == Job.Status.FAILED || bundleJob.getStatus() == Job.Status.KILLED || bundleJob.getStatus() == Job.Status.DONEWITHERROR) { LOG.info("BundleJobSuspendXCommand is not going to execute because job either succeeded, failed, killed," + " or donewitherror; id = " + jobId + ", status = " + bundleJob.getStatus()); throw new PreconditionException(ErrorCode.E1312, jobId, bundleJob.getStatus().toString()); } }