org.springframework.batch.core.launch.NoSuchJobExecutionException Java Examples

The following examples show how to use org.springframework.batch.core.launch.NoSuchJobExecutionException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ResponseExceptionHandler.java    From spring-batch-rest with Apache License 2.0 6 votes vote down vote up
@ExceptionHandler(BatchRuntimeException.class)
protected ResponseEntity<Object> handleBatchRuntimeException(BatchRuntimeException e, WebRequest request) {
    log.error("Request {} failed with {}", request, e);
    Throwable cause = e.getCause();
    HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR;
    if (cause instanceof DuplicateJobException
            || cause instanceof JobExecutionAlreadyRunningException
            || cause instanceof JobInstanceAlreadyCompleteException)
        status = HttpStatus.CONFLICT;
    else if (cause instanceof JobParametersInvalidException
        || cause instanceof JobParametersNotFoundException)
        status = HttpStatus.BAD_REQUEST;
    else if (cause instanceof NoSuchJobException
        || cause instanceof NoSuchJobExecutionException
        || cause instanceof NoSuchJobInstanceException)
        status = HttpStatus.NOT_FOUND;

    ApiError apiError = new ApiError(status.toString(), cause.getMessage(), cause.getClass().getSimpleName(), e.getMessage());
    return handleExceptionInternal(e, apiError, new HttpHeaders(), status, request);
}
 
Example #2
Source File: SimpleJobService.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
@Override
public JobExecution stop(Long jobExecutionId) throws NoSuchJobExecutionException, JobExecutionNotRunningException {
	JobExecution jobExecution = getJobExecution(jobExecutionId);
	if (!jobExecution.isRunning()) {
		throw new JobExecutionNotRunningException("JobExecution is not running and therefore cannot be stopped");
	}

	logger.info("Stopping job execution: " + jobExecution);

	Collection<String> jsrJobNames = getJsrJobNames();

	if (jsrJobOperator != null && jsrJobNames.contains(jobExecution.getJobInstance().getJobName())) {
		jsrJobOperator.stop(jobExecutionId);
		jobExecution = getJobExecution(jobExecutionId);
	}
	else {
		jobExecution.stop();
		jobRepository.update(jobExecution);
	}
	return jobExecution;

}
 
Example #3
Source File: SimpleJobService.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
@Override
public JobExecution getJobExecution(Long jobExecutionId) throws NoSuchJobExecutionException {
	JobExecution jobExecution = jobExecutionDao.getJobExecution(jobExecutionId);
	if (jobExecution == null) {
		throw new NoSuchJobExecutionException("There is no JobExecution with id=" + jobExecutionId);
	}
	jobExecution.setJobInstance(jobInstanceDao.getJobInstance(jobExecution));
	try {
		jobExecution.setExecutionContext(executionContextDao.getExecutionContext(jobExecution));
	}
	catch (Exception e) {
		logger.info("Cannot load execution context for job execution: " + jobExecution);
	}
	stepExecutionDao.addStepExecutions(jobExecution);
	return jobExecution;
}
 
Example #4
Source File: DefaultTaskJobService.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
@Override
public List<TaskJobExecution> listJobExecutions(Pageable pageable) throws NoSuchJobExecutionException {
	Assert.notNull(pageable, "pageable must not be null");
	List<JobExecution> jobExecutions = new ArrayList<>(
			jobService.listJobExecutions(getPageOffset(pageable), pageable.getPageSize()));
	for (JobExecution jobExecution : jobExecutions) {
		Collection<StepExecution> stepExecutions = jobService.getStepExecutions(jobExecution.getId());
		List<StepExecution> validStepExecutions = new ArrayList<>();
		for (StepExecution stepExecution : stepExecutions) {
			if (stepExecution.getId() != null) {
				validStepExecutions.add(stepExecution);
			}
		}
		jobExecution.addStepExecutions(validStepExecutions);
	}
	return getTaskJobExecutionsForList(jobExecutions);
}
 
