From a281fa65487be59b2405be25b5e7b303f3224dcc Mon Sep 17 00:00:00 2001 From: Mark DePristo Date: Mon, 4 Feb 2013 15:33:57 -0500 Subject: [PATCH] Resolves Genome Sequence Analysis GSA-750 Don't print an endless series of starting messages from the ProgressMeter -- The progress meter isn't started until the GATK actually calls execute on the microscheduler. Now we get a message saying "Creating shard strategy" while this (expensive) operation runs --- .../sting/gatk/GenomeAnalysisEngine.java | 2 ++ .../gatk/executive/HierarchicalMicroScheduler.java | 2 ++ .../sting/gatk/executive/LinearMicroScheduler.java | 1 + .../sting/gatk/executive/MicroScheduler.java | 11 +++++++++++ .../sting/utils/progressmeter/ProgressMeter.java | 5 +++-- .../progressmeter/ProgressMeterDaemonUnitTest.java | 1 + 6 files changed, 20 insertions(+), 2 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java b/public/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java index de5a96237..c9f48dc01 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java +++ b/public/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java @@ -271,7 +271,9 @@ public class GenomeAnalysisEngine { // create the output streams initializeOutputStreams(microScheduler.getOutputTracker()); + logger.info("Creating shard strategy for " + readsDataSource.getReaderIDs().size() + " BAM files"); Iterable shardStrategy = getShardStrategy(readsDataSource,microScheduler.getReference(),intervals); + logger.info("Done creating shard strategy"); // execute the microscheduler, storing the results return microScheduler.execute(this.walker, shardStrategy); diff --git a/public/java/src/org/broadinstitute/sting/gatk/executive/HierarchicalMicroScheduler.java b/public/java/src/org/broadinstitute/sting/gatk/executive/HierarchicalMicroScheduler.java index 7b4892977..2ea2633ee 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/executive/HierarchicalMicroScheduler.java +++ b/public/java/src/org/broadinstitute/sting/gatk/executive/HierarchicalMicroScheduler.java @@ -139,6 +139,8 @@ public class HierarchicalMicroScheduler extends MicroScheduler implements Hierar } public Object execute( Walker walker, Iterable shardStrategy ) { + super.startingExecution(); + // Fast fail for walkers not supporting TreeReducible interface. if (!( walker instanceof TreeReducible )) throw new IllegalArgumentException("The GATK can currently run in parallel only with TreeReducible walkers"); diff --git a/public/java/src/org/broadinstitute/sting/gatk/executive/LinearMicroScheduler.java b/public/java/src/org/broadinstitute/sting/gatk/executive/LinearMicroScheduler.java index 4c0358d40..415049228 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/executive/LinearMicroScheduler.java +++ b/public/java/src/org/broadinstitute/sting/gatk/executive/LinearMicroScheduler.java @@ -80,6 +80,7 @@ public class LinearMicroScheduler extends MicroScheduler { * @param shardStrategy A strategy for sharding the data. */ public Object execute(Walker walker, Iterable shardStrategy) { + super.startingExecution(); walker.initialize(); Accumulator accumulator = Accumulator.create(engine,walker); diff --git a/public/java/src/org/broadinstitute/sting/gatk/executive/MicroScheduler.java b/public/java/src/org/broadinstitute/sting/gatk/executive/MicroScheduler.java index 371cce778..dc9dfd77e 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/executive/MicroScheduler.java +++ b/public/java/src/org/broadinstitute/sting/gatk/executive/MicroScheduler.java @@ -300,6 +300,17 @@ public abstract class MicroScheduler implements MicroSchedulerMBean { */ public abstract Object execute(Walker walker, Iterable shardStrategy); + /** + * Tells this MicroScheduler that the execution of one of the subclass of this object as started + * + * Must be called when the implementation of execute actually starts up + * + * Currently only starts the progress meter timer running, but other start up activities could be incorporated + */ + protected void startingExecution() { + progressMeter.start(); + } + /** * Retrieves the object responsible for tracking and managing output. * @return An output tracker, for loading data in and extracting results. Will not be null. diff --git a/public/java/src/org/broadinstitute/sting/utils/progressmeter/ProgressMeter.java b/public/java/src/org/broadinstitute/sting/utils/progressmeter/ProgressMeter.java index feeaccf07..f76490552 100644 --- a/public/java/src/org/broadinstitute/sting/utils/progressmeter/ProgressMeter.java +++ b/public/java/src/org/broadinstitute/sting/utils/progressmeter/ProgressMeter.java @@ -154,6 +154,8 @@ public class ProgressMeter { /** * Create a new ProgressMeter * + * Note that progress meter isn't started until the client calls start() + * * @param performanceLogFile an optional performance log file where a table of performance logs will be written * @param processingUnitName the name of the unit type being processed, suitable for saying X seconds per processingUnitName * @param processingIntervals the intervals being processed @@ -193,7 +195,6 @@ public class ProgressMeter { // start up the timer progressMeterDaemon = new ProgressMeterDaemon(this, pollingFrequency); - start(); } public ProgressMeterDaemon getProgressMeterDaemon() { @@ -205,7 +206,7 @@ public class ProgressMeter { * daemon thread for periodic printing. */ @Requires("progressMeterDaemon != null") - private synchronized void start() { + public synchronized void start() { timer.start(); lastProgressPrintTime = timer.currentTime(); diff --git a/public/java/test/org/broadinstitute/sting/utils/progressmeter/ProgressMeterDaemonUnitTest.java b/public/java/test/org/broadinstitute/sting/utils/progressmeter/ProgressMeterDaemonUnitTest.java index c33c1976b..d127a2937 100644 --- a/public/java/test/org/broadinstitute/sting/utils/progressmeter/ProgressMeterDaemonUnitTest.java +++ b/public/java/test/org/broadinstitute/sting/utils/progressmeter/ProgressMeterDaemonUnitTest.java @@ -63,6 +63,7 @@ public class ProgressMeterDaemonUnitTest extends BaseTest { private TestingProgressMeter(final long poll) { super(null, "test", new GenomeLocSortedSet(genomeLocParser), poll); + super.start(); } @Override