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

Xtrig arg validate #5955

Merged
merged 16 commits into from
Feb 22, 2024
Merged

Xtrig arg validate #5955

merged 16 commits into from
Feb 22, 2024

Conversation

wxtim
Copy link
Member

@wxtim wxtim commented Feb 1, 2024

Close #5448

Replaces #5452, to which I have added tests.

From @hjoliver

This is not just a bug-fix for the wall_clock xtrigger - I've gone for a generic approach:

  • if an xtrigger module has a function called validate it will be called at validation time, with the parsed args.

From @MetRonnie (added to this PR)

I realised it's trivially simple to automatically ensure xtrigger function args match the function signature at validation time

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 Xtriggers: Doc Fixes cylc-doc#686.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@wxtim wxtim mentioned this pull request Feb 1, 2024
8 tasks
@wxtim wxtim self-assigned this Feb 1, 2024
@wxtim wxtim modified the milestones: cylc-8.2.5, cylc-8.3.0 Feb 1, 2024
@wxtim wxtim marked this pull request as draft February 1, 2024 14:11
@wxtim wxtim mentioned this pull request Feb 1, 2024
1 task
@wxtim wxtim marked this pull request as ready for review February 1, 2024 15:56
@wxtim
Copy link
Member Author

wxtim commented Feb 1, 2024

@markgrahamdawson requesting a second review because this is quite collab between Hilary and I at this point.

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.

I realised it's trivially simple to automatically ensure xtrigger function args match the function signature at validation time

PR open here: wxtim#59

cylc/flow/xtriggers/wall_clock.py Show resolved Hide resolved
wxtim and others added 2 commits February 2, 2024 08:35
* Remove redundant try block.

* Fix changelog

* Automatically validate xtrigger function signature

---------

Co-authored-by: Hilary James Oliver <[email protected]>
cylc/flow/xtriggers/xrandom.py Outdated Show resolved Hide resolved
cylc/flow/xtriggers/xrandom.py Outdated Show resolved Hide resolved
Co-authored-by: Ronnie Dutta <61982285 [email protected]>
@wxtim wxtim reopened this Feb 6, 2024
@wxtim
Copy link
Member Author

wxtim commented Feb 6, 2024

Woops, wrong button. Re-open when flake8 addressed

Fixed locally. Reopened so CI runs. Hopefully works on CI too.

@MetRonnie

This comment was marked as resolved.

@MetRonnie MetRonnie marked this pull request as draft February 16, 2024 11:20
@MetRonnie MetRonnie self-assigned this Feb 16, 2024
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.

While looking at the test failures, I realised the implementation of xrandom's validate function was flawed with respect whether you used args vs kwargs.

Then I realised I could simplify the way validation is carried out, PR open at wxtim#60

* Improve xtrigger validation

* wall_clock: use placeholder function for signature validation & autodocs

* Fix docstring for autodoc [skip ci]
@wxtim wxtim marked this pull request as ready for review February 20, 2024 09:07
@wxtim wxtim requested review from MetRonnie and removed request for hjoliver February 20, 2024 09:07
@MetRonnie
Copy link
Member

Kicking tests

@MetRonnie MetRonnie closed this Feb 20, 2024
@MetRonnie MetRonnie reopened this Feb 20, 2024
@MetRonnie
Copy link
Member

Ah right, @wxtim when you squash merge a PR make sure you remove [skip ci] from the commit description otherwise the tests will not run

@MetRonnie
Copy link
Member

MetRonnie commented Feb 21, 2024

@wxtim Any objection to merging this? I think enough due process has occurred at this point, seeing as I have reviewed yours/Hilary's code and you've reviewed mine?

@wxtim wxtim merged commit 2b2fc77 into cylc:master Feb 22, 2024
@wxtim
Copy link
Member Author

wxtim commented Feb 22, 2024

Ah right, @wxtim when you squash merge a PR make sure you remove [skip ci] from the commit description otherwise the tests will not run

That seems reasonable - All the code has been reviewed by two pairs of eyes in effect even if the review was not linear.

@wxtim wxtim mentioned this pull request Feb 22, 2024
8 tasks
@oliver-sanders oliver-sanders modified the milestones: cylc-8.4.0, cylc-8.3.0 Feb 22, 2024
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.

Cylc Validate failed to catch bad offset
4 participants