-
Notifications
You must be signed in to change notification settings - Fork 94
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
replace pkg_resources with importlib_metadata and packaging #5790
Conversation
c74f642
to
575fb13
Compare
Great. Cylc 8 command start-up time on our HPC can be pretty dire. |
This combined with #5770 could see a saving of up to 2s on They now take ~1.5s for me (results and savings may differ wildly based on FS characteristics): $ /usr/bin/time -v cylc message generic 1234 foo whatever 2>&1 | grep Elapsed
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:01.53
$ /usr/bin/time -v cylc message generic 1234 foo whatever 2>&1 | grep Elapsed
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:01.69
$ /usr/bin/time -v cylc message generic 1234 foo whatever 2>&1 | grep Elapsed
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:01.19 Of which ~0.6 seconds is the actual work of sending / writing messages. The remainder being overheads including the time taken to import the required code. So it should be possible to bring this number down further. I think the main low-hanging fruit is in splitting up overgrown modules to prevent CLI commands from importing more than they need to (e.g. #5369). |
|
(fixed and added test) |
IMO we should move the (GH Actions) linkcheck step into the lint workflow too |
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.
👍
(may need to fiddle the lint timeout, let's see what it does) |
run: | | ||
bandit -r --ini .bandit cylc/flow | ||
pytest cylc/flow tests/unit |
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.
If you're consolidating these into one step, it would be good to set -q
for quiet in PYTEST_ADDOPTS
, to prevent us having to scroll thousands of log lines to get to the test failures. Note that when CI=true
Pytest always outputs full diffs in assertion failures regardless of the verbosity option.
Also -l
for displaying the value of locals in traceback might be handy.
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.
I don't see combining these sections as a reason for reducing verbosity, better to have the required information than to hide it?
(It didn't really make sense to separate doc and unit tests they are all unit tests and splitting them just slows things down)
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.
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.
I don't really see a problem with this and seeing the test output is helpful for debugging timeouts. Unrelated either way.
|
* Closes cylc#5775 * Replace the pkg_resources library (deprecated) with newer alternatives. * This resolves an efficiency issue due to the high import time of pkg_resources. This import time hits every single Cylc command including `cylc message`.
I had missed |
pkg_resources
#5775cylc message
.Test Import Time
The pkg_resources library can take a glacial age to import. To see this for yourself and test the difference try this:
Results:
Before
After
Test CLI Time
To measure the impact of this change on end-to-end performance, I used this diff to turn off the actual work of
cylc message
:Note, without this diff, execution times vary wildly due to IO.
Results (average of 5 calls):
So a ~0.3 second difference, which is good, but less of a saving than the ~1s indicated by
python -X importtime
.I don't understand the disparity between the two, but at least the number is heading in the right direction.
Check List
CONTRIBUTING.md
and added my name as a Code Contributor.setup.cfg
(andconda-environment.yml
if present).CHANGES.md
entry included if this is a change that can affect users?.?.x
branch.