Example #5
Source File: SimpleJobService.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
@Override
public StepExecution getStepExecution(Long jobExecutionId, Long stepExecutionId)
		throws NoSuchJobExecutionException, NoSuchStepExecutionException {
	JobExecution jobExecution = getJobExecution(jobExecutionId);
	StepExecution stepExecution = stepExecutionDao.getStepExecution(jobExecution, stepExecutionId);
	if (stepExecution == null) {
		throw new NoSuchStepExecutionException("There is no StepExecution with jobExecutionId=" + jobExecutionId
				+ " and id=" + stepExecutionId);
	}
	try {
		stepExecution.setExecutionContext(executionContextDao.getExecutionContext(stepExecution));
	}
	catch (Exception e) {
		logger.info("Cannot load execution context for step execution: " + stepExecution);
	}
	return stepExecution;
}
 
Example #6
Source File: SimpleJobService.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
/**
 * Check all the active executions and see if they are still actually running. Remove the
 * ones that have completed.
 */
@Scheduled(fixedDelay = 60000)
public void removeInactiveExecutions() {

	for (Iterator<JobExecution> iterator = activeExecutions.iterator(); iterator.hasNext();) {
		JobExecution jobExecution = iterator.next();
		try {
			jobExecution = getJobExecution(jobExecution.getId());
		}
		catch (NoSuchJobExecutionException e) {
			logger.error("Unexpected exception loading JobExecution", e);
		}
		if (!jobExecution.isRunning()) {
			iterator.remove();
		}
	}

}
 
Example #7
Source File: JobOperationsController.java    From spring-boot-starter-batch-web with Apache License 2.0 6 votes vote down vote up
@RequestMapping(value = "/jobs/executions/{executionId}/log", method = RequestMethod.GET)
public void getLogFile(HttpServletResponse response, @PathVariable long executionId)
		throws NoSuchJobExecutionException, IOException {
	if (LOG.isDebugEnabled()) {
		LOG.debug("Get log file for job with executionId: {}", executionId);
	}
	String loggingPath = createLoggingPath();
	JobExecution jobExecution = jobExplorer.getJobExecution(executionId);
	if (jobExecution == null) {
		throw new NoSuchJobExecutionException("JobExecution with id " + executionId + " not found.");
	}
	File downloadFile = new File(loggingPath + jobLogFileNameCreator.getName(jobExecution));
	InputStream is = new FileInputStream(downloadFile);
	FileCopyUtils.copy(is, response.getOutputStream());
	response.flushBuffer();
}
 
Example #8
Source File: JobExecutionController.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
/**
 * Retrieve all task job executions with the task name specified
 *
 * @param jobName name of the job. SQL server specific wildcards are enabled (eg.: myJob%,
 *     m_Job, ...)
 * @param pageable page-able collection of {@code TaskJobExecution}s.
 * @param assembler for the {@link TaskJobExecution}s
 * @return list task/job executions with the specified jobName.
 * @throws NoSuchJobException if the job with the given name does not exist.
 */
@RequestMapping(value = "", method = RequestMethod.GET, produces = "application/json")
@ResponseStatus(HttpStatus.OK)
public PagedModel<JobExecutionResource> retrieveJobsByParameters(
		@RequestParam(value = "name", required = false) String jobName,
		@RequestParam(value = "status", required = false) BatchStatus status,
		Pageable pageable, PagedResourcesAssembler<TaskJobExecution> assembler) throws NoSuchJobException, NoSuchJobExecutionException {
	List<TaskJobExecution> jobExecutions;
	Page<TaskJobExecution> page;

	if (jobName == null && status == null) {
		jobExecutions = taskJobService.listJobExecutions(pageable);
		page = new PageImpl<>(jobExecutions, pageable, taskJobService.countJobExecutions());
	} else {
		jobExecutions = taskJobService.listJobExecutionsForJob(pageable, jobName, status);
		page = new PageImpl<>(jobExecutions, pageable,
				taskJobService.countJobExecutionsForJob(jobName, status));
	}

	return assembler.toModel(page, jobAssembler);
}
 
Example #9
Source File: RestControllerAdvice.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
/**
 * Log the exception message at warn level and stack trace as trace level. Return
 * response status HttpStatus.NOT_FOUND
 *
 * @param e one of the exceptions, {@link NoSuchAuditRecordException},
 * {@link NoSuchStreamDefinitionException},
 * {@link NoSuchAppRegistrationException}, {@link NoSuchTaskDefinitionException},
 * {@link NoSuchTaskExecutionException}, {@link NoSuchJobExecutionException},
 * {@link NoSuchJobInstanceException}, {@link NoSuchJobException},
 * {@link NoSuchStepExecutionException},
 * {@link NoSuchAppException}, or
 * {@link NoSuchAppInstanceException}
 * @return the error response in JSON format with media type
 * application/vnd.error+json
 */
