toil.utils.toilStats

Reports statistical data about a given Toil workflow.

Module Contents

Classes

ColumnWidths

Convenience object that stores the width of columns for printing. Helps make things pretty.

Functions

padStr(s[, field])

Pad the beginning of a string with spaces, if necessary.

prettyMemory(k[, field, isBytes])

Given input k as kilobytes, return a nicely formatted string.

prettyTime(t[, field])

Given input t as seconds, return a nicely formatted string.

reportTime(t, options[, field])

Given t seconds, report back the correct format as string.

reportMemory(k, options[, field, isBytes])

Given k kilobytes, report back the correct format as string.

reportNumber(n[, field])

Given n an integer, report back the correct format as string.

sprintTag(key, tag, options[, columnWidths])

Generate a pretty-print ready string from a JTTag().

decorateTitle(title, options)

Add a marker to TITLE if the TITLE is sorted on.

decorateSubHeader(title, columnWidths, options)

Add a marker to the correct field if the TITLE is sorted on.

get(tree, name)

Return a float value attribute NAME from TREE.

sortJobs(jobTypes, options)

Return a jobTypes all sorted.

reportPrettyData(root, worker, job, job_types, options)

Print the important bits out.

computeColumnWidths(job_types, worker, job, options)

Return a ColumnWidths() object with the correct max widths.

updateColumnWidths(tag, cw, options)

Update the column width attributes for this tag's fields.

buildElement(element, items, itemName)

Create an element for output.

createSummary(element, containingItems, ...)

getStats(jobStore)

Collect and return the stats and config data.

processData(config, stats)

Collate the stats and report

reportData(tree, options)

add_stats_options(parser)

main()

Reports stats on the workflow, use with --stats option to toil.

Attributes

logger

category_choices

sort_category_choices

sort_field_choices

toil.utils.toilStats.logger
class toil.utils.toilStats.ColumnWidths[source]

Convenience object that stores the width of columns for printing. Helps make things pretty.

title(category)[source]

Return the total printed length of this category item.

Parameters:

category (str) –

Return type:

int

getWidth(category, field)[source]
Parameters:
  • category (str) –

  • field (str) –

Return type:

int

setWidth(category, field, width)[source]
Parameters:
  • category (str) –

  • field (str) –

  • width (int) –

Return type:

None

report()[source]
Return type:

None

toil.utils.toilStats.padStr(s, field=None)[source]

Pad the beginning of a string with spaces, if necessary.

Parameters:
  • s (str) –

  • field (Optional[int]) –

Return type:

str

toil.utils.toilStats.prettyMemory(k, field=None, isBytes=False)[source]

Given input k as kilobytes, return a nicely formatted string.

Parameters:
  • k (float) –

  • field (Optional[int]) –

  • isBytes (bool) –

Return type:

str

toil.utils.toilStats.prettyTime(t, field=None)[source]

Given input t as seconds, return a nicely formatted string.

Parameters:
  • t (float) –

  • field (Optional[int]) –

Return type:

str

toil.utils.toilStats.reportTime(t, options, field=None)[source]

Given t seconds, report back the correct format as string.

Parameters:
Return type:

str

toil.utils.toilStats.reportMemory(k, options, field=None, isBytes=False)[source]

Given k kilobytes, report back the correct format as string.

Parameters:
Return type:

str

toil.utils.toilStats.reportNumber(n, field=None)[source]

Given n an integer, report back the correct format as string.

Parameters:
  • n (float) –

  • field (Optional[int]) –

Return type:

str

toil.utils.toilStats.sprintTag(key, tag, options, columnWidths=None)[source]

Generate a pretty-print ready string from a JTTag().

Parameters:
Return type:

str

toil.utils.toilStats.decorateTitle(title, options)[source]

Add a marker to TITLE if the TITLE is sorted on.

Parameters:
Return type:

str

toil.utils.toilStats.decorateSubHeader(title, columnWidths, options)[source]

Add a marker to the correct field if the TITLE is sorted on.

Parameters:
Return type:

str

toil.utils.toilStats.get(tree, name)[source]

Return a float value attribute NAME from TREE.

Parameters:
Return type:

float

toil.utils.toilStats.sortJobs(jobTypes, options)[source]

Return a jobTypes all sorted.

Parameters:
Return type:

List[Any]

toil.utils.toilStats.reportPrettyData(root, worker, job, job_types, options)[source]

Print the important bits out.

Parameters:
Return type:

str

toil.utils.toilStats.computeColumnWidths(job_types, worker, job, options)[source]

Return a ColumnWidths() object with the correct max widths.

Parameters:
Return type:

ColumnWidths

toil.utils.toilStats.updateColumnWidths(tag, cw, options)[source]

Update the column width attributes for this tag’s fields.

Parameters:
Return type:

None

toil.utils.toilStats.buildElement(element, items, itemName)[source]

Create an element for output.

Parameters:
Return type:

toil.lib.expando.Expando

toil.utils.toilStats.createSummary(element, containingItems, containingItemName, getFn)[source]
Parameters:
Return type:

None

toil.utils.toilStats.getStats(jobStore)[source]

Collect and return the stats and config data.

Parameters:

jobStore (toil.jobStores.abstractJobStore.AbstractJobStore) –

Return type:

toil.lib.expando.Expando

toil.utils.toilStats.processData(config, stats)[source]

Collate the stats and report

Parameters:
Return type:

toil.lib.expando.Expando

toil.utils.toilStats.reportData(tree, options)[source]
Parameters:
Return type:

None

toil.utils.toilStats.category_choices = ['time', 'clock', 'wait', 'memory']
toil.utils.toilStats.sort_category_choices = ['time', 'clock', 'wait', 'memory', 'alpha', 'count']
toil.utils.toilStats.sort_field_choices = ['min', 'med', 'ave', 'max', 'total']
toil.utils.toilStats.add_stats_options(parser)[source]
Parameters:

parser (argparse.ArgumentParser) –

Return type:

None

toil.utils.toilStats.main()[source]

Reports stats on the workflow, use with –stats option to toil.

Return type:

None