Skip to content

Commit

Permalink
Separate cgroup metrics default params from titles
Browse files Browse the repository at this point in the history
  • Loading branch information
natefoo committed Dec 13, 2023
1 parent 79da254 commit ec426dc
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions lib/galaxy/job_metrics/instrumenters/cgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,24 @@
log = logging.getLogger(__name__)

VALID_VERSIONS = ("auto", "1", "2")
DEFAULT_PARAMS = (
# cgroupsv1 - probably more than useful but don't remove any for legacy reasons
"memory.memsw.max_usage_in_bytes",
"memory.max_usage_in_bytes",
"memory.limit_in_bytes",
"memory.memsw.limit_in_bytes",
"memory.soft_limit_in_bytes",
"memory.failcnt",
"memory.oom_control.oom_kill_disable",
"memory.oom_control.under_oom",
"cpuacct.usage",
# cgroupsv2
"memory.events.oom_kill",
"memory.peak",
"cpu.stat.system_usec",
"cpu.stat.usage_usec",
"cpu.stat.user_usec",
)
TITLES = {
# cgroupsv1
"memory.memsw.max_usage_in_bytes": "Max memory usage (MEM+SWP)",
Expand All @@ -44,9 +62,9 @@
"memory.max": "Memory usage hard limit",
"memory.min": "Hard memory protection",
"memory.peak": "Max memory usage recorded",
"cpu.stat.system_usec": "CPU system time (seconds)",
"cpu.stat.usage_usec": "CPU usage time (seconds)",
"cpu.stat.user_usec": "CPU user time (seconds)",
"cpu.stat.system_usec": "CPU system time",
"cpu.stat.usage_usec": "CPU usage time",
"cpu.stat.user_usec": "CPU user time",
}
CONVERSION = {
"memory.oom_control.oom_kill_disable": lambda x: "No" if x == 1 else "Yes",
Expand Down Expand Up @@ -126,7 +144,7 @@ def __init__(self, **kwargs):
elif params_str:
params = [v.strip() for v in params_str.split(",")]
else:
params = list(TITLES.keys())
params = list(DEFAULT_PARAMS)
self.params = params

def post_execute_instrument(self, job_directory: str) -> List[str]:
Expand Down

0 comments on commit ec426dc

Please sign in to comment.