@ExceptionHandler({ NoSuchAuditRecordException.class,
		NoSuchStreamDefinitionException.class, NoSuchAppRegistrationException.class,
		NoSuchTaskDefinitionException.class, NoSuchTaskExecutionException.class, NoSuchJobExecutionException.class,
		NoSuchJobInstanceException.class, NoSuchJobException.class, NoSuchStepExecutionException.class,
		NoSuchTaskBatchException.class, NoSuchAppException.class, NoSuchAppInstanceException.class,
		NoSuchScheduleException.class })
@ResponseStatus(HttpStatus.NOT_FOUND)
@ResponseBody
public VndErrors onNotFoundException(Exception e) {
	String logref = logWarnLevelExceptionMessage(e);
	if (logger.isTraceEnabled()) {
		logTraceLevelStrackTrace(e);
	}
	String msg = getExceptionMessage(e);
	return new VndErrors(logref, msg);
}
 
Example #10
Source File: RestControllerAdvice.java    From spring-cloud-dashboard with Apache License 2.0 6 votes vote down vote up
/**
 * Log the exception message at warn level and stack trace as trace level.
 * Return response status HttpStatus.NOT_FOUND
 */
@ExceptionHandler({NoSuchAppRegistrationException.class,
		NoSuchTaskDefinitionException.class,
		NoSuchTaskExecutionException.class,
		NoSuchJobExecutionException.class,
		NoSuchJobInstanceException.class,
		NoSuchJobException.class,
		NoSuchStepExecutionException.class,
		MetricsMvcEndpoint.NoSuchMetricException.class})
@ResponseStatus(HttpStatus.NOT_FOUND)
@ResponseBody
public VndErrors onNotFoundException(Exception e) {
	String logref = logWarnLevelExceptionMessage(e);
	if (logger.isTraceEnabled()) {
		logTraceLevelStrackTrace(e);
	}
	String msg = getExceptionMessage(e);
	return new VndErrors(logref, msg);
}
 
Example #11
Source File: JobOperationsController.java    From spring-boot-starter-batch-web with Apache License 2.0 5 votes vote down vote up
@RequestMapping(value = "/jobs/executions/{executionId}", method = RequestMethod.DELETE)
public String stop(@PathVariable long executionId)
		throws NoSuchJobExecutionException, JobExecutionNotRunningException {
	if (LOG.isDebugEnabled()) {
		LOG.debug("Stop JobExecution with id: {}", executionId);
	}
	Boolean successful = jobOperator.stop(executionId);
	return successful.toString();
}
 
Example #12
Source File: JobExecutionController.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
/**
 * View the details of a single task execution, specified by id.
 *
 * @param id the id of the requested {@link JobExecution}
 * @return the {@link JobExecution}
 * @throws NoSuchJobExecutionException if the specified job execution for the id does not
 *     exist.
 */
@RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = "application/json")
@ResponseStatus(HttpStatus.OK)
public JobExecutionResource view(@PathVariable("id") long id) throws NoSuchJobExecutionException {
	TaskJobExecution jobExecution = taskJobService.getJobExecution(id);
	if (jobExecution == null) {
		throw new NoSuchJobExecutionException(String.format("No Job Execution with id of %d exits", id));
	}
	return jobAssembler.toModel(jobExecution);
}
 
Example #13
Source File: JobOperationsController.java    From spring-boot-starter-batch-web with Apache License 2.0 5 votes vote down vote up
@RequestMapping(value = "/jobs/executions/{executionId}", method = RequestMethod.GET)
public String getStatus(@PathVariable long executionId) throws NoSuchJobExecutionException {
	if (LOG.isDebugEnabled()) {
		LOG.debug("Get ExitCode for JobExecution with id: {} ", executionId);
	}
	JobExecution jobExecution = jobExplorer.getJobExecution(executionId);
	if (jobExecution != null) {
		return jobExecution.getExitStatus().getExitCode();
	} else {
		throw new NoSuchJobExecutionException("JobExecution with id " + executionId + " not found.");
	}
}
 
