-
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
Add a new entry_point for xtriggers #5831
Conversation
If this approach is agreed to and you want it into 8.2.X I can backport it to that instead. |
aa170b1
to
fd90f6d
Compare
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.
Happy with using entry points for xtriggers.
We started using entry points with Cylc 8 and have been slowly propagating them.
Features should target the next minor release (8.3.0) so this shouldn't be backported.
Note, the commit seems to be associated with a different GitHub account, this is ok, but please make sure the .mailmap file maps both addresses against your name, if this is done correctly the |
From #3456:
|
fd90f6d
to
065464c
Compare
I've added a new file |
Things appear to map correctly. |
@oliver-sanders how about CHANGES.md? I can't see an 8.3.0 entry in there, or does it get automatically generated now (if so, should that tick box be removed from the list of things to tick off?) |
I don't really know what I'm doing with |
Use The contributor page has been updated with an example command: https://github.com/cylc/cylc-flow/blob/master/CONTRIBUTING.md#contribute-code |
065464c
to
3c36a6a
Compare
Looks good to me. The tests are looking a bit unhappy, I think something's gone wrong with the trigger loading, here's some traceback extracted from the functional test failure:
We could also do with a functional test to ensure that the old |
Do entry points get resolved for the tests? If so, how? Is there anything I need to add to have entry points added which are defined in the setup.cfg file?
That should be doable easily enough, but similar question to above, do I need to do anythnig special to add in the entry points to ensure they are resolved correctly? |
Yes, we To debug, you can run the failing tests locally, e.g: $ pytest -vv tests/unit/test_xtrigger_mgr.py::test_add_xtrigger
$ etc/bin/run-functional-tests -v tests/f/retries/01-submission-retry.t |
EDIT: 🤦♂️ - I didn't have my branch checked out, I had a different branch open, tests correctly fail now, will have a look |
This creates a clean way to add xtriggers from python packages. xtriggers no longer need to be directly in the PYTHONPATH, but instead can be added via a cylc.xtriggers entry point. Local cylc-flow xtriggers are defined via a new entry_point.
c27f21d
to
cd55e6d
Compare
I've pushed some fixes. Not sure how it was working before this, unless I had some changes I didn't commit and lost when I did a different piece of work. Running a few of the failed tests all had them passing now. I'll look at an extra functional test next week (unless I can get one done within a few minutes, but I doubt it). |
Please ignore |
@oliver-sanders having a look at this, adding xtriggres via the PYTHONPATH does not work as the PYTHONPATH is removed. I'm guessing you're meaning CYLC_PYTHONPATH instead? Also, docs on custom xtriggers probably need updating
|
Ensures that xtrggers in your CYLC_PYTHONPATH are respected above entry_point xtriggers.
Functional test for CYLC_PYTHONPATH added in be3e277 @oliver-sanders |
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.
Thanks @ColemanTom
I've got a few suggestions
tests/functional/xtriggers/04-respect-cylc-pythonpath/flow.cylc
Outdated
Show resolved
Hide resolved
Co-authored-by: Ronnie Dutta <[email protected]>
Co-authored-by: Ronnie Dutta <[email protected]>
Co-authored-by: Ronnie Dutta <[email protected]>
Co-authored-by: Ronnie Dutta <[email protected]>
Co-authored-by: Ronnie Dutta <[email protected]>
Thanks @MetRonnie - I added all your suggestions. |
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.
👍
(re-opened to kick the tests) |
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.
LGTM, cheers!
* upstream/master: (350 commits) Apply suggestions from code review [skip ci] Added missing union type import (cylc#5906) set CYLC_DEBUG env var when set-verbosity DEBUG (cylc#5854) coverage: exclude report-timings and set 90% as the lower limit lint: Warn users that `CYLC_VERSION={{CYLC_VERSION}}` is deprecated (cylc#5890) Add a new entry_point for xtriggers (cylc#5831) Update copyright year Tests: fix cached datetime arithmetic contamination between tests using different calendar modes Replace cyclers functional reftests with integration reftests Simplify integration reftest Replace pre-initial functional reftests with integration reftests Integration tests: add a simpler reftest fixture auto update syntax files id: catch traceback in ID parsing actions: downgrade macos runners to macos 11 (cylc#5892) Feat.lint obsolete vars (cylc#5879) dump: restrict window to n=0 (cylc#5600) Add chained offset logic for FCP (cylc#5885) Test.example replace a reftest (cylc#5860) GH Actions artifact name fixes ...
* upstream/master: (81 commits) Apply suggestions from code review [skip ci] Added missing union type import (cylc#5906) coverage: exclude report-timings and set 90% as the lower limit lint: Warn users that `CYLC_VERSION={{CYLC_VERSION}}` is deprecated (cylc#5890) Add a new entry_point for xtriggers (cylc#5831) Tests: fix cached datetime arithmetic contamination between tests using different calendar modes Replace cyclers functional reftests with integration reftests Simplify integration reftest Replace pre-initial functional reftests with integration reftests Integration tests: add a simpler reftest fixture auto update syntax files Feat.lint obsolete vars (cylc#5879) dump: restrict window to n=0 (cylc#5600) Test.example replace a reftest (cylc#5860) GH Actions artifact name fixes Bump actions/upload-artifact from 3 to 4 Bump actions/download-artifact from 3 to 4 tests/i: update tui screenshot Update .github/workflows/test_fast.yml actions: add non-utc job to fast tests ...
* upstream/master: (81 commits) Apply suggestions from code review [skip ci] Added missing union type import (cylc#5906) coverage: exclude report-timings and set 90% as the lower limit lint: Warn users that `CYLC_VERSION={{CYLC_VERSION}}` is deprecated (cylc#5890) Add a new entry_point for xtriggers (cylc#5831) Tests: fix cached datetime arithmetic contamination between tests using different calendar modes Replace cyclers functional reftests with integration reftests Simplify integration reftest Replace pre-initial functional reftests with integration reftests Integration tests: add a simpler reftest fixture auto update syntax files Feat.lint obsolete vars (cylc#5879) dump: restrict window to n=0 (cylc#5600) Test.example replace a reftest (cylc#5860) GH Actions artifact name fixes Bump actions/upload-artifact from 3 to 4 Bump actions/download-artifact from 3 to 4 tests/i: update tui screenshot Update .github/workflows/test_fast.yml actions: add non-utc job to fast tests ...
This creates a clean way to add xtriggers from python packages. xtriggers no longer need to be directly in the PYTHONPATH but can instead be from a general installation location using an entry_point
cylc.xtriggers
. Similar could be done for other things perhaps, like Jinja2Globals, although I have not looked.I do not have an Issue for this, but I think it may be or at least relate to #3456, although I do not add the built in xtriggers with this PR, perhaps they should be but I think that can be a bit of work for someone else.
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 usersI've not added tests as I've not looked at how it coudl be done (can it cleanly?). I'll update CHANGES and cylc doc only if/when this is agreed to.
Example of use below, but note that with this approach, you do not actually need to have a file per xtrigger with a function in it with the same name as the filename.
Then in pyproject.toml