Enable control of reporting periodicity
This commit is contained in:
parent
5e39b59ef3
commit
aace73e884
|
|
@ -52,6 +52,9 @@ public class GATKArgumentCollection {
|
||||||
// the default value of the stop of the expanded window
|
// the default value of the stop of the expanded window
|
||||||
public static final int DEFAULT_REFERENCE_WINDOW_STOP = 0;
|
public static final int DEFAULT_REFERENCE_WINDOW_STOP = 0;
|
||||||
|
|
||||||
|
// the default time in seconds between progress meter calls
|
||||||
|
public final static long DEFAULT_SECONDS_BETWEEN_PROGRESS_UPDATES = 10;
|
||||||
|
|
||||||
/** the constructor */
|
/** the constructor */
|
||||||
public GATKArgumentCollection() {
|
public GATKArgumentCollection() {
|
||||||
}
|
}
|
||||||
|
|
@ -354,6 +357,10 @@ public class GATKArgumentCollection {
|
||||||
@Argument(fullName = "globalQScorePrior", shortName = "globalQScorePrior", doc = "Global Qscore Bayesian prior to use for BQSR", required = false)
|
@Argument(fullName = "globalQScorePrior", shortName = "globalQScorePrior", doc = "Global Qscore Bayesian prior to use for BQSR", required = false)
|
||||||
public double globalQScorePrior = -1.0;
|
public double globalQScorePrior = -1.0;
|
||||||
|
|
||||||
|
@Advanced
|
||||||
|
@Argument(fullName="secondsBetweenProgressUpdates", shortName = "secondsBetweenProgressUpdates", doc = "Time interval for process meter information output (in seconds)", required=false)
|
||||||
|
public long secondsBetweenProgressUpdates = DEFAULT_SECONDS_BETWEEN_PROGRESS_UPDATES;
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,8 @@ public abstract class MicroScheduler implements MicroSchedulerMBean {
|
||||||
// Create the progress meter, and register it with the analysis engine
|
// Create the progress meter, and register it with the analysis engine
|
||||||
engine.registerProgressMeter(new ProgressMeter(progressLogFile,
|
engine.registerProgressMeter(new ProgressMeter(progressLogFile,
|
||||||
availableTraversalEngines.peek().getTraversalUnits(),
|
availableTraversalEngines.peek().getTraversalUnits(),
|
||||||
engine.getRegionsOfGenomeBeingProcessed()));
|
engine.getRegionsOfGenomeBeingProcessed(),
|
||||||
|
engine.getArguments().secondsBetweenProgressUpdates));
|
||||||
|
|
||||||
// Now that we have a progress meter, go through and initialize the traversal engines
|
// Now that we have a progress meter, go through and initialize the traversal engines
|
||||||
for ( final TraversalEngine traversalEngine : allCreatedTraversalEngines )
|
for ( final TraversalEngine traversalEngine : allCreatedTraversalEngines )
|
||||||
|
|
|
||||||
|
|
@ -170,22 +170,15 @@ 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
|
||||||
|
* @param secondsBetweenProgressUpdates how frequently (in seconds) to print progress
|
||||||
*/
|
*/
|
||||||
public ProgressMeter(final File performanceLogFile,
|
public ProgressMeter(final File performanceLogFile,
|
||||||
final String processingUnitName,
|
|
||||||
final GenomeLocSortedSet processingIntervals) {
|
|
||||||
this(performanceLogFile, processingUnitName, processingIntervals, ProgressMeterDaemon.DEFAULT_POLL_FREQUENCY_MILLISECONDS);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ProgressMeter(final File performanceLogFile,
|
|
||||||
final String processingUnitName,
|
final String processingUnitName,
|
||||||
final GenomeLocSortedSet processingIntervals,
|
final GenomeLocSortedSet processingIntervals,
|
||||||
final long pollingFrequency) {
|
final long secondsBetweenProgressUpdates) {
|
||||||
if ( processingUnitName == null ) throw new IllegalArgumentException("processingUnitName cannot be null");
|
if ( processingUnitName == null ) throw new IllegalArgumentException("processingUnitName cannot be null");
|
||||||
if ( processingIntervals == null ) throw new IllegalArgumentException("Target intervals cannot be null");
|
if ( processingIntervals == null ) throw new IllegalArgumentException("Target intervals cannot be null");
|
||||||
|
|
||||||
|
|
@ -212,7 +205,7 @@ public class ProgressMeter {
|
||||||
targetSizeInBP = processingIntervals.coveredSize();
|
targetSizeInBP = processingIntervals.coveredSize();
|
||||||
|
|
||||||
// start up the timer
|
// start up the timer
|
||||||
progressMeterDaemon = new ProgressMeterDaemon(this, pollingFrequency);
|
progressMeterDaemon = new ProgressMeterDaemon(this, secondsBetweenProgressUpdates);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProgressMeterDaemon getProgressMeterDaemon() {
|
public ProgressMeterDaemon getProgressMeterDaemon() {
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
package org.broadinstitute.gatk.utils.progressmeter;
|
package org.broadinstitute.gatk.utils.progressmeter;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Daemon thread that periodically prints the progress of the progress meter
|
* Daemon thread that periodically prints the progress of the progress meter
|
||||||
*
|
*
|
||||||
|
|
@ -33,20 +35,10 @@ package org.broadinstitute.gatk.utils.progressmeter;
|
||||||
* Time: 9:16 PM
|
* Time: 9:16 PM
|
||||||
*/
|
*/
|
||||||
public final class ProgressMeterDaemon extends Thread {
|
public final class ProgressMeterDaemon extends Thread {
|
||||||
public final static long DEFAULT_POLL_FREQUENCY_MILLISECONDS = 10 * 1000;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How frequently should we poll and print progress?
|
* How frequently should we poll and print progress?
|
||||||
*/
|
*/
|
||||||
private final long pollFrequencyMilliseconds;
|
private final long secondsBetweenProgressUpdates;
|
||||||
|
|
||||||
/**
|
|
||||||
* How long are we waiting between print progress calls are issued?
|
|
||||||
* @return the time in milliseconds between progress meter calls
|
|
||||||
*/
|
|
||||||
private long getPollFrequencyMilliseconds() {
|
|
||||||
return pollFrequencyMilliseconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Are we to continue periodically printing status, or should we shut down?
|
* Are we to continue periodically printing status, or should we shut down?
|
||||||
|
|
@ -60,22 +52,19 @@ public final class ProgressMeterDaemon extends Thread {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new ProgressMeterDaemon printing progress for meter
|
* Create a new ProgressMeterDaemon printing progress for meter
|
||||||
* @param meter the progress meter to print progress of
|
* @param meter the progress meter to print progress
|
||||||
|
* @param secondsBetweenProgressUpdates how frequently (in seconds) to print progress
|
||||||
*/
|
*/
|
||||||
public ProgressMeterDaemon(final ProgressMeter meter, final long pollFrequencyMilliseconds) {
|
public ProgressMeterDaemon(final ProgressMeter meter, final long secondsBetweenProgressUpdates) {
|
||||||
if ( meter == null ) throw new IllegalArgumentException("meter cannot be null");
|
if ( meter == null ) throw new IllegalArgumentException("meter cannot be null");
|
||||||
if ( pollFrequencyMilliseconds <= 0 ) throw new IllegalArgumentException("pollFrequencyMilliseconds must be greater than 0 but got " + pollFrequencyMilliseconds);
|
if ( secondsBetweenProgressUpdates <= 0 ) throw new IllegalArgumentException("secondsBetweenProgressUpdates must be greater than 0 but got " + secondsBetweenProgressUpdates);
|
||||||
|
|
||||||
this.meter = meter;
|
this.meter = meter;
|
||||||
this.pollFrequencyMilliseconds = pollFrequencyMilliseconds;
|
this.secondsBetweenProgressUpdates = secondsBetweenProgressUpdates;
|
||||||
setDaemon(true);
|
setDaemon(true);
|
||||||
setName("ProgressMeterDaemon");
|
setName("ProgressMeterDaemon");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProgressMeterDaemon(final ProgressMeter meter) {
|
|
||||||
this(meter, DEFAULT_POLL_FREQUENCY_MILLISECONDS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tells this daemon thread to shutdown at the next opportunity, as the progress
|
* Tells this daemon thread to shutdown at the next opportunity, as the progress
|
||||||
* metering is complete.
|
* metering is complete.
|
||||||
|
|
@ -102,7 +91,7 @@ public final class ProgressMeterDaemon extends Thread {
|
||||||
meter.printProgress(false);
|
meter.printProgress(false);
|
||||||
meter.updateElapsedTimeInNanoseconds();
|
meter.updateElapsedTimeInNanoseconds();
|
||||||
try {
|
try {
|
||||||
Thread.sleep(getPollFrequencyMilliseconds());
|
Thread.sleep(TimeUnit.SECONDS.toMillis(secondsBetweenProgressUpdates));
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue