List of usage examples for org.springframework.batch.core StepExecution getJobExecution
public JobExecution getJobExecution()
From source file:org.springframework.cloud.task.batch.partition.DeployerPartitionHandler.java
private void launchWorker(StepExecution workerStepExecution) { //TODO: Refactor these to be passed as command line args once SCD-20 is complete // https://github.com/spring-cloud/spring-cloud-deployer/issues/20 Map<String, String> arguments = getArguments(this.taskExecution.getArguments()); arguments.put(SPRING_CLOUD_TASK_JOB_EXECUTION_ID, String.valueOf(workerStepExecution.getJobExecution().getId())); arguments.put(SPRING_CLOUD_TASK_STEP_EXECUTION_ID, String.valueOf(workerStepExecution.getId())); arguments.put(SPRING_CLOUD_TASK_STEP_NAME, this.stepName); AppDefinition definition = new AppDefinition(String.format("%s:%s:%s", taskExecution.getTaskName(), workerStepExecution.getJobExecution().getJobInstance().getJobName(), workerStepExecution.getStepName()), arguments); Map<String, String> environmentProperties = new HashMap<>(this.environmentProperties.size()); environmentProperties.putAll(getCurrentEnvironmentProperties()); environmentProperties.putAll(this.environmentProperties); AppDeploymentRequest request = new AppDeploymentRequest(definition, this.resource, environmentProperties); taskLauncher.launch(request);// www .j av a 2 s . c om }
From source file:org.springframework.xd.dirt.plugins.job.support.listener.FileDeletionStepExecutionListener.java
@Override public ExitStatus afterStep(StepExecution stepExecution) { if (!deleteFiles) { return stepExecution.getExitStatus(); }/* w w w . j ava2s .co m*/ if (stepExecution.getStatus().equals(BatchStatus.STOPPED) || stepExecution.getStatus().isUnsuccessful()) { logger.warn("Job is stopped, or failed to complete successfully. File deletion will be skipped"); return stepExecution.getExitStatus(); } if (resources != null) { deleteResources(); } else { deleteFilePath(stepExecution.getJobExecution().getJobParameters() .getString(ExpandedJobParametersConverter.ABSOLUTE_FILE_PATH)); } return stepExecution.getExitStatus(); }
From source file:uk.ac.ebi.intact.dataexchange.dbimporter.listener.MailNotifierStepExecutionListener.java
public void beforeStep(StepExecution stepExecution) { SimpleMailMessage message = newSimpleMessage(); message.setSubject("[IntAct_import] Started step: " + stepExecution.getStepName() + ""); message.setText(stepExecution.getSummary() + "\n" + stepExecution.getJobExecution()); message.setTo(stepExecution.getJobParameters().getString("email.recipient")); // try{ // mailSender.send(message); // }/*w w w.j ava 2 s . c o m*/ // catch (MailException e){ // log.error("Impossible to send e-mail", e); // } }
From source file:uk.ac.ebi.intact.dataexchange.dbimporter.listener.MailNotifierStepExecutionListener.java
public ExitStatus afterStep(StepExecution stepExecution) { SimpleMailMessage message = newSimpleMessage(); message.setSubject("[IntAct_import] Finished step: " + stepExecution.getStepName() + " Exit status: " + stepExecution.getExitStatus().getExitCode()); message.setText(stepExecution.toString() + "\n" + stepExecution.getExecutionContext()); message.setText(stepExecution.toString() + "\n" + stepExecution.getSummary() + "\n" + stepExecution.getJobExecution()); message.setTo(stepExecution.getJobParameters().getString("email.recipient")); // try{ // mailSender.send(message); // }/*from ww w .j a va 2 s .c om*/ // catch (MailException e){ // log.error("Impossible to send e-mail", e); // } return stepExecution.getExitStatus(); }
From source file:uk.ac.ebi.intact.dataexchange.psimi.exporter.listener.MailNotifierStepExecutionListener.java
public void beforeStep(StepExecution stepExecution) { SimpleMailMessage message = newSimpleMessage(); message.setSubject("[IntAct_export] Started step: " + stepExecution.getStepName() + ""); message.setText(stepExecution.getSummary() + "\n" + stepExecution.getJobExecution()); message.setTo(recipients);//from w w w .j av a 2 s . c o m try { mailSender.send(message); } catch (MailException e) { log.error("Impossible to send e-mail", e); } }
From source file:uk.ac.ebi.intact.dataexchange.psimi.exporter.listener.MailNotifierStepExecutionListener.java
public ExitStatus afterStep(StepExecution stepExecution) { SimpleMailMessage message = newSimpleMessage(); message.setSubject("[IntAct_export] Finished step: " + stepExecution.getStepName() + " Exit status: " + stepExecution.getExitStatus().getExitCode()); message.setText(stepExecution.toString() + "\n" + stepExecution.getExecutionContext()); message.setText(stepExecution.toString() + "\n" + stepExecution.getSummary() + "\n" + stepExecution.getJobExecution()); message.setTo(recipients);/* w w w .j a va 2 s . c om*/ try { mailSender.send(message); } catch (MailException e) { log.error("Impossible to send e-mail", e); } return stepExecution.getExitStatus(); }