public class SummaryUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
PIPELINE_STATUS |
| Constructor and Description |
|---|
SummaryUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addSummaryFooterForFailedPipeline()
Called when pipeline fails to add summary details to summary file, if possible.
|
static String |
displayAsciiArt()
Print the application name *bigly* with some ASCII art :-)
|
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 Double |
getDoubleRatio(Double num,
Double denom)
Return a num/denom ratio
|
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 Long |
getLongRatio(Double num,
Double denom)
Return a num/denom ratio floor value (do not round up)
|
static String |
getMean(Collection<?> vals,
boolean isDouble)
Return the mean value
|
static String |
getMedian(Collection<?> vals,
boolean isDouble)
Return the median value
|
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 boolean |
sendHostInfo(File pipelineDir)
Write the system host info.
|
static void |
touchSystemInfo()
Save information about the system, such as OS name and version.
|
static void |
updateNumAttempts()
Update the number of attempts in the summary file (called from restart)
|
public static final String PIPELINE_STATUS
public static void touchSystemInfo()
public static boolean sendHostInfo(File pipelineDir)
pipelineDir - public static void addSummaryFooterForFailedPipeline()
public static String displayAsciiArt()
public 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 Double getDoubleRatio(Double num, Double denom)
num - Numeratordenom - Denominatorpublic static String getFooter() throws Exception
Exception - if any error occurspublic static String getInputSummary(BioModule module)
module - BioModule to summarizepublic static Long getLongRatio(Double num, Double denom)
num - Numeratordenom - Denominatorpublic 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 String getScriptRunTime(Long duration)
duration - in millisecondsprotected static void resetModuleSummary(BioModule module) throws Exception
module - Rerun moduleException - if unable to reset the summary