diff --git a/lib/galaxy/job_metrics/__init__.py b/lib/galaxy/job_metrics/__init__.py index 97c06b0762fb..0a315ffdf31d 100644 --- a/lib/galaxy/job_metrics/__init__.py +++ b/lib/galaxy/job_metrics/__init__.py @@ -107,7 +107,7 @@ def raw_to_dictifiable(raw_metric: RawMetric) -> DictifiableMetric: safety = DEFAULT_SAFETY return DictifiableMetric( title, - str(value), + value, str(metric_value), metric_name, metric_plugin, diff --git a/lib/galaxy/job_metrics/instrumenters/cgroup.py b/lib/galaxy/job_metrics/instrumenters/cgroup.py index 62caef9c81dc..66da4f9389f9 100644 --- a/lib/galaxy/job_metrics/instrumenters/cgroup.py +++ b/lib/galaxy/job_metrics/instrumenters/cgroup.py @@ -114,18 +114,18 @@ class CgroupPluginFormatter(formatting.JobMetricFormatter): - def format(self, key, value): + def format(self, key: str, value: Any) -> formatting.FormattedMetric: title = TITLES.get(key, key) if key in CONVERSION: - return title, CONVERSION[key](value) + return formatting.FormattedMetric(title, CONVERSION[key](value)) elif key.endswith("_bytes"): try: - return title, nice_size(value) + return formatting.FormattedMetric(title, nice_size(value)) except ValueError: pass elif isinstance(value, (decimal.Decimal, numbers.Integral, numbers.Real)) and value == int(value): value = int(value) - return title, value + return formatting.FormattedMetric(title, str(value)) class CgroupPlugin(InstrumentPlugin):