Warning
This document is for an in-development version of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.
Source code for galaxy.job_metrics.formatting
"""Utilities related to formatting job metrics for human consumption."""
[docs]class JobMetricFormatter(object):
"""Format job metric key-value pairs for human consumption in Web UI."""
[docs]def seconds_to_str(value):
"""Convert seconds to a simple simple string describing the amount of time."""
if value < 60:
return "%s seconds" % round(value, 2)
elif value < 3600:
return "%s minutes" % round(value / 60, 2)
else:
return "%s hours and %s minutes" % (round(value / 3600, 2), round((value % 3600) / 60, 2))