Example #14
Source File: JobMonitoringController.java    From spring-boot-starter-batch-web with Apache License 2.0 5 votes vote down vote up
@RequestMapping(value = "/jobs/executions/{executionId}", method = RequestMethod.GET)
public JobExecution findExecution(@PathVariable long executionId) throws NoSuchJobExecutionException {
	JobExecution jobExecution = jobExplorer.getJobExecution(executionId);
	if (jobExecution == null) {
		throw new NoSuchJobExecutionException("JobExecution with id " + executionId + " not found.");
	}
	return jobExecution;
}
 
Example #15
Source File: DefaultJobServiceTest.java    From spring-batch-lightmin with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Test(expected = SpringBatchLightminApplicationException.class)
public void stopJobExecutionExceptionTest() throws JobParametersInvalidException, JobRestartException,
        JobInstanceAlreadyCompleteException, NoSuchJobExecutionException, NoSuchJobException,
        JobExecutionNotRunningException {
    final Long jobExecutionId = 10L;
    when(this.jobOperator.stop(jobExecutionId)).thenThrow(NoSuchJobExecutionException.class);
    this.jobService.stopJobExecution(jobExecutionId);
}
 
Example #16
Source File: DefaultJobServiceTest.java    From spring-batch-lightmin with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Test(expected = SpringBatchLightminApplicationException.class)
public void restartJobExecutionExceptionTest() throws JobParametersInvalidException, JobRestartException,
        JobInstanceAlreadyCompleteException, NoSuchJobExecutionException, NoSuchJobException {
    final Long jobExecutionId = 10L;
    when(this.jobOperator.restart(jobExecutionId)).thenThrow(NoSuchJobExecutionException.class);
    this.jobService.restartJobExecution(jobExecutionId);
}
 
Example #17
Source File: DefaultTaskJobService.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
@Override
public void restartJobExecution(long jobExecutionId) throws NoSuchJobExecutionException {
	logger.info("Restarting Job with Id " + jobExecutionId);

	final TaskJobExecution taskJobExecution = this.getJobExecution(jobExecutionId);
	final JobExecution jobExecution = taskJobExecution.getJobExecution();

	if (!JobUtils.isJobExecutionRestartable(taskJobExecution.getJobExecution())) {
		throw new JobNotRestartableException(
				String.format("JobExecution with Id '%s' and state '%s' is not " + "restartable.",
						jobExecution.getId(), taskJobExecution.getJobExecution().getStatus()));
	}

	TaskExecution taskExecution = this.taskExplorer.getTaskExecution(taskJobExecution.getTaskId());
	TaskDefinition taskDefinition = this.taskDefinitionRepository.findById(taskExecution.getTaskName())
			.orElseThrow(() -> new NoSuchTaskDefinitionException(taskExecution.getTaskName()));

	String platformName = taskJobExecution.getJobExecution().getJobParameters().getString("-spring.cloud.data.flow.platformname");
	if (platformName != null) {
		Map<String, String> deploymentProperties = new HashMap<>();
		deploymentProperties.put(DefaultTaskExecutionService.TASK_PLATFORM_NAME, platformName);
		taskExecutionService.executeTask(taskDefinition.getName(), deploymentProperties,
				restartExecutionArgs(taskExecution.getArguments(),
						taskJobExecution.getJobExecution().getJobParameters()));
	} else {
		throw new IllegalStateException(String.format("Did not find platform for taskName=[%s] , taskId=[%s]",
				taskExecution.getTaskName(),taskJobExecution.getTaskId()));
	}

}
 
Example #18
Source File: SimpleJobService.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
@Override
public JobExecution abandon(Long jobExecutionId) throws NoSuchJobExecutionException,
		JobExecutionAlreadyRunningException {

	JobExecution jobExecution = getJobExecution(jobExecutionId);
	if (jobExecution.getStatus().isLessThan(BatchStatus.STOPPING)) {
		throw new JobExecutionAlreadyRunningException(
				"JobExecution is running or complete and therefore cannot be aborted");
	}

	logger.info("Aborting job execution: " + jobExecution);

	Collection<String> jsrJobNames = getJsrJobNames();

	JobInstance jobInstance = jobExecution.getJobInstance();
	if (jsrJobOperator != null && jsrJobNames.contains(jobInstance.getJobName())) {
		jsrJobOperator.abandon(jobExecutionId);
		jobExecution = getJobExecution(jobExecutionId);
	}
	else {
		jobExecution.upgradeStatus(BatchStatus.ABANDONED);
		jobExecution.setEndTime(new Date());
		jobRepository.update(jobExecution);
	}

	return jobExecution;

}
 
