Skip to content
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

added suite state xtrigger for back-compat #5864

Merged

Conversation

markgrahamdawson
Copy link
Contributor

@markgrahamdawson markgrahamdawson commented Dec 5, 2023

closes #5835

The issue

The suite_state xtrigger was renamed to workflow_state, this breaks Cylc 7-8 interoperability.

The solution

I have just added a new xtrigger called suite_state which imports from workflow_state

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are included (or explain why tests are not needed).
  • CHANGES.md entry included if this is a change that can affect users
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@markgrahamdawson markgrahamdawson self-assigned this Dec 5, 2023
@markgrahamdawson markgrahamdawson marked this pull request as ready for review December 6, 2023 16:28
@MetRonnie MetRonnie changed the title added suite state xtrigger for back commpat added suite state xtrigger for back-compat Dec 6, 2023
cylc/flow/xtrigger_mgr.py Outdated Show resolved Hide resolved
cylc/flow/xtriggers/suite_state.py Outdated Show resolved Hide resolved
cylc/flow/xtriggers/suite_state.py Show resolved Hide resolved
cylc/flow/xtriggers/suite_state.py Outdated Show resolved Hide resolved
@MetRonnie MetRonnie requested a review from wxtim December 8, 2023 11:34
@MetRonnie MetRonnie added this to the cylc-8.3.0 milestone Dec 8, 2023
Copy link
Member

@wxtim wxtim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine. I've made a comment about explicitly testing the warning, but I'm not super fussed if you want to argue that it's unnecessary.

tests/unit/xtriggers/test_workflow_state.py Outdated Show resolved Hide resolved
tests/unit/xtriggers/test_workflow_state.py Show resolved Hide resolved
extended back compat a unit test

added deprecation log message

refactored implementation

flake8

review amends

added test for warning text

review amends

more review ammends

Replace icky unit test with functional test (#4)

* Replace icky unit test with functional test

* Update changelog
Copy link
Member

@MetRonnie MetRonnie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are failing for a valid reason

XtriggerConfigError: [upstream] xtrigger module 'suite_state' not found

This is because of the change introduced in #5831 where built-in xtriggers are now registered by the cylc.xtriggers entry point in setup.cfg

cylc-flow/setup.cfg

Lines 218 to 223 in 22f41e2

# NOTE: Built-in xtriggers
cylc.xtriggers =
echo = cylc.flow.xtriggers.echo:echo
wall_clock = cylc.flow.xtriggers.wall_clock:wall_clock
workflow_state = cylc.flow.xtriggers.workflow_state:workflow_state
xrandom = cylc.flow.xtriggers.xrandom:xrandom

I think the best solution is to just add suite_state to the entry point? cc @oliver-sanders

@oliver-sanders
Copy link
Member

I think the best solution is to just add suite_state to the entry point

Yes, that will be needed to register this xtrigger.

Copy link
Member

@MetRonnie MetRonnie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@MetRonnie MetRonnie requested a review from wxtim January 29, 2024 12:28
@@ -220,6 +220,7 @@ cylc.xtriggers =
echo = cylc.flow.xtriggers.echo:echo
wall_clock = cylc.flow.xtriggers.wall_clock:wall_clock
workflow_state = cylc.flow.xtriggers.workflow_state:workflow_state
suite_state = cylc.flow.xtriggers.suite_state:suite_state
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note small conflict with #5452

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(No need to do anything unless #5452 gets merged first)

# along with this program. If not, see <http://www.gnu.org/licenses/>.

# Test that deprecation warnings are printed appropriately for the suite_state
# xtrigger.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this functional test provide anything more than the unit tests below?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's icky to test the deprecation message logging from within unit tests because it happens at import time, so did this as a functional test. #5864 (comment)

@MetRonnie
Copy link
Member

Just failing flake8:

./cylc/flow/xtriggers/suite_state.py:32:80: E501 line too long (100 > 79 characters)
./cylc/flow/xtriggers/suite_state.py:33:80: E501 line too long (82 > 79 characters)

Copy link
Member

@wxtim wxtim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine - Sorry I failed to review this in a timely fashion.

@wxtim wxtim merged commit b1822a6 into cylc:master Feb 8, 2024
36 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

config: auto upgrade "suite_state" to "workflow_state" in compat mode
5 participants