@Override public Job getObject() throws Exception { ComposedRunnerVisitor composedRunnerVisitor = new ComposedRunnerVisitor(); TaskParser taskParser = new TaskParser("composed-task-runner", this.dsl,false,true); taskParser.parse().accept(composedRunnerVisitor); this.visitorDeque = composedRunnerVisitor.getFlow(); FlowJobBuilder builder = this.jobBuilderFactory .get(this.taskNameResolver.getTaskName()) .start(this.flowBuilder .start(createFlow()) .end()) .end(); if(this.incrementInstanceEnabled) { builder.incrementer(new RunIdIncrementer()); } return builder.build(); }
@Test public void retryFailedExecutionOnNonRestartableJob() throws Exception { this.job = this.jobs.get("job").preventRestart() .start(this.steps.get("step").tasklet(new Tasklet() { @Override public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { throw new RuntimeException("Planned"); } }).build()).incrementer(new RunIdIncrementer()).build(); this.runner.execute(this.job, new JobParameters()); this.runner.execute(this.job, new JobParameters()); // A failed job that is not restartable does not re-use the job params of // the last execution, but creates a new job instance when running it again. assertThat(this.jobExplorer.getJobInstances("job", 0, 100)).hasSize(2); }
@Test public void retryFailedExecutionWithNonIdentifyingParameters() throws Exception { this.job = this.jobs.get("job") .start(this.steps.get("step").tasklet(new Tasklet() { @Override public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { throw new RuntimeException("Planned"); } }).build()).incrementer(new RunIdIncrementer()).build(); JobParameters jobParameters = new JobParametersBuilder().addLong("id", 1L, false) .addLong("foo", 2L, false).toJobParameters(); this.runner.execute(this.job, jobParameters); this.runner.execute(this.job, jobParameters); assertThat(this.jobExplorer.getJobInstances("job", 0, 100)).hasSize(1); }
/** * @return main job */ @Bean public Job job() { return jobs.get("mainJob") .incrementer(new RunIdIncrementer()) .flow(loadProcessedListIds()) .next(new FlowBuilder<SimpleFlow>("splitFlow") .start(loadScans()) .split(taskExecutor()) .add(new FlowBuilder<SimpleFlow>("loadTranscriptsFlow") .start(loadTranscripts()) .build()) .build()) .next(addSign()) .end() .build(); }
@Test public void retryFailedExecutionOnNonRestartableJob() throws Exception { this.job = this.jobs.get("job").preventRestart() .start(this.steps.get("step").tasklet(new Tasklet() { @Override public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { throw new RuntimeException("Planned"); } }).build()).incrementer(new RunIdIncrementer()).build(); this.runner.execute(this.job, new JobParameters()); this.runner.execute(this.job, new JobParameters()); // A failed job that is not restartable does not re-use the job params of // the last execution, but creates a new job instance when running it again. assertEquals(2, this.jobExplorer.getJobInstances("job", 0, 100).size()); }
@Test public void retryFailedExecutionWithNonIdentifyingParameters() throws Exception { this.job = this.jobs.get("job") .start(this.steps.get("step").tasklet(new Tasklet() { @Override public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { throw new RuntimeException("Planned"); } }).build()).incrementer(new RunIdIncrementer()).build(); JobParameters jobParameters = new JobParametersBuilder().addLong("id", 1L, false) .addLong("foo", 2L, false).toJobParameters(); this.runner.execute(this.job, jobParameters); this.runner.execute(this.job, jobParameters); assertEquals(1, this.jobExplorer.getJobInstances("job", 0, 100).size()); }
@Bean(name = "demoJob") public Job demoJob() throws Exception { return jobBuilderFactory.get("demoJob") .incrementer(new RunIdIncrementer()) .listener(demoJobListener) .flow(demoStep1()) .next(decideIfGoodToContinue()) .on(c(NO)) .end() .on(c(YES)) .to(optionalStep()) .end() .build(); }
@Bean(name = "githubJob") public Job githubJob() throws Exception { return jobBuilderFactory.get("githubJob") .incrementer(new RunIdIncrementer()) .listener(githubJobListener) .flow(githubStep1()) .end() .build(); }
/** * Create job one. * * @return Job job one */ @Bean public Job oneJob() { return jobBuilderFactory.get("one-job") // .incrementer(new RunIdIncrementer()) // .listener(listener) // .flow(oneStep()) // .end() // .build(); }
/** * @jobName job名称 * 创建Job名称为jobName的任务 */ public Job job(BatchRunConfDto conf, String jobName, String typeId, String scriptFile) { Step step = stepOne(conf, jobName, typeId, scriptFile); return jobBuilderFactory.get(jobName) .incrementer(new RunIdIncrementer()) .start(step) .build(); }
/** * Create the job to push the vulnerability data from BlackDuck to Fortify Job * * @return Job */ @Bean public Job pushBlackDuckScanToFortifyJob() { logger.info("Push Blackduck Scan data to Fortify Job"); return jobBuilderFactory.get("Push Blackduck Scan data to Fortify Job") .incrementer(new RunIdIncrementer()) .listener(this) .flow(createMappingParserStep()) .end().build(); }
@Bean(name = JOB_NAME) public Job lhClubImportJob( @Qualifier(DOWNLOAD_STEP) Step download, @Qualifier(TRUNCATE_STEP) Step truncate, @Qualifier(IMPORT_STEP) Step importStep, @Qualifier(SYNCHRONIZE_STEP) Step synchronizeStep) { return jobBuilderFactory.get(JOB_NAME) .incrementer(new RunIdIncrementer()) .listener(new LHHuntingClubCSVCleaner()) .start(download) .next(truncate) .next(importStep) .next(synchronizeStep) .build(); }
@Bean(name = JOB_NAME) public Job innofactorImportJob(@Qualifier(STEP_NAME) Step innofactorImportStep) { return jobBuilder.get(JOB_NAME) .incrementer(new RunIdIncrementer()) .validator(MetsastajaRekisteriJobParameters.createValidator()) .start(innofactorImportStep) .next(innofactorArchiveStep()) .next(innofactorPostProcessStep()) .build(); }
@Test public void incrementExistingExecution() throws Exception { this.job = this.jobs.get("job").start(this.step) .incrementer(new RunIdIncrementer()).build(); this.runner.execute(this.job, new JobParameters()); this.runner.execute(this.job, new JobParameters()); assertThat(this.jobExplorer.getJobInstances("job", 0, 100)).hasSize(2); }
@Test public void retryFailedExecution() throws Exception { this.job = this.jobs.get("job") .start(this.steps.get("step").tasklet(new Tasklet() { @Override public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { throw new RuntimeException("Planned"); } }).build()).incrementer(new RunIdIncrementer()).build(); this.runner.execute(this.job, new JobParameters()); this.runner.execute(this.job, new JobParameters()); assertThat(this.jobExplorer.getJobInstances("job", 0, 100)).hasSize(1); }
@Bean public Job importUserJob(JobBuilderFactory jobs, Step s1, JobExecutionListener executionListener) { return jobs.get("importUserJob") .incrementer(new RunIdIncrementer()) .listener(executionListener) .flow(s1) .end() .build(); }
@Bean public Job job() { return jobBuilderFactory.get("job1") .incrementer(new RunIdIncrementer()) .flow(step1) .end() .build(); }
@Test public void incrementExistingExecution() throws Exception { this.job = this.jobs.get("job").start(this.step) .incrementer(new RunIdIncrementer()).build(); this.runner.execute(this.job, new JobParameters()); this.runner.execute(this.job, new JobParameters()); assertEquals(2, this.jobExplorer.getJobInstances("job", 0, 100).size()); }
@Test public void retryFailedExecution() throws Exception { this.job = this.jobs.get("job") .start(this.steps.get("step").tasklet(new Tasklet() { @Override public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { throw new RuntimeException("Planned"); } }).build()).incrementer(new RunIdIncrementer()).build(); this.runner.execute(this.job, new JobParameters()); this.runner.execute(this.job, new JobParameters()); assertEquals(1, this.jobExplorer.getJobInstances("job", 0, 100).size()); }
@Bean public Job importTicketsJob(final JobBuilderFactory jobs, final Step importTicketStep, final TicketImportJobExecutionListener ticketImportJobExecutionListener) { return jobs.get("importTicketsJob") .incrementer(new RunIdIncrementer()) .listener(ticketImportJobExecutionListener) .flow(importTicketStep) .end() .build(); }
@Bean(name="job1") public Job job1() { return jobs .get("myJob") .incrementer(new RunIdIncrementer()) .start(step1()) .next(step2(" hogehoge")) .next(steps.get("step3").tasklet((stepContribution, chunkContext) -> { System.out.println("step 3"); return RepeatStatus.FINISHED;}).build()) .build(); }
@Bean(name="job2") public Job job2() { SimpleJob job = new SimpleJob(); job.setRestartable(false); return jobs .get("myJob2") .incrementer(new RunIdIncrementer()) .start(steps.get("step3").tasklet((stepContribution, chunkContext) -> { System.out.println("job2 step"); return RepeatStatus.FINISHED;}).build()) .build(); }
@Bean(name="job3") public Job job3() { return jobs .get("myJob") .incrementer(new RunIdIncrementer()) .start(step1()) .next(step2(" job3 sample")) .next(steps.get("step3").tasklet((stepContribution, chunkContext) -> { System.out.println(chunkContext.getStepContext().getJobParameters().get("INPUT_FILE_PATH")); System.out.println(chunkContext.getStepContext().getJobParameters().get("TIMESTAMP")); System.out.println("step 3"); return RepeatStatus.FINISHED;}).build()) .build(); }
@Bean public Job writeStepJob(JobBuilderFactory jobs, Step stepOne, JobExecutionListener listener) { return jobs.get("writeStepJob") .incrementer(new RunIdIncrementer()) .listener(listener) .flow(stepOne) .end() .build(); }
@Bean public Job writeJsonFormatJob(JobBuilderFactory jobs, Step stepOne, JobExecutionListener listener) { return jobs.get("JsonWriter") .incrementer(new RunIdIncrementer()) .listener(listener) .flow(stepOne) .end() .build(); }
@Bean public Job job(JobBuilderFactory jobBuilderFactory, Step step1, Step step2) { return jobBuilderFactory.get(JOB_NAME) .start(step1) .next(step2) .incrementer(new RunIdIncrementer()) .build(); }
@Bean public Job plantUmlJob(JobBuilderFactory jobs, Step s1) { return jobs.get("plantUmlJob") .incrementer(new RunIdIncrementer()) .flow(s1) .end() .build(); }
@Bean public Job job(Step step1) throws Exception { return jobBuilderFactory.get("job1") .incrementer(new RunIdIncrementer()) .start(step1) .build(); }
/** * This method declare the steps that the batch has to follow * * @param jobs * @param s1 * @return */ @Bean public Job importPerson(JobBuilderFactory jobs, Step s1) { return jobs.get("import") .incrementer(new RunIdIncrementer()) // because a spring config bug, this incrementer is not really useful .flow(s1) .end() .build(); }
@Bean public Job testJob() { final JobParametersIncrementer incrementer = new RunIdIncrementer(); return jobs.get(JOB_NAME) // .incrementer(incrementer) // .start(taskletStep()) // .next(chunkStep()) // .build(); }
@Bean public Job ctJudgmentImportJob() { return jobs.get("IMPORT_CT_JUDGMENTS") .start(ctJudgmentImportDownloadStep()) .next(ctJudgmentImportProcessStep()) .incrementer(new RunIdIncrementer()) .build(); }
@Bean public Job tagPostUploadJob() { return jobs.get("TAG_POST_UPLOAD_PROCESSING") .start(updateEnrichmentHashStep()) .next(markChangedTagJudgmentsAsNotIndexedStep()) .next(saveEnrichmentTagLawJournalEntriesStep()) .next(judgmentIndexingProcessStep) .listener(enrichmentHashProcessedFlagMarker) .incrementer(new RunIdIncrementer()).build(); }
@Bean @Autowired public Job judgmentIndexingJob(TaskExecutor judgmentIndexingTaskExecutor) { return jobs.get("INDEX_NOT_INDEXED_JUDGMENTS") .start(judgmentIndexingProcessStep(judgmentIndexingTaskExecutor)) .incrementer(new RunIdIncrementer()) .build(); }
@Bean public Job nacJudgmentImportDownloadJob() { return jobs.get("IMPORT_NAC_JUDGMENTS_download") .start(nacJudgmentImportDownloadStep()) .incrementer(new RunIdIncrementer()) .build(); }