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
This commit is contained in:
Mark DePristo 2013-02-04 15:33:57 -05:00
parent eb847fa102
commit a281fa6548
6 changed files with 20 additions and 2 deletions

View File

@ -271,7 +271,9 @@ public class GenomeAnalysisEngine {
// create the output streams // create the output streams
initializeOutputStreams(microScheduler.getOutputTracker()); initializeOutputStreams(microScheduler.getOutputTracker());
logger.info("Creating shard strategy for " + readsDataSource.getReaderIDs().size() + " BAM files");
Iterable<Shard> shardStrategy = getShardStrategy(readsDataSource,microScheduler.getReference(),intervals); Iterable<Shard> shardStrategy = getShardStrategy(readsDataSource,microScheduler.getReference(),intervals);
logger.info("Done creating shard strategy");
// execute the microscheduler, storing the results // execute the microscheduler, storing the results
return microScheduler.execute(this.walker, shardStrategy); return microScheduler.execute(this.walker, shardStrategy);

View File

@ -139,6 +139,8 @@ public class HierarchicalMicroScheduler extends MicroScheduler implements Hierar
} }
public Object execute( Walker walker, Iterable<Shard> shardStrategy ) { public Object execute( Walker walker, Iterable<Shard> shardStrategy ) {
super.startingExecution();
// Fast fail for walkers not supporting TreeReducible interface. // Fast fail for walkers not supporting TreeReducible interface.
if (!( walker instanceof TreeReducible )) if (!( walker instanceof TreeReducible ))
throw new IllegalArgumentException("The GATK can currently run in parallel only with TreeReducible walkers"); throw new IllegalArgumentException("The GATK can currently run in parallel only with TreeReducible walkers");

View File

@ -80,6 +80,7 @@ public class LinearMicroScheduler extends MicroScheduler {
* @param shardStrategy A strategy for sharding the data. * @param shardStrategy A strategy for sharding the data.
*/ */
public Object execute(Walker walker, Iterable<Shard> shardStrategy) { public Object execute(Walker walker, Iterable<Shard> shardStrategy) {
super.startingExecution();
walker.initialize(); walker.initialize();
Accumulator accumulator = Accumulator.create(engine,walker); Accumulator accumulator = Accumulator.create(engine,walker);

View File

@ -300,6 +300,17 @@ public abstract class MicroScheduler implements MicroSchedulerMBean {
*/ */
public abstract Object execute(Walker walker, Iterable<Shard> shardStrategy); public abstract Object execute(Walker walker, Iterable<Shard> 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. * Retrieves the object responsible for tracking and managing output.
* @return An output tracker, for loading data in and extracting results. Will not be null. * @return An output tracker, for loading data in and extracting results. Will not be null.

View File

@ -154,6 +154,8 @@ public class ProgressMeter {
/** /**
* Create a new 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 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 processingUnitName the name of the unit type being processed, suitable for saying X seconds per processingUnitName
* @param processingIntervals the intervals being processed * @param processingIntervals the intervals being processed
@ -193,7 +195,6 @@ public class ProgressMeter {
// start up the timer // start up the timer
progressMeterDaemon = new ProgressMeterDaemon(this, pollingFrequency); progressMeterDaemon = new ProgressMeterDaemon(this, pollingFrequency);
start();
} }
public ProgressMeterDaemon getProgressMeterDaemon() { public ProgressMeterDaemon getProgressMeterDaemon() {
@ -205,7 +206,7 @@ public class ProgressMeter {
* daemon thread for periodic printing. * daemon thread for periodic printing.
*/ */
@Requires("progressMeterDaemon != null") @Requires("progressMeterDaemon != null")
private synchronized void start() { public synchronized void start() {
timer.start(); timer.start();
lastProgressPrintTime = timer.currentTime(); lastProgressPrintTime = timer.currentTime();

View File

@ -63,6 +63,7 @@ public class ProgressMeterDaemonUnitTest extends BaseTest {
private TestingProgressMeter(final long poll) { private TestingProgressMeter(final long poll) {
super(null, "test", new GenomeLocSortedSet(genomeLocParser), poll); super(null, "test", new GenomeLocSortedSet(genomeLocParser), poll);
super.start();
} }
@Override @Override