diff --git a/annotationPipeline/src/main/java/org/cbioportal/annotation/pipeline/BatchConfiguration.java b/annotationPipeline/src/main/java/org/cbioportal/annotation/pipeline/BatchConfiguration.java index 836fac2f..6c96fa90 100644 --- a/annotationPipeline/src/main/java/org/cbioportal/annotation/pipeline/BatchConfiguration.java +++ b/annotationPipeline/src/main/java/org/cbioportal/annotation/pipeline/BatchConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Memorial Sloan-Kettering Cancer Center. + * Copyright (c) 2016 - 2024 Memorial Sloan-Kettering Cancer Center. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS @@ -36,37 +36,33 @@ import org.cbioportal.models.AnnotatedRecord; import org.springframework.batch.core.*; -import org.springframework.batch.item.*; import org.springframework.batch.core.configuration.annotation.*; -import org.springframework.context.annotation.*; +import org.springframework.batch.core.job.builder.JobBuilder; +import org.springframework.batch.core.repository.JobRepository; +import org.springframework.batch.core.step.builder.StepBuilder; +import org.springframework.batch.item.*; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.batch.core.configuration.annotation.StepScope; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.*; +import org.springframework.transaction.PlatformTransactionManager; /** * @author Zachary Heins */ @Configuration -@EnableBatchProcessing @ComponentScan(basePackages="org.cbioportal.annotator") public class BatchConfiguration { public static final String ANNOTATION_JOB = "annotationJob"; - @Autowired - public JobBuilderFactory jobBuilderFactory; - - @Autowired - public StepBuilderFactory stepBuilderFactory; - @Value("${chunk:1000000}") - private String chunk; + private String chunkSize; @Bean - public Job annotationJob() + public Job annotationJob(JobRepository jobRepository, Step step) { - return jobBuilderFactory.get(ANNOTATION_JOB) - .start(step()) + return new JobBuilder(ANNOTATION_JOB, jobRepository) + .start(step) .build(); } @@ -76,10 +72,10 @@ public AnnotationUtil annotationUtil() { } @Bean - public Step step() + public Step step(JobRepository jobRepository, PlatformTransactionManager transactionManager) { - return stepBuilderFactory.get("step") - . chunk(Integer.parseInt(chunk)) + return new StepBuilder("step", jobRepository) + . chunk(Integer.parseInt(chunkSize), transactionManager) .reader(reader()) .processor(processor()) .writer(writer()) diff --git a/annotationPipeline/src/main/java/org/cbioportal/annotation/pipeline/MutationRecordReader.java b/annotationPipeline/src/main/java/org/cbioportal/annotation/pipeline/MutationRecordReader.java index 98330b18..9840115c 100644 --- a/annotationPipeline/src/main/java/org/cbioportal/annotation/pipeline/MutationRecordReader.java +++ b/annotationPipeline/src/main/java/org/cbioportal/annotation/pipeline/MutationRecordReader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 - 2020 Memorial Sloan-Kettering Cancer Center. + * Copyright (c) 2016 - 2024 Memorial Sloan-Kettering Cancer Center. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS diff --git a/annotationPipeline/src/main/java/org/cbioportal/annotation/pipeline/MutationRecordWriter.java b/annotationPipeline/src/main/java/org/cbioportal/annotation/pipeline/MutationRecordWriter.java index 969f6034..c243becb 100644 --- a/annotationPipeline/src/main/java/org/cbioportal/annotation/pipeline/MutationRecordWriter.java +++ b/annotationPipeline/src/main/java/org/cbioportal/annotation/pipeline/MutationRecordWriter.java @@ -98,7 +98,7 @@ public void close() throws ItemStreamException { } @Override - public void write(List items) throws Exception { + public void write(Chunk items) throws Exception { if (recordsToWriteCount > 0) { flatFileItemWriter.write(items); } diff --git a/annotationPipeline/src/test/java/org/cbioportal/annotation/SpringBatchIntegrationTest.java b/annotationPipeline/src/test/java/org/cbioportal/annotation/SpringBatchIntegrationTest.java index 8ef57755..2a5ee1f2 100644 --- a/annotationPipeline/src/test/java/org/cbioportal/annotation/SpringBatchIntegrationTest.java +++ b/annotationPipeline/src/test/java/org/cbioportal/annotation/SpringBatchIntegrationTest.java @@ -70,7 +70,6 @@ public void check_if_maf_file_still_the_same_when_annotating_with_uniprot_transc .addString("outputFilename", actualFile) .addString("replace", String.valueOf(true)) .addString("isoformOverride", "uniprot") - .addString("errorReportLocation", null) .toJobParameters(); testWith(jobParameters, expectedFile, actualFile); } @@ -87,7 +86,6 @@ public void check_if_maf_file_still_the_same_when_annotating_with_mskcc_transcri .addString("outputFilename", actualFile) .addString("replace", String.valueOf(true)) .addString("isoformOverride", "mskcc") - .addString("errorReportLocation", null) .toJobParameters(); testWith(jobParameters, expectedFile, actualFile); } @@ -104,7 +102,6 @@ public void check_if_minimal_example_maf_file_still_the_same_when_annotating_wit .addString("outputFilename", actualFile) .addString("replace", String.valueOf(true)) .addString("isoformOverride", "uniprot") - .addString("errorReportLocation", null) .toJobParameters(); testWith(jobParameters, expectedFile, actualFile); } @@ -121,7 +118,6 @@ public void check_if_corner_cases_example_maf_file_still_the_same_when_annotatin .addString("outputFilename", actualFile) .addString("replace", String.valueOf(true)) .addString("isoformOverride", "uniprot") - .addString("errorReportLocation", null) .toJobParameters(); testWith(jobParameters, expectedFile, actualFile); } @@ -138,7 +134,6 @@ public void check_if_corner_cases_example_maf_file_still_the_same_when_annotatin .addString("outputFilename", actualFile) .addString("replace", String.valueOf(true)) .addString("isoformOverride", "mskcc") - .addString("errorReportLocation", null) .toJobParameters(); testWith(jobParameters, expectedFile, actualFile); } @@ -155,7 +150,6 @@ public void check_if_corner_cases_example_maf_file_still_the_same_when_annotatin .addString("outputFilename", actualFile) .addString("replace", String.valueOf(true)) .addString("isoformOverride", "uniprot") - .addString("errorReportLocation", null) .toJobParameters(); testWith(jobParameters, expectedFile, actualFile); } @@ -172,7 +166,6 @@ public void check_if_corner_cases_example_maf_file_still_the_same_when_annotatin .addString("outputFilename", actualFile) .addString("replace", String.valueOf(true)) .addString("isoformOverride", "mskcc") - .addString("errorReportLocation", null) .toJobParameters(); testWith(jobParameters, expectedFile, actualFile); } @@ -194,7 +187,6 @@ public void run_vcf2maf_test_case_mskcc() throws Exception { .addString("outputFilename", actualFile) .addString("replace", String.valueOf(true)) .addString("isoformOverride", "mskcc") - .addString("errorReportLocation", null) .toJobParameters(); testWith(jobParameters, expectedFile, actualFile); } @@ -216,7 +208,6 @@ public void run_vcf2maf_test_case_uniprot() throws Exception { .addString("outputFilename", actualFile) .addString("replace", String.valueOf(true)) .addString("isoformOverride", "uniprot") - .addString("errorReportLocation", null) .toJobParameters(); testWith(jobParameters, expectedFile, actualFile); } @@ -233,7 +224,6 @@ public void check_if_my_variant_info_provides_gnomad_annotations() throws Except .addString("outputFilename", actualFile) .addString("replace", String.valueOf(true)) .addString("isoformOverride", "uniprot") - .addString("errorReportLocation", null) .toJobParameters(); testWith(jobParameters, expectedFile, actualFile); } @@ -250,7 +240,6 @@ public void check_if_nucleotide_context_provides_Ref_Tri_and_Var_Tri_columns() t .addString("outputFilename", actualFile) .addString("replace", String.valueOf(true)) .addString("isoformOverride", "uniprot") - .addString("errorReportLocation", null) .toJobParameters(); testWith(jobParameters, expectedFile, actualFile); } @@ -268,7 +257,6 @@ public void test_output_format_extended() throws Exception { .addString("outputFormat", "extended") .addString("replace", String.valueOf(true)) .addString("isoformOverride", "uniprot") - .addString("errorReportLocation", null) .addString("postIntervalSize", String.valueOf(-1)) .toJobParameters(); testWith(jobParameters, expectedFile, actualFile); @@ -287,7 +275,6 @@ public void test_output_format_minimal() throws Exception { .addString("outputFormat", "minimal") .addString("replace", String.valueOf(true)) .addString("isoformOverride", "uniprot") - .addString("errorReportLocation", null) .addString("postIntervalSize", String.valueOf(-1)) .toJobParameters(); testWith(jobParameters, expectedFile, actualFile); @@ -310,7 +297,6 @@ public void test_output_format_with_formatFileHeaders() throws Exception { .addString("outputFormat", "Hugo_Symbol,Entrez_Gene_Id,Center,NCBI_Build,Chromosome,Annotation_Status") .addString("replace", String.valueOf(true)) .addString("isoformOverride", "uniprot") - .addString("errorReportLocation", null) .addString("postIntervalSize", String.valueOf(-1)) .toJobParameters(); testWith(jobParameters, expectedFile, actualFile); @@ -328,7 +314,6 @@ public void test_if_output_contains_original_genomic_location() throws Exception .addString("outputFilename", actualFile) .addString("replace", String.valueOf(true)) .addString("isoformOverride", "mskcc") - .addString("errorReportLocation", null) .addString("postIntervalSize", String.valueOf(-1)) .addString("addOriginalGenomicLocation", String.valueOf(true)) .toJobParameters(); @@ -347,7 +332,6 @@ public void test_strip_off_first_matching_base() throws Exception { .addString("outputFilename", actualFile) .addString("replace", String.valueOf(true)) .addString("isoformOverride", "mskcc") - .addString("errorReportLocation", null) .addString("postIntervalSize", String.valueOf(-1)) .addString("stripMatchingBases", "first") .toJobParameters(); @@ -366,7 +350,6 @@ public void test_no_strip_off_matching_bases() throws Exception { .addString("outputFilename", actualFile) .addString("replace", String.valueOf(true)) .addString("isoformOverride", "mskcc") - .addString("errorReportLocation", null) .addString("postIntervalSize", String.valueOf(-1)) .addString("stripMatchingBases", "none") .toJobParameters(); @@ -385,7 +368,6 @@ public void test_ignore_original_genomic_location_in_input() throws Exception { .addString("outputFilename", actualFile) .addString("replace", String.valueOf(true)) .addString("isoformOverride", "mskcc") - .addString("errorReportLocation", null) .addString("postIntervalSize", String.valueOf(-1)) .addString("stripMatchingBases", "none") .addString("ignoreOriginalGenomicLocation", String.valueOf(true)) @@ -404,4 +386,4 @@ private void testWith(JobParameters jobParameters, String expectedPath, String a assertEquals("COMPLETED", actualJobExitStatus.getExitCode()); AssertFile.assertFileEquals(expectedResult, actualResult); } -} \ No newline at end of file +} diff --git a/annotator/src/main/java/org/cbioportal/annotator/internal/GenomeNexusImpl.java b/annotator/src/main/java/org/cbioportal/annotator/internal/GenomeNexusImpl.java index 7fb9f3bd..12f831cf 100644 --- a/annotator/src/main/java/org/cbioportal/annotator/internal/GenomeNexusImpl.java +++ b/annotator/src/main/java/org/cbioportal/annotator/internal/GenomeNexusImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 - 2020 Memorial Sloan-Kettering Cancer Center. + * Copyright (c) 2016 - 2024 Memorial Sloan-Kettering Cancer Center. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS @@ -67,7 +67,7 @@ * */ -@Configuration +@Configuration(enforceUniqueMethods=false) public class GenomeNexusImpl implements Annotator { @Value("${genomenexus.base:https://www.genomenexus.org}") diff --git a/annotator/src/test/java/org/cbioportal/annotator/MockGenomeNexusImpl.java b/annotator/src/test/java/org/cbioportal/annotator/MockGenomeNexusImpl.java index 263aff2f..fe793551 100644 --- a/annotator/src/test/java/org/cbioportal/annotator/MockGenomeNexusImpl.java +++ b/annotator/src/test/java/org/cbioportal/annotator/MockGenomeNexusImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 - 2020 Memorial Sloan-Kettering Cancer Center. + * Copyright (c) 2018 - 2024 Memorial Sloan-Kettering Cancer Center. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS @@ -64,7 +64,7 @@ * * @author ochoaa */ -@Configuration +@Configuration(enforceUniqueMethods=false) public class MockGenomeNexusImpl extends GenomeNexusImpl { private final boolean REPLACE = false; diff --git a/databaseAnnotator/pom.xml b/databaseAnnotator/pom.xml index 005f8061..465e78a3 100644 --- a/databaseAnnotator/pom.xml +++ b/databaseAnnotator/pom.xml @@ -25,6 +25,7 @@ org.springframework spring-web + ${spring.version} com.fasterxml.jackson.core diff --git a/databaseAnnotator/src/main/java/org/cbioportal/database/annotator/AnnotateRecordsWriter.java b/databaseAnnotator/src/main/java/org/cbioportal/database/annotator/AnnotateRecordsWriter.java index 8eda54ac..f7c9d00b 100644 --- a/databaseAnnotator/src/main/java/org/cbioportal/database/annotator/AnnotateRecordsWriter.java +++ b/databaseAnnotator/src/main/java/org/cbioportal/database/annotator/AnnotateRecordsWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Memorial Sloan-Kettering Cancer Center. + * Copyright (c) 2017-2024 Memorial Sloan-Kettering Cancer Center. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS @@ -75,8 +75,8 @@ public void close() throws ItemStreamException { } @Override - public void write(List list) throws Exception { - for (MutationEvent event : list) { + public void write(Chunk chunk) throws Exception { + for (MutationEvent event : chunk) { updateMutationEventInDb(event); } } diff --git a/databaseAnnotator/src/main/java/org/cbioportal/database/annotator/BatchConfiguration.java b/databaseAnnotator/src/main/java/org/cbioportal/database/annotator/BatchConfiguration.java index 8d71d649..0f867035 100644 --- a/databaseAnnotator/src/main/java/org/cbioportal/database/annotator/BatchConfiguration.java +++ b/databaseAnnotator/src/main/java/org/cbioportal/database/annotator/BatchConfiguration.java @@ -47,7 +47,6 @@ */ @Configuration -@EnableBatchProcessing @ComponentScan(basePackages="org.cbioportal.annotator") public class BatchConfiguration { diff --git a/pom.xml b/pom.xml index 3030081a..b7e9ad9f 100644 --- a/pom.xml +++ b/pom.xml @@ -21,14 +21,14 @@ org.springframework.boot spring-boot-starter-parent - 2.7.18 + 3.1.4 21 1.7.30 - 5.3.31 - 2.11.2 + 6.0.12 + 2.14.3 5.10.0