-
Notifications
You must be signed in to change notification settings - Fork 95
CPU and Max RSS Analysis tools #6663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
oliver-sanders
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
fb1b12b to
c5d30b3
Compare
Changed the name of the profiler module. Linting Profiler sends KB instead of bytes Time Series now working CPU/Memory Logging working
4a6dbe8 to
30a7bb0
Compare
Initial profiler implementation (non working) Changed the name of the profiler module. Linting Profiler sends KB instead of bytes Time Series now working CPU/Memory Logging working Adding profiler unit tests updating tests Fail gracefully if cgroups cannot be found Revert "Fail gracefully if cgroups cannot be found" This reverts commit 92e1e11c9b392b4742501d399f191f590814e95e. Linting Modifying unit tests Linting Changed the name of the profiler module. Profiler sends KB instead of bytes Time Series now working
Co-authored-by: Hilary James Oliver <[email protected]>
* The COPYING file appears to have moved from `dist-info/COPYING` into `dist-info/licenses/COPYING`.
Co-authored-by: Hilary James Oliver <[email protected]>
* Attempt to fix flaky test. * Cut out shell profile files to omit some spurious stderr.
Co-authored-by: Hilary James Oliver <[email protected]>
* Attempt to fix flaky test. * Cut out shell profile files to omit some spurious stderr.
Revert "Fail gracefully if cgroups cannot be found" This reverts commit 92e1e11c9b392b4742501d399f191f590814e95e. Adding profiler unit tests updating tests
|
We seem to have agreement on the validity cgroups field(s) we're polling, we should be able to push forward with this quickly now. Last couple of outstanding comments:
Then we can get Dave to ok the cgroup stuff and we're away... |
How do I do that? I couldn't see a way to do it. Since I'm not calling the function, its the registered function for sigkill *EDIT. Sorry, I didn't see the pull request, I'll go through it now |
cylc/flow/scripts/profiler.py
Outdated
| try: | ||
| # Get the cgroup information for the current process | ||
| with open('/proc/' + str(pid) + '/cgroup', 'r') as f: | ||
| result = f.read() | ||
| result = PID_REGEX.search(result).group() | ||
| return result | ||
| except FileNotFoundError as err: | ||
| raise FileNotFoundError( | ||
| '/proc/' + str(pid) + '/cgroup not found') from err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is catching a FileNotFoundError and raising a near identical FileNotFoundError in it's place.
I think the intention was to replace a scary looking traceback with a more informative error. If so, try this out (note you'll likely need to import cylc.exceptions.CylcError first):
try:
# Get the cgroup information for the current process
with open('/proc/' + str(pid) + '/cgroup', 'r') as f:
result = f.read()
result = PID_REGEX.search(result).group()
return result
except FileNotFoundError as err:
- raise FileNotFoundError(
- '/proc/' + str(pid) + '/cgroup not found') from err
+ raise CylcError('CGroup file not found: {err}') from NoneCylcErroris the class that (almost) all Cylc exceptions inherit from.- tldr; If you want a short clean error message, use
CylcErroror a subclass of it. If you want a scary traceback, use a plain exception. CylcErrors get special treatment, thestr(exc)gets written to stderr in red text. The traceback is not displayed unless running with--debug.- Note the
from Nonehides the parent exception, preventing it from appearing in the traceback.
dpmatthews
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cgroups usage looks sensible
3320697 to
f5e5af8
Compare
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.