Package ubic.gemma.cli.batch
Class BatchTaskProgressReporter
java.lang.Object
ubic.gemma.cli.batch.BatchTaskProgressReporter
- All Implemented Interfaces:
AutoCloseable
Report progress on batch tasks.
- Author:
- poirigui
-
Constructor Summary
ConstructorsConstructorDescriptionBatchTaskProgressReporter(BatchTaskSummaryWriter summaryWriter, Console console) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddErrorObject(Serializable errorObject, Exception exception) Add an error object based on an exception.voidaddErrorObject(Serializable errorObject, String message) Add an error object without a cause stacktrace.voidaddErrorObject(Serializable errorObject, String message, Throwable throwable) Add an error object with a stacktrace to indicate failure in a batch processing.voidaddSuccessObject(Serializable successObject) voidaddSuccessObject(Serializable successObject, String message) Add a success object to indicate success in a batch processing.voidaddWarningObject(Serializable warningObject, String message) voidaddWarningObject(Serializable warningObject, String message, Throwable throwable) voidclose()Print out a summary of what the program did.intObtain the number of completed tasks (either with a success or failure result).booleanIndicate if error objects have been reported.voidvoidsetEstimatedMaxTasks(int estimatedMaxTasks) Set the maximum number of tasks that are expected to be run.voidsetReportFrequencyMillis(int reportFrequencyMillis) Set the frequency at which to report progress in milliseconds.
-
Constructor Details
-
BatchTaskProgressReporter
- Parameters:
summaryWriter- a writer to report batch task results, results are emitted as they are added andBatchTaskSummaryWriter.close()is invoked when the reporter is closed to provide an opportunity to write a summaryconsole- a console capable of receiving ANSI escape codes
-
-
Method Details
-
setReportFrequencyMillis
public void setReportFrequencyMillis(int reportFrequencyMillis) Set the frequency at which to report progress in milliseconds.Repeated calls to
reportProgress()will be ignored until at least this amount of time has passed.The default is to report task progress every 30 seconds.
-
hasErrorObjects
public boolean hasErrorObjects()Indicate if error objects have been reported. -
getCompletedTasks
public int getCompletedTasks()Obtain the number of completed tasks (either with a success or failure result). -
setEstimatedMaxTasks
public void setEstimatedMaxTasks(int estimatedMaxTasks) Set the maximum number of tasks that are expected to be run. -
addSuccessObject
Add a success object to indicate success in a batch processing.- Parameters:
successObject- object that was processedmessage- success message
-
addSuccessObject
- See Also:
-
addWarningObject
-
addWarningObject
public void addWarningObject(@Nullable Serializable warningObject, String message, Throwable throwable) -
addErrorObject
Add an error object with a stacktrace to indicate failure in a batch processing.This is intended to be used when an
Exceptionis caught.- Parameters:
errorObject- object that was processedmessage- error messagethrowable- throwable to produce a stacktrace
-
addErrorObject
Add an error object without a cause stacktrace.- See Also:
-
addErrorObject
Add an error object based on an exception.- See Also:
-
reportProgress
public void reportProgress() -
close
Print out a summary of what the program did. Useful when analyzing lists of experiments etc. Use the 'successObjects' and 'errorObjects'- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-