public class SummaryUtil extends Object
Constructor and Description |
---|
SummaryUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addSummaryFooterForFailedPipeline(String helpInfo)
Called when pipeline fails to add summary details to summary file, if possible.
|
static String |
getCountSummary(Map<String,String> map,
String label,
boolean addTotal)
Return the min/max/mean/median summary stats for the given metadata numeric column
|
static String |
getFooter()
Print the final lines of the summary with overall status, runtime, and the download scp command if applicable.
|
static String |
getInputSummary(BioModule module)
Build a summary of the input files for the given module
|
static String |
getMean(Collection<?> vals,
boolean isDouble)
Return the mean value
|
static String |
getMedian(Collection<?> vals,
boolean isDouble)
Return the median value
|
protected static Integer |
getModuleNumber()
Read the summary file to find the last completed module number and return the next number.
|
static String |
getModuleRunTime(BioModule module)
Return duration module ran based on modified data of started file, formatted for display (as hours, minutes,
seconds).
|
static String |
getOutputDirSummary(BioModule module)
Return summary of
BioModule output directory, with metrics:
Number of output files
Mean output file size
Path of new metadata file if any created
|
static int |
getPad(String label)
Summary count label padding as label length + 18
|
static String |
getRunTime(long duration)
Get runtime message (formatted as hours, minutes, seconds) based on startTime passed.
|
static String |
getScriptDirSummary(ScriptModule module)
Return summary of the
ScriptModule script directory with metrics:
Print main script name
Number of worker scripts run
Number of worker scripts successful/failed/incomplete
Average worker script run time
Longest running worker script names/duration
Longest running workers script names/duration
|
protected static String |
getScriptRunTime(Long duration)
Get the script runtime in hours and minutes
|
static String |
getSummary()
Pipeline execution summary.
|
static File |
getSummaryFile()
Getter for the summary file.
|
static void |
reportFailure(Exception ex)
Report exception details in the summary
|
static void |
reportSuccess(BioModule module)
After each module completes, this method is called to track the execution summary.
If module is null, the pipeline is complete/successful. |
protected static void |
resetModuleSummary(BioModule module)
Modules can be forced to reset to incomplete status.
|
protected static void |
saveSummary(String summary)
Save the summary generated to the pipeline root directory.
|
static void |
updateNumAttempts()
Update the number of attempts in the summary file (called from restart)
|
public static void addSummaryFooterForFailedPipeline(String helpInfo)
helpInfo
- Help Infopublic static String getCountSummary(Map<String,String> map, String label, boolean addTotal) throws Exception
map
- Map(sampleId,count)label
- Context labeladdTotal
- Boolean if should include total countException
- if errors occurpublic static String getFooter() throws Exception
Exception
- if any error occurspublic static String getInputSummary(BioModule module)
module
- BioModule to summarizepublic static String getMean(Collection<?> vals, boolean isDouble)
vals
- Collection of valuesisDouble
- if the Collection holds Double valuespublic static String getMedian(Collection<?> vals, boolean isDouble)
vals
- Collection of valuesisDouble
- if the Collection holds Double valuespublic static String getModuleRunTime(BioModule module)
module
- BioModulepublic static String getOutputDirSummary(BioModule module)
BioModule
output directory, with metrics:
module
- BioModule to summarizepublic static int getPad(String label)
label
- Labelpublic static String getRunTime(long duration)
duration
- Milliseconds of run timepublic static String getScriptDirSummary(ScriptModule module)
ScriptModule
script directory with metrics:
module
- ScriptModule to summarizepublic static String getSummary()
public static File getSummaryFile()
public static void reportFailure(Exception ex) throws Exception
ex
- Exception thrown causing application runtime failureException
- if unable to save the updates summarypublic static void reportSuccess(BioModule module) throws Exception
module
- Completed moduleException
- if unable to build the summarypublic static void updateNumAttempts() throws Exception
Exception
- if unable to update the summary fileprotected static Integer getModuleNumber() throws Exception
Exception
- if unable to determine the module numberprotected static String getScriptRunTime(Long duration)
duration
- in millisecondsprotected static void resetModuleSummary(BioModule module) throws Exception
module
- Rerun moduleException
- if unable to reset the summary