diff --git a/lib/galaxy/job_metrics/instrumenters/cgroup.py b/lib/galaxy/job_metrics/instrumenters/cgroup.py index 66da4f9389f..406dcf0da0b 100644 --- a/lib/galaxy/job_metrics/instrumenters/cgroup.py +++ b/lib/galaxy/job_metrics/instrumenters/cgroup.py @@ -1,8 +1,6 @@ """The module describes the ``cgroup`` job metrics plugin.""" -import decimal import logging -import numbers from collections import namedtuple from typing import ( Any, @@ -123,8 +121,13 @@ class CgroupPluginFormatter(formatting.JobMetricFormatter): 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) + else: + try: + int_value = int(value) + if value == int_value: + value = int_value + except TypeError: + pass return formatting.FormattedMetric(title, str(value))