Example #19
Source File: JobMonitoringController.java    From spring-boot-starter-batch-web with Apache License 2.0 4 votes vote down vote up
@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler(NoSuchJobExecutionException.class)
public String handleNotFound(Exception ex) {
	LOG.warn("JobExecution not found.", ex);
	return ex.getMessage();
}
 
Example #20
Source File: JobOperationsController.java    From spring-boot-starter-batch-web with Apache License 2.0 4 votes vote down vote up
@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler({ NoSuchJobException.class, NoSuchJobExecutionException.class, JobStartException.class })
public String handleNotFound(Exception ex) {
	LOG.warn("Job or JobExecution not found.", ex);
	return ex.getMessage();
}
 
Example #21
Source File: ResponseExceptionHandler.java    From spring-batch-rest with Apache License 2.0 4 votes vote down vote up
@ExceptionHandler(javax.batch.operations.NoSuchJobExecutionException.class)
protected ResponseEntity<Object> handleNoSuchJobExecutionException(javax.batch.operations.NoSuchJobExecutionException e, WebRequest request) {
    HttpStatus status = HttpStatus.NOT_FOUND;
    return handleExceptionInternal(e, new ApiError(status.toString(), e.getMessage(), e.getClass().getSimpleName(), ""), new HttpHeaders(), status, request);
}
 
Example #22
Source File: DefaultTaskJobService.java    From spring-cloud-dataflow with Apache License 2.0 4 votes vote down vote up
@Override
public void stopJobExecution(long jobExecutionId)
		throws NoSuchJobExecutionException, JobExecutionNotRunningException {
	this.jobService.stop(jobExecutionId).getStatus();
}
 
Example #23
Source File: DefaultTaskJobService.java    From spring-cloud-dataflow with Apache License 2.0 4 votes vote down vote up
@Override
public TaskJobExecution getJobExecution(long id) throws NoSuchJobExecutionException {
	JobExecution jobExecution = jobService.getJobExecution(id);
	return getTaskJobExecution(jobExecution);
}
 
Example #24
Source File: JobExecutionThinController.java    From spring-cloud-dataflow with Apache License 2.0 3 votes vote down vote up
/**
 * Return a page-able list of {@link JobExecutionThinResource} defined jobs that
 * do not contain step execution detail.
 *
 * @param pageable page-able collection of {@code TaskJobExecution}s.
 * @param assembler for the {@link TaskJobExecution}s
 * @return a list of Task/Job executions(job executions do not contain step executions.
 * @throws NoSuchJobExecutionException in the event that a job execution id specified
 * is not present when looking up stepExecutions for the result.
 */
@RequestMapping(value = "", method = RequestMethod.GET, produces = "application/json")
@ResponseStatus(HttpStatus.OK)
public PagedModel<JobExecutionThinResource> listJobsOnly(Pageable pageable,
		PagedResourcesAssembler<TaskJobExecution> assembler) throws NoSuchJobExecutionException {
	List<TaskJobExecution> jobExecutions = taskJobService.listJobExecutionsWithStepCount(pageable);
	Page<TaskJobExecution> page = new PageImpl<>(jobExecutions, pageable, taskJobService.countJobExecutions());
	return assembler.toModel(page, jobAssembler);
}
 
Example #25
Source File: SimpleJobService.java    From spring-cloud-dataflow with Apache License 2.0 3 votes vote down vote up
@Override
public Collection<StepExecution> getStepExecutions(Long jobExecutionId) throws NoSuchJobExecutionException {

	JobExecution jobExecution = jobExecutionDao.getJobExecution(jobExecutionId);
	if (jobExecution == null) {
		throw new NoSuchJobExecutionException("No JobExecution with id=" + jobExecutionId);
	}

	stepExecutionDao.addStepExecutions(jobExecution);

	return jobExecution.getStepExecutions();

}
 
