-
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.
Merge pull request #104 from poggio84/MonitorProgressVariantLoaderSte…
…p_EVA-675 * New listener to estimate the total number of rows in a VCF file created * Estimator wired with the step listener reporting statistics about the chunk * Listener statistics reporter wired into VariantLoader step
- Loading branch information
Showing
10 changed files
with
378 additions
and
56 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
51 changes: 51 additions & 0 deletions
51
src/main/java/uk/ac/ebi/eva/pipeline/listeners/VariantLoaderStepStatisticsListener.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,51 @@ | ||
/* | ||
* Copyright 2017 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.listeners; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.batch.core.ExitStatus; | ||
import org.springframework.batch.core.StepExecution; | ||
import org.springframework.batch.core.StepExecutionListener; | ||
|
||
import uk.ac.ebi.eva.pipeline.parameters.ExecutionContextParametersNames; | ||
import uk.ac.ebi.eva.pipeline.parameters.JobParametersNames; | ||
import uk.ac.ebi.eva.utils.VcfNumberOfLinesEstimator; | ||
|
||
/** | ||
* - Estimate the number of lines in the VCF file before the step. This will be used in {@link StepProgressListener} | ||
* - Log a statistics summary after the step | ||
*/ | ||
public class VariantLoaderStepStatisticsListener implements StepExecutionListener { | ||
private static final Logger logger = LoggerFactory.getLogger(VariantLoaderStepStatisticsListener.class); | ||
|
||
@Override | ||
public void beforeStep(StepExecution stepExecution) { | ||
String vcfFilePath = stepExecution.getJobExecution().getJobParameters().getString(JobParametersNames.INPUT_VCF); | ||
long estimatedTotalNumberOfLines = new VcfNumberOfLinesEstimator().estimateVcfNumberOfLines(vcfFilePath); | ||
stepExecution.getExecutionContext().put(ExecutionContextParametersNames.NUMBER_OF_LINES, estimatedTotalNumberOfLines); | ||
} | ||
|
||
@Override | ||
public ExitStatus afterStep(StepExecution stepExecution) { | ||
logger.info("Items read = " + stepExecution.getReadCount() | ||
+ ", items written = " + stepExecution.getWriteCount() | ||
+ ", items skipped = " + stepExecution.getSkipCount()); | ||
|
||
return null; | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/uk/ac/ebi/eva/pipeline/parameters/ExecutionContextParametersNames.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,23 @@ | ||
/* | ||
* Copyright 2017 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.parameters; | ||
|
||
/** | ||
* Class that holds the names (keys) of the parameters used into {@link org.springframework.batch.item.ExecutionContext} | ||
*/ | ||
public class ExecutionContextParametersNames { | ||
public static final String NUMBER_OF_LINES = "line"; | ||
} |
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.