Package uk.ac.ebi.utils.runcontrol
Class PercentProgressLogger
java.lang.Object
uk.ac.ebi.utils.runcontrol.ProgressLogger
uk.ac.ebi.utils.runcontrol.PercentProgressLogger
It's like ProgressLogger
but reports percentages, given a max value that you set initially.
Note that the prog report action
receives the progress percentages, not
the absolute values.
Instead, ProgressLogger.update(long)
and its variants receives an absolute increment, as this is to be used with the
progressResolution property
.
ProgressLogger.getProgress()
reports the absolute progress too, while getPercentProgress()
is provided as
a shortcut to the percent progress.
- Author:
- brandizi
- Date:
- 22 May 2019
-
Constructor Summary
ConstructorDescriptionPercentProgressLogger
(long maxProgress) PercentProgressLogger
(String logMessageTemplate, long maxProgress) PercentProgressLogger
(String logMessageTemplate, long maxProgress, long progressResolutionPercent) -
Method Summary
Modifier and TypeMethodDescriptionlong
Every progress is reported in integer percentage points calculated with respect to this max value.double
Usesthe absolute progress
andgetMaxProgress()
to report the 0-100 progressprotected void
progressReport
(long oldProgress, long newProgress) Invoked byProgressLogger.update(long)
, decides if we have to log the new progress and possibly does it.void
setMaxProgress
(long maxProgress) Methods inherited from class uk.ac.ebi.utils.runcontrol.ProgressLogger
appendProgressReportAction, getLoggingLevel, getLogMessageTemplate, getProgress, getProgressReportAction, getProgressResolution, reset, setIsThreadSafe, setLoggingLevel, setLogMessageTemplate, setProgressReportAction, setProgressResolution, update, updateWithIncrement, updateWithIncrement
-
Constructor Details
-
PercentProgressLogger
public PercentProgressLogger(String logMessageTemplate, long maxProgress, long progressResolutionPercent) -
PercentProgressLogger
-
PercentProgressLogger
public PercentProgressLogger(long maxProgress)
-
-
Method Details
-
progressReport
protected void progressReport(long oldProgress, long newProgress) Description copied from class:ProgressLogger
Invoked byProgressLogger.update(long)
, decides if we have to log the new progress and possibly does it. If yes, it invokesProgressLogger.getProgressReportAction()
.- Overrides:
progressReport
in classProgressLogger
-
getMaxProgress
public long getMaxProgress()Every progress is reported in integer percentage points calculated with respect to this max value. Methods likeProgressLogger.update(long)
should keep updating with the absolute progress and thenprogressReport(long, long)
will convert everything as needed. -
setMaxProgress
public void setMaxProgress(long maxProgress) -
getPercentProgress
public double getPercentProgress()Usesthe absolute progress
andgetMaxProgress()
to report the 0-100 progress
-