private boolean isTaskDefined(JobExecution jobExecution) { TaskExecution taskExecution = taskExplorer .getTaskExecution(taskExplorer.getTaskExecutionIdByJobExecutionId(jobExecution.getId())); return taskDefinitionRepository.findById(taskExecution.getTaskName()).isPresent(); } }
@Override public void cleanupExecution(long id) { TaskExecution taskExecution = taskExplorer.getTaskExecution(id); Assert.notNull(taskExecution, "There was no task execution with id " + id); String launchId = taskExecution.getExternalExecutionId(); Assert.hasLength(launchId, "The TaskExecution for id " + id + " did not have an externalExecutionId"); taskLauncher.cleanup(launchId); }
/** * Cleanup resources associated with a single task execution, specified by id. * * @param id the id of the {@link TaskExecution} to clean up */ @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.OK) public void cleanup(@PathVariable("id") long id) { TaskExecution taskExecution = this.explorer.getTaskExecution(id); if (taskExecution == null) { throw new NoSuchTaskExecutionException(id); } this.taskDeleteService.cleanupExecution(id); }
private boolean isTaskDefined(JobExecution jobExecution) { TaskExecution taskExecution = taskExplorer .getTaskExecution(taskExplorer.getTaskExecutionIdByJobExecutionId(jobExecution.getId())); TaskDefinition definition = taskDefinitionRepository.findOne(taskExecution.getTaskName()); return (definition != null); } }
/** * Cleanup resources associated with a single task execution, specified by id. * * @param id the id of the {@link TaskExecution} to clean up */ @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.OK) public void cleanup(@PathVariable("id") long id) { TaskExecution taskExecution = this.explorer.getTaskExecution(id); if (taskExecution == null) { throw new NoSuchTaskExecutionException(id); } this.taskService.cleanupExecution(id); }
/** * View the details of a single task execution, specified by id. * * @param id the id of the requested {@link TaskExecution} * @return the {@link TaskExecution} */ @RequestMapping(value = "/{id}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public TaskExecutionResource view(@PathVariable("id") long id) { TaskExecution taskExecution = this.explorer.getTaskExecution(id); if (taskExecution == null) { throw new NoSuchTaskExecutionException(id); } taskExecution = sanitizePotentialSensitiveKeys(taskExecution); TaskJobExecutionRel taskJobExecutionRel = new TaskJobExecutionRel(taskExecution, new ArrayList<>(this.explorer.getJobExecutionIdsByTaskExecutionId(taskExecution.getExecutionId()))); return this.taskAssembler.toResource(taskJobExecutionRel); }
/** * View the details of a single task execution, specified by id. * * @param id the id of the requested {@link TaskExecution} * @return the {@link TaskExecution} */ @RequestMapping(value = "/{id}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public TaskExecutionResource view(@PathVariable("id") long id) { TaskExecution taskExecution = this.explorer.getTaskExecution(id); if (taskExecution == null) { throw new NoSuchTaskExecutionException(id); } taskExecution = sanitizePotentialSensitiveKeys(taskExecution); TaskJobExecutionRel taskJobExecutionRel = new TaskJobExecutionRel(taskExecution, new ArrayList<>(this.explorer.getJobExecutionIdsByTaskExecutionId(taskExecution.getExecutionId()))); return this.taskAssembler.toResource(taskJobExecutionRel); }
this.taskExplorer.getTaskExecution(taskExecutionId); if(taskExecution != null && taskExecution.getEndTime() != null) { if(taskExecution.getExitCode() != 0 ) {
@Override public void cleanupExecution(long id) { TaskExecution taskExecution = taskExplorer.getTaskExecution(id); Assert.notNull(taskExecution, "There was no task execution with id " + id); String launchId = taskExecution.getExternalExecutionId(); Assert.hasLength(launchId, "The TaskExecution for id " + id + " did not have an externalExecutionId"); TaskDeployment taskDeployment = this.taskDeploymentRepository.findByTaskDeploymentId(String.valueOf(id)); if (taskDeployment == null) { logger.warn(String.format("Did not find TaskDeployment for taskName = [%s], taskId = [%s]. Nothing to clean up.", taskExecution.getTaskName(), id)); return; } Launcher launcher = launcherRepository.findByName(taskDeployment.getPlatformName()); if (launcher != null) { TaskLauncher taskLauncher = launcher.getTaskLauncher(); taskLauncher.cleanup(launchId); } else { logger.info( "Could clean up execution for task id " + id + ". Did not find a task platform named " + taskDeployment.getPlatformName()); } }
"exists."); TaskExecution resultExecution = this.taskExplorer.getTaskExecution(executionId);
@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())); TaskDeployment taskDeployment = this.taskDeploymentRepository.findByTaskDeploymentId(String.valueOf(taskJobExecution.getTaskId())); if (taskDeployment != null) { Map<String, String> deploymentProperties = new HashMap<>(); deploymentProperties.put(DefaultTaskExecutionService.TASK_PLATFORM_NAME, taskDeployment.getPlatformName()); taskExecutionService.executeTask(taskDefinition.getName(), deploymentProperties, taskExecution.getArguments()); } else { throw new IllegalStateException(String.format("Did not find platform for taskName=[%s] , taskId=[%s]", taskExecution.getTaskName(),taskJobExecution.getTaskId())); } }
TaskExecution taskExecution = this.taskExplorer.getTaskExecution(this.taskProperties.getExecutionid()); Assert.notNull(taskExecution, String.format("Invalid TaskExecution, ID %s not found", this.taskProperties.getExecutionid())); Assert.isNull(taskExecution.getEndTime(), String.format(
TaskExecution taskExecution = this.taskExplorer.getTaskExecution(this.taskProperties.getExecutionid()); Assert.notNull(taskExecution, String.format("Invalid TaskExecution, ID %s not found", this.taskProperties.getExecutionid())); Assert.isNull(taskExecution.getEndTime(), String.format(
@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.findOne(taskExecution.getTaskName()); if (taskDefinition == null) { throw new NoSuchTaskDefinitionException(taskExecution.getTaskName()); } taskService.executeTask(taskDefinition.getName(), taskDefinition.getProperties(), taskExecution.getArguments()); }