List of usage examples for org.springframework.batch.core.step NoSuchStepException NoSuchStepException
public NoSuchStepException(String message)
From source file:com.xchanging.support.batch.admin.service.SimpleJobService.java
public Collection<StepExecution> listStepExecutionsForStep(String jobName, String stepName, int start, int count) throws NoSuchStepException { if (stepExecutionDao.countStepExecutions(jobName, stepName) == 0) { throw new NoSuchStepException("No step executions exist with this step name: " + stepName); }/* w ww .j a v a2 s.co m*/ return stepExecutionDao.findStepExecutions(jobName, stepName, start, count); }
From source file:admin.service.SimpleJobService.java
@Override public Collection<StepExecution> listStepExecutionsForStep(String jobName, String stepName, int start, int count) throws NoSuchStepException { if (stepExecutionDao.countStepExecutions(jobName, stepName) == 0) { throw new NoSuchStepException("No step executions exist with this step name: " + stepName); }// w w w . ja v a 2 s . com return stepExecutionDao.findStepExecutions(jobName, stepName, start, count); }
From source file:org.trpr.platform.batch.impl.spring.admin.SimpleJobService.java
/** * Interface method implementation// w ww .j ava 2 s .c o m * @see org.springframework.batch.admin.service.JobService#listStepExecutionsForStep(java.lang.String, java.lang.String, int, int) */ public Collection<StepExecution> listStepExecutionsForStep(String jobName, String stepName, int start, int count) throws NoSuchStepException { if (this.countStepExecutionsForStep(jobName, stepName) == 0) { throw new NoSuchStepException("No step executions exist with this step name: " + stepName); } List<StepExecution> steps = new LinkedList<StepExecution>(); for (String name : this.jobRegistry.getJobNames()) { if (name.contains(jobName)) { for (JobInstance jobInstance : this.jobExplorer.getJobInstances(jobName, 0, Integer.MAX_VALUE)) { for (JobExecution jobExecution : this.jobExplorer.getJobExecutions(jobInstance)) { Collection<StepExecution> stepExecutions = jobExecution.getStepExecutions(); for (StepExecution step : stepExecutions) { if (step.getStepName().contains(stepName)) { steps.add(step); } } } } } } if (start >= steps.size()) { return new LinkedList<StepExecution>(); // return empty list instead of a sub-list } if (start + count >= steps.size()) { count = steps.size() - start; } return steps.subList(start, count); }
From source file:org.springframework.cloud.task.batch.partition.DeployerStepExecutionHandler.java
@Override public void run(String... args) throws Exception { validateRequest();/*from w ww. ja v a 2 s .c o m*/ Long jobExecutionId = Long .parseLong(environment.getProperty(DeployerPartitionHandler.SPRING_CLOUD_TASK_JOB_EXECUTION_ID)); Long stepExecutionId = Long .parseLong(environment.getProperty(DeployerPartitionHandler.SPRING_CLOUD_TASK_STEP_EXECUTION_ID)); StepExecution stepExecution = jobExplorer.getStepExecution(jobExecutionId, stepExecutionId); if (stepExecution == null) { throw new NoSuchStepException(String.format( "No StepExecution could be located for step execution id %s within job execution %s", stepExecutionId, jobExecutionId)); } String stepName = environment.getProperty(DeployerPartitionHandler.SPRING_CLOUD_TASK_STEP_NAME); Step step = stepLocator.getStep(stepName); try { logger.debug(String.format("Executing step %s with step execution id %s and job execution id %s", stepExecution.getStepName(), stepExecutionId, jobExecutionId)); step.execute(stepExecution); } catch (JobInterruptedException e) { stepExecution.setStatus(BatchStatus.STOPPED); jobRepository.update(stepExecution); } catch (Throwable e) { stepExecution.addFailureException(e); stepExecution.setStatus(BatchStatus.FAILED); jobRepository.update(stepExecution); } }
From source file:org.springframework.yarn.batch.container.DefaultBatchYarnContainer.java
@Override protected void runInternal() { Long jobExecutionId = safeParse(getEnvironment(YarnSystemConstants.AMSERVICE_BATCH_JOBEXECUTIONID)); Long stepExecutionId = safeParse(getEnvironment(YarnSystemConstants.AMSERVICE_BATCH_STEPEXECUTIONID)); String stepName = getEnvironment(YarnSystemConstants.AMSERVICE_BATCH_STEPNAME); if (log.isDebugEnabled()) { log.debug("Requesting StepExecution: " + jobExecutionId + " / " + stepExecutionId); }//ww w . j ava 2s. c om StepExecution stepExecution = getJobExplorer().getStepExecution(jobExecutionId, stepExecutionId); if (stepExecution == null) { throw new NoSuchStepException("No StepExecution could be located for this request: "); } if (log.isDebugEnabled()) { log.debug("Got StepExecution: " + stepExecution); log.debug("Locating Step: " + stepName); } Step step = getStepLocator().getStep(stepName); if (log.isDebugEnabled()) { log.debug("Located step: " + step); } if (step == null) { throw new NoSuchStepException(String.format("No Step with name [%s] could be located.", stepName)); } try { if (log.isDebugEnabled()) { log.debug("Executing step: " + step + " / " + stepExecution); } step.execute(stepExecution); } catch (JobInterruptedException e) { log.error("error executing step 1", e); stepExecution.setStatus(BatchStatus.STOPPED); } catch (Throwable e) { log.error("error executing step 2", e); stepExecution.addFailureException(e); stepExecution.setStatus(BatchStatus.FAILED); } if (log.isDebugEnabled()) { log.debug("Finished remote step run, status is " + stepExecution.getStatus()); } MindAppmasterServiceClient client = (MindAppmasterServiceClient) getIntegrationServiceClient(); PartitionedStepExecutionStatusReq req = new PartitionedStepExecutionStatusReq(); req.stepExecution = JobRepositoryRpcFactory.convertStepExecutionType(stepExecution); BaseResponseObject doMindRequest = client.doMindRequest(req); log.info("got response for status update: " + doMindRequest); }