-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
655 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...ava/uk/ac/ebi/eva/pipeline/configuration/io/readers/StatsVariantsReaderConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2024 EMBL - European Bioinformatics Institute | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package uk.ac.ebi.eva.pipeline.configuration.io.readers; | ||
|
||
import org.springframework.batch.core.configuration.annotation.StepScope; | ||
import org.springframework.batch.item.ItemStreamReader; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.data.mongodb.core.MongoTemplate; | ||
import uk.ac.ebi.eva.commons.models.mongo.entity.VariantDocument; | ||
import uk.ac.ebi.eva.pipeline.io.readers.StatsVariantReader; | ||
import uk.ac.ebi.eva.pipeline.parameters.ChunkSizeParameters; | ||
import uk.ac.ebi.eva.pipeline.parameters.DatabaseParameters; | ||
import uk.ac.ebi.eva.pipeline.parameters.InputParameters; | ||
|
||
import static uk.ac.ebi.eva.pipeline.configuration.BeanNames.STATS_VARIANTS_READER; | ||
|
||
@Configuration | ||
public class StatsVariantsReaderConfiguration { | ||
|
||
@Bean(STATS_VARIANTS_READER) | ||
@StepScope | ||
public ItemStreamReader<VariantDocument> statsVariantsReader(DatabaseParameters databaseParameters, | ||
MongoTemplate mongoTemplate, | ||
InputParameters inputParameters, | ||
ChunkSizeParameters chunkSizeParameters) { | ||
|
||
return new StatsVariantReader(databaseParameters, mongoTemplate, inputParameters.getStudyId(), chunkSizeParameters.getChunkSize()); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...ava/uk/ac/ebi/eva/pipeline/configuration/io/writers/StatsVariantsWriterConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2024 EMBL - European Bioinformatics Institute | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package uk.ac.ebi.eva.pipeline.configuration.io.writers; | ||
|
||
import org.springframework.batch.core.configuration.annotation.StepScope; | ||
import org.springframework.batch.item.ItemWriter; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.data.mongodb.core.MongoTemplate; | ||
import uk.ac.ebi.eva.commons.models.mongo.entity.VariantDocument; | ||
import uk.ac.ebi.eva.pipeline.io.writers.StatsVariantWriter; | ||
import uk.ac.ebi.eva.pipeline.parameters.DatabaseParameters; | ||
|
||
import static uk.ac.ebi.eva.pipeline.configuration.BeanNames.STATS_VARIANTS_WRITER; | ||
|
||
@Configuration | ||
public class StatsVariantsWriterConfiguration { | ||
|
||
@Bean(STATS_VARIANTS_WRITER) | ||
@StepScope | ||
public ItemWriter<VariantDocument> statsVariantsWriter(DatabaseParameters databaseParameters, MongoTemplate mongoTemplate) { | ||
return new StatsVariantWriter(databaseParameters, mongoTemplate); | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
...va/uk/ac/ebi/eva/pipeline/configuration/jobs/PopulationStatisticsJobConfigurationNew.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright 2024 EMBL - European Bioinformatics Institute | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package uk.ac.ebi.eva.pipeline.configuration.jobs; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.batch.core.Job; | ||
import org.springframework.batch.core.Step; | ||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; | ||
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.context.annotation.Scope; | ||
import uk.ac.ebi.eva.pipeline.configuration.jobs.steps.CalculateStatisticsStepConfigurationNew; | ||
import uk.ac.ebi.eva.pipeline.parameters.NewJobIncrementer; | ||
|
||
import static uk.ac.ebi.eva.pipeline.configuration.BeanNames.CALCULATE_STATISTICS_JOB_NEW; | ||
import static uk.ac.ebi.eva.pipeline.configuration.BeanNames.CALCULATE_STATISTICS_STEP_NEW; | ||
|
||
/** | ||
* Configuration to run a full Statistics job: variantStatsFlow: statsCreate --> statsLoad | ||
* <p> | ||
* TODO add a new PopulationStatisticsJobParametersValidator | ||
*/ | ||
@Configuration | ||
@EnableBatchProcessing | ||
@Import({CalculateStatisticsStepConfigurationNew.class}) | ||
public class PopulationStatisticsJobConfigurationNew { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(PopulationStatisticsJobConfigurationNew.class); | ||
|
||
@Autowired | ||
@Qualifier(CALCULATE_STATISTICS_STEP_NEW) | ||
private Step calculateStatisticsStepNew; | ||
|
||
@Bean(CALCULATE_STATISTICS_JOB_NEW) | ||
@Scope("prototype") | ||
public Job calculateStatisticsJob(JobBuilderFactory jobBuilderFactory) { | ||
logger.debug("Building '" + CALCULATE_STATISTICS_JOB_NEW + "'"); | ||
|
||
return jobBuilderFactory | ||
.get(CALCULATE_STATISTICS_JOB_NEW) | ||
.incrementer(new NewJobIncrementer()) | ||
.start(calculateStatisticsStepNew) | ||
.build(); | ||
} | ||
|
||
} |
63 changes: 63 additions & 0 deletions
63
...ac/ebi/eva/pipeline/configuration/jobs/steps/CalculateStatisticsStepConfigurationNew.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright 2024 EMBL - European Bioinformatics Institute | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package uk.ac.ebi.eva.pipeline.configuration.jobs.steps; | ||
|
||
import org.springframework.batch.core.Step; | ||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; | ||
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory; | ||
import org.springframework.batch.core.step.tasklet.TaskletStep; | ||
import org.springframework.batch.item.ItemProcessor; | ||
import org.springframework.batch.item.ItemStreamReader; | ||
import org.springframework.batch.item.ItemWriter; | ||
import org.springframework.batch.repeat.policy.SimpleCompletionPolicy; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Import; | ||
import uk.ac.ebi.eva.commons.models.mongo.entity.VariantDocument; | ||
import uk.ac.ebi.eva.pipeline.configuration.ChunkSizeCompletionPolicyConfiguration; | ||
import uk.ac.ebi.eva.pipeline.configuration.io.readers.StatsVariantsReaderConfiguration; | ||
import uk.ac.ebi.eva.pipeline.configuration.io.writers.StatsVariantsWriterConfiguration; | ||
import uk.ac.ebi.eva.pipeline.configuration.jobs.steps.processors.StatsVariantsProcessorConfiguration; | ||
|
||
import static uk.ac.ebi.eva.pipeline.configuration.BeanNames.CALCULATE_STATISTICS_STEP_NEW; | ||
import static uk.ac.ebi.eva.pipeline.configuration.BeanNames.STATS_VARIANTS_PROCESSOR; | ||
import static uk.ac.ebi.eva.pipeline.configuration.BeanNames.STATS_VARIANTS_READER; | ||
import static uk.ac.ebi.eva.pipeline.configuration.BeanNames.STATS_VARIANTS_WRITER; | ||
|
||
|
||
@Configuration | ||
@EnableBatchProcessing | ||
@Import({StatsVariantsReaderConfiguration.class, StatsVariantsWriterConfiguration.class, | ||
StatsVariantsProcessorConfiguration.class, ChunkSizeCompletionPolicyConfiguration.class}) | ||
public class CalculateStatisticsStepConfigurationNew { | ||
|
||
@Bean(CALCULATE_STATISTICS_STEP_NEW) | ||
public Step calculateStatisticsStep( | ||
@Qualifier(STATS_VARIANTS_READER) ItemStreamReader<VariantDocument> variantReader, | ||
@Qualifier(STATS_VARIANTS_PROCESSOR) ItemProcessor<VariantDocument, VariantDocument> variantProcessor, | ||
@Qualifier(STATS_VARIANTS_WRITER) ItemWriter<VariantDocument> variantWriter, | ||
StepBuilderFactory stepBuilderFactory, | ||
SimpleCompletionPolicy chunkSizeCompletionPolicy) { | ||
TaskletStep step = stepBuilderFactory.get(CALCULATE_STATISTICS_STEP_NEW) | ||
.<VariantDocument, VariantDocument>chunk(chunkSizeCompletionPolicy) | ||
.reader(variantReader) | ||
.processor(variantProcessor) | ||
.writer(variantWriter) | ||
.build(); | ||
return step; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...eva/pipeline/configuration/jobs/steps/processors/StatsVariantsProcessorConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2024 EMBL - European Bioinformatics Institute | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package uk.ac.ebi.eva.pipeline.configuration.jobs.steps.processors; | ||
|
||
import org.springframework.batch.core.configuration.annotation.StepScope; | ||
import org.springframework.batch.item.ItemProcessor; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import uk.ac.ebi.eva.commons.models.mongo.entity.VariantDocument; | ||
import uk.ac.ebi.eva.pipeline.io.processors.StatsVariantProcessor; | ||
|
||
import static uk.ac.ebi.eva.pipeline.configuration.BeanNames.STATS_VARIANTS_PROCESSOR; | ||
|
||
@Configuration | ||
public class StatsVariantsProcessorConfiguration { | ||
|
||
@Bean(STATS_VARIANTS_PROCESSOR) | ||
@StepScope | ||
public ItemProcessor<VariantDocument, VariantDocument> statsVariantsReader() { | ||
return new StatsVariantProcessor(); | ||
} | ||
} |
Oops, something went wrong.