-
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.
file stats job
- Loading branch information
Showing
10 changed files
with
487 additions
and
34 deletions.
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
59 changes: 59 additions & 0 deletions
59
src/main/java/uk/ac/ebi/eva/pipeline/configuration/jobs/VariantStatsJobConfiguration.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,59 @@ | ||
/* | ||
* 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.VariantStatsStepConfiguration; | ||
import uk.ac.ebi.eva.pipeline.parameters.NewJobIncrementer; | ||
|
||
import static uk.ac.ebi.eva.pipeline.configuration.BeanNames.VARIANT_STATS_JOB; | ||
import static uk.ac.ebi.eva.pipeline.configuration.BeanNames.VARIANT_STATS_STEP; | ||
|
||
@Configuration | ||
@EnableBatchProcessing | ||
@Import({VariantStatsStepConfiguration.class}) | ||
public class VariantStatsJobConfiguration { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(VariantStatsJobConfiguration.class); | ||
|
||
@Autowired | ||
@Qualifier(VARIANT_STATS_STEP) | ||
private Step variantStatsStep; | ||
|
||
@Bean(VARIANT_STATS_JOB) | ||
@Scope("prototype") | ||
public Job variantStatsJob(JobBuilderFactory jobBuilderFactory) { | ||
logger.debug("Building '" + VARIANT_STATS_JOB + "'"); | ||
|
||
return jobBuilderFactory | ||
.get(VARIANT_STATS_JOB) | ||
.incrementer(new NewJobIncrementer()) | ||
.start(variantStatsStep) | ||
.build(); | ||
} | ||
|
||
} |
65 changes: 65 additions & 0 deletions
65
...main/java/uk/ac/ebi/eva/pipeline/configuration/jobs/steps/FileStatsStepConfiguration.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,65 @@ | ||
/* | ||
* 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.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; | ||
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory; | ||
import org.springframework.batch.core.configuration.annotation.StepScope; | ||
import org.springframework.batch.core.step.tasklet.TaskletStep; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.data.mongodb.core.MongoTemplate; | ||
import uk.ac.ebi.eva.pipeline.jobs.steps.tasklets.FileStatsTasklet; | ||
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 uk.ac.ebi.eva.pipeline.parameters.JobOptions; | ||
import uk.ac.ebi.eva.utils.TaskletUtils; | ||
|
||
import static uk.ac.ebi.eva.pipeline.configuration.BeanNames.FILE_STATS_STEP; | ||
|
||
|
||
@Configuration | ||
@EnableBatchProcessing | ||
public class FileStatsStepConfiguration { | ||
private static final Logger logger = LoggerFactory.getLogger(FileStatsStepConfiguration.class); | ||
|
||
@Bean | ||
@StepScope | ||
public FileStatsTasklet fileStatsTasklet(DatabaseParameters databaseParameters, | ||
MongoTemplate mongoTemplate, | ||
InputParameters inputParameters, | ||
ChunkSizeParameters chunkSizeParameters) { | ||
return new FileStatsTasklet(databaseParameters, mongoTemplate, inputParameters.getStudyId(), | ||
chunkSizeParameters.getChunkSize()); | ||
} | ||
|
||
@Bean(FILE_STATS_STEP) | ||
public TaskletStep fileStatsStep(DatabaseParameters databaseParameters, | ||
MongoTemplate mongoTemplate, | ||
InputParameters inputParameters, | ||
ChunkSizeParameters chunkSizeParameters, | ||
StepBuilderFactory stepBuilderFactory, | ||
JobOptions jobOptions) { | ||
logger.debug("Building '" + FILE_STATS_STEP + "'"); | ||
|
||
return TaskletUtils.generateStep(stepBuilderFactory, FILE_STATS_STEP, | ||
fileStatsTasklet(databaseParameters, mongoTemplate, inputParameters, chunkSizeParameters), | ||
jobOptions.isAllowStartIfComplete()); | ||
} | ||
} |
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
Oops, something went wrong.