Skip to content

Commit

Permalink
only need to check if /proc/36642/cgroup exists, not if its executabl…
Browse files Browse the repository at this point in the history
…e...
  • Loading branch information
scholtalbers committed Mar 2, 2018
1 parent 7c40725 commit 7bf04bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/galaxy/jobs/metrics/instrumenters/cgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ def job_properties(self, job_id, job_directory):
return metrics

def __record_cgroup_cpu_usage(self, job_directory):
return """if [ -x /proc/$$/cgroup ]; then cat /proc/$$/cgroup | awk -F':' '$2=="cpuacct,cpu"{print $2":"$3}' | xargs -I{} cgget -g {} > %(metrics)s ; else echo "" > %(metrics)s; fi""" % {"metrics": self.__cgroup_metrics_file(job_directory)}
return """if [ -e /proc/$$/cgroup ]; then cat /proc/$$/cgroup | awk -F':' '$2=="cpuacct,cpu"{print $2":"$3}' | xargs -I{} cgget -g {} > %(metrics)s ; else echo "" > %(metrics)s; fi""" % {"metrics": self.__cgroup_metrics_file(job_directory)}

def __record_cgroup_memory_usage(self, job_directory):
return """if [ -x /proc/$$/cgroup ]; then cat /proc/$$/cgroup | awk -F':' '$2=="memory"{print $2":"$3}' | xargs -I{} cgget -g {} >> %(metrics)s ; else echo "" > %(metrics)s; fi""" % {"metrics": self.__cgroup_metrics_file(job_directory)}
return """if [ -e /proc/$$/cgroup ]; then cat /proc/$$/cgroup | awk -F':' '$2=="memory"{print $2":"$3}' | xargs -I{} cgget -g {} >> %(metrics)s ; else echo "" > %(metrics)s; fi""" % {"metrics": self.__cgroup_metrics_file(job_directory)}

def __cgroup_metrics_file(self, job_directory):
return self._instrument_file_path(job_directory, "_metrics")
Expand Down

0 comments on commit 7bf04bc

Please sign in to comment.