Example #26
Source File: JobExecutionController.java    From spring-cloud-dataflow with Apache License 2.0 3 votes vote down vote up
/**
 * Stop a Job Execution with the given jobExecutionId. Please be aware that you must
 * provide the request parameter {@code stop=true} in order to invoke this endpoint.
 *
 * @param jobExecutionId the executionId of the job execution to stop.
 * @throws JobExecutionNotRunningException if a stop is requested on a job that is not
 *     running.
 * @throws NoSuchJobExecutionException if the job execution id specified does not exist.
 */
@RequestMapping(value = { "/{executionId}" }, method = RequestMethod.PUT, params = "stop=true")
@ResponseStatus(HttpStatus.OK)
public void stopJobExecution(@PathVariable("executionId") long jobExecutionId)
		throws NoSuchJobExecutionException, JobExecutionNotRunningException {
	taskJobService.stopJobExecution(jobExecutionId);
}
 
Example #27
Source File: JobExecutionController.java    From spring-cloud-dataflow with Apache License 2.0 3 votes vote down vote up
/**
 * Restart the Job Execution with the given jobExecutionId. Please be aware that you must
 * provide the request parameter {@code restart=true} in order to invoke this endpoint.
 *
 * @param jobExecutionId the executionId of the job execution to restart
 * @throws NoSuchJobExecutionException if the job execution for the jobExecutionId
 *     specified does not exist.
 */
@RequestMapping(value = { "/{executionId}" }, method = RequestMethod.PUT, params = "restart=true")
@ResponseStatus(HttpStatus.OK)
public void restartJobExecution(@PathVariable("executionId") long jobExecutionId)
		throws NoSuchJobExecutionException {
	taskJobService.restartJobExecution(jobExecutionId);
}
 
Example #28
Source File: JobStepExecutionController.java    From spring-cloud-dataflow with Apache License 2.0 3 votes vote down vote up
/**
 * List all step executions.
 *
 * @param id the {@link JobExecution}.
 * @param pageable the pagination information.
 * @param assembler the resource assembler for step executions.
 * @return Collection of {@link StepExecutionResource} for the given jobExecutionId.
 * @throws NoSuchJobExecutionException if the job execution for the id specified does
 * not exist.
 */
@RequestMapping(value = { "" }, method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public PagedModel<StepExecutionResource> stepExecutions(@PathVariable("jobExecutionId") long id,
		Pageable pageable, PagedResourcesAssembler<StepExecution> assembler) throws NoSuchJobExecutionException {
	List<StepExecution> result;
	result = new ArrayList<>(jobService.getStepExecutions(id));
	Page<StepExecution> page = new PageImpl<>(result, pageable, result.size());
	return assembler.toModel(page, stepAssembler);
}
 
Example #29
Source File: JobStepExecutionController.java    From spring-cloud-dataflow with Apache License 2.0 3 votes vote down vote up
/**
 * Retrieve a specific {@link StepExecutionResource}.
 *
 * @param id the {@link JobExecution} id.
 * @param stepId the {@link StepExecution} id.
 * @return Collection of {@link StepExecutionResource} for the given jobExecutionId.
 * @throws NoSuchStepExecutionException if the stepId specified does not exist.
 * @throws NoSuchJobExecutionException if the job execution for the id specified does
 * not exist.
 */
@RequestMapping(value = { "/{stepExecutionId}" }, method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public StepExecutionResource getStepExecution(@PathVariable("jobExecutionId") Long id,
		@PathVariable("stepExecutionId") Long stepId)
		throws NoSuchStepExecutionException, NoSuchJobExecutionException {
	return stepAssembler.toModel(jobService.getStepExecution(id, stepId));
}
 
Example #30
Source File: JobService.java    From spring-cloud-dataflow with Apache License 2.0 2 votes vote down vote up
/**
 * Mark the {@link JobExecution} as ABANDONED. If a stop signal is ignored because the
 * process died this is the best way to mark a job as finished with (as opposed to
 * STOPPED). An abandoned job execution can be restarted, but a stopping one cannot.
 * 
 * @param jobExecutionId the job execution id to abort
 * @return the {@link JobExecution} that was aborted
 * @throws NoSuchJobExecutionException thrown if job execution specified does not exist
 * @throws JobExecutionAlreadyRunningException thrown if the job is running (it should be
 *     stopped first)
 */
JobExecution abandon(Long jobExecutionId) throws NoSuchJobExecutionException, JobExecutionAlreadyRunningException;