CPU and Max RSS Analysis tools#6663
Conversation
fb1b12b to
c5d30b3
Compare
30a7bb0 to
7091711
Compare
| # You should have received a copy of the GNU General Public License | ||
| # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| #------------------------------------------------------------------------------- | ||
| # cylc profile test |
There was a problem hiding this comment.
This test will run regular background jobs, no slurm / pbs / whatever, so no cgroups.
I think this is testing that the profiler will not cause the job to fail, even if it cannot poll cgroups? Which is worthwhile testing.
We should test the jobs stderr for the line(s) written by the profiler script complaining of the fault.
There was a problem hiding this comment.
The profiler actually fails in this test, but the test passes anyway because it doesn't check whether the profiler did anything useful.
I've had a crack at a test here: ChrisPaulBennett#1
A couple of the sub-tests don't pass at the moment because the cpu/memory are not returned if the job fails.
|
(please ignore the manylinux test failures, we'll be removing this test on master shortly) |
4f3d03a to
49fcbc8
Compare
|
I'm getting lots of failures with this (admittedly nasty) workflow on localhost: [task parameters]
time = 1..10
reps = 1..5
[scheduling]
cycling mode = integer
[[graph]]
R1 = task<time><reps>
[runtime]
[[task<time><reps>]]
script = sleep $CYLC_TASK_PARAM_timeAbout 2/3 of tasks have Full Traceback |
|
Note, it's not really valid to configure the profiler for the localhost platform as the job isn't running in a cgroup, but jobs that exit faster than the profiler's poll interval is an edge case that we should handle. |
68b0687 to
66acd1f
Compare
Probably need some user safety rails/warnings about that |
It's difficult for us to say which job runners do or do not support cgroup profiling. The best we can do is to document it. |
|
I'm not sure how to deal with the linting failure. My Perl is rusty, at best. |
|
Works fine for me: $ ctb -v tests/functional/jobscript/02-profiler.t -p '*'
ok 1 - 02-profiler-validate
ok 2 - 02-profiler-run
ok 20179 ms ( 0.01 usr 0.01 sys + 3.16 cusr 1.10 csys = 4.28 CPU)
[12:56:44]
All tests successful.
Files=1, Tests=2, 24 wallclock secs ( 0.02 usr 0.01 sys + 3.16 cusr 1.10 csys = 4.29 CPU)
Result: PASS
$ git diff
diff --git a/tests/functional/jobscript/02-profiler.t b/tests/functional/jobscript/02-profiler.t
index 1d8dbc548..601d12971 100644
--- a/tests/functional/jobscript/02-profiler.t
+++ b/tests/functional/jobscript/02-profiler.t
@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------
# cylc profile test
-REQUIRE_PLATFORM='runner:?(pbs|slurm)'
+export REQUIRE_PLATFORM='runner:?(pbs|slurm)'
. "$(dirname "$0")/test_header"
#-------------------------------------------------------------------------------
set_test_number 2
$ etc/bin/shellchecker
$ echo $?
0 |
|
I've tested the CPU times as a sanity check that the numbers are correct. And It looks good to me. |
Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com>
Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com>
| most circumstances | ||
| ''') | ||
| Conf('polling interval', VDR.V_INTEGER, | ||
| default=10, |
There was a problem hiding this comment.
Has been discussed: Information on the impacts of polling are scarce and contradictory. We will leave this at 10s to play it safe.
MetRonnie
left a comment
There was a problem hiding this comment.
@oliver-sanders might want to cast your eye over this too
Fix profiler silent failures
|
Still getting errors running some test HPC jobs. @ChrisPaulBennett, could you try putting together a test workflow to replicate:
|
|
|
| if "max" not in line: | ||
| return int(line) | ||
| memory_max_file = cgroup_memory_path / "memory.max" | ||
| line = memory_max_file.read_text().splitlines()[0] |
There was a problem hiding this comment.
This reads the whole file, we might want to stick with only reading the first line, i.e:
with open(...) as myfile:
line = myfile.readline()| # NOTE: This test will run the Cylc profiler on the given test platform. | ||
| # The test platform may need to be configured for this to work (e.g. | ||
| # "cgroups path" may need to be set). | ||
| export REQUIRE_PLATFORM='runner:?(pbs|slurm) comms:tcp' |
There was a problem hiding this comment.
Making this change allows us to run the test on remote platforms (i.e, _remote*) as well as local ones (i.e, _local*). I think it's because tests are hardcoded to run on local platforms only, you have to "unlock" remote testing explicitly.
| export REQUIRE_PLATFORM='runner:?(pbs|slurm) comms:tcp' | |
| export REQUIRE_PLATFORM='loc:* runner:?(pbs|slurm) comms:tcp' |
This is how I got it to run on _remote_pbs_indep_tcp.


This apart of 3 pull requests for adding CPU time and Max RSS analysis to the Cylc UI.
This adds the Max RSS and CPU time (as measured by cgroups) to the table view, box plot and time series views.
This adds a python profiler script. This profiler will will be ran by cylc in the same crgroup as the cylc task. It will periodically poll cgroups and save data to a file. Cylc will then store these values in the sql db file.
Linked to;
cylc/cylc-ui#2100
cylc/cylc-uiserver#675
Check List
CONTRIBUTING.mdand added my name as a Code Contributor.setup.cfg(andconda-environment.ymlif present).?.?.xbranch.