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

Fix workflow-state command and xtrigger. #5809

Merged
merged 50 commits into from
Jun 17, 2024

Conversation

hjoliver
Copy link
Member

@hjoliver hjoliver commented Nov 3, 2023


Minor db change Change to the workflow database structure : Format of outputs column in task_outputs table has changed from Cylc 8.0.0 where it was a stringified list of task messages, to a stringified dictionary of the format {<output label>: <task message>} (like how it was in Cylc 7).


The command and xtrigger now take WORKFLOW//CYCLE/TASK:SELECTOR as an arg.

SELECTOR can be a status or an output. With --output, or if not a valid status, it is taken as an output; otherwise a status.

Any query will be polled for if no matching result is found.

A good test case:

[scheduling]
    cycling mode = integer
    initial cycle point = 2001
    final cycle point = 2003
[scheduling]
    [[xtriggers]]
        ws = workflow_state("%(workflow)s//%(point)s/foo:succeeded", offset="-P1"):PT2S
    [[graph]]
        P1 = """
           foo[-P1] => foo
           foo:x => bar & baz
        """
        R/2002/P1 = "@ws => baz"
[runtime]
    [[foo]]
        script = """
           cylc message -- "xxx"
        """
        [[[outputs]]]
           x = xxx
    [[bar]]
        script = """
          if [[ "$CYLC_TASK_CYCLE_POINT" == "$CYLC_WORKFLOW_FINAL_CYCLE_POINT" \
             && "$CYLC_TASK_SUBMIT_NUMBER" == "1" ]]
          then
              cylc trigger --flow=new $CYLC_WORKFLOW_ID//2002/foo
          fi
        """
    [[baz]]

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 Some doc updates for 8.3.0.dev changes. cylc-doc#727
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@hjoliver hjoliver added the bug Something is wrong :( label Nov 3, 2023
@hjoliver hjoliver added this to the cylc-8.3.0 milestone Nov 3, 2023
@hjoliver hjoliver self-assigned this Nov 3, 2023
@hjoliver hjoliver force-pushed the fix-workflow-state-check branch from ab469a6 to c5ede84 Compare November 6, 2023 02:30
@hjoliver hjoliver marked this pull request as ready for review November 6, 2023 10:36
changes.d/5809.fix.d Outdated Show resolved Hide resolved
cylc/flow/scripts/workflow_state.py Outdated Show resolved Hide resolved
cylc/flow/scripts/workflow_state.py Outdated Show resolved Hide resolved
cylc/flow/scripts/workflow_state.py Outdated Show resolved Hide resolved
cylc/flow/scripts/workflow_state.py Outdated Show resolved Hide resolved
cylc/flow/dbstatecheck.py Outdated Show resolved Hide resolved
tests/unit/xtriggers/test_workflow_state.py Outdated Show resolved Hide resolved
cylc/flow/scripts/workflow_state.py Outdated Show resolved Hide resolved
@hjoliver hjoliver modified the milestones: cylc-8.3.0, cylc-8.4.0 Mar 14, 2024
@hjoliver
Copy link
Member Author

Note also: #6030

@MetRonnie MetRonnie removed their request for review April 9, 2024 13:52
@hjoliver hjoliver marked this pull request as draft April 19, 2024 03:01
@hjoliver hjoliver force-pushed the fix-workflow-state-check branch from 0274a3e to 178c3d1 Compare April 19, 2024 03:02
@hjoliver hjoliver modified the milestones: 8.4.0, 8.3.0 Apr 19, 2024
@hjoliver hjoliver mentioned this pull request Apr 19, 2024
8 tasks
@hjoliver hjoliver force-pushed the fix-workflow-state-check branch 2 times, most recently from 113942b to 697681f Compare April 26, 2024 11:36
@hjoliver hjoliver marked this pull request as ready for review April 26, 2024 11:48
@MetRonnie MetRonnie self-requested a review April 29, 2024 13:31
cylc/flow/scripts/workflow_state.py Outdated Show resolved Hide resolved
cylc/flow/scripts/workflow_state.py Outdated Show resolved Hide resolved
cylc/flow/scripts/workflow_state.py Outdated Show resolved Hide resolved
cylc/flow/scripts/workflow_state.py Outdated Show resolved Hide resolved
cylc/flow/scripts/workflow_state.py Outdated Show resolved Hide resolved
cylc/flow/dbstatecheck.py Outdated Show resolved Hide resolved
cylc/flow/dbstatecheck.py Outdated Show resolved Hide resolved
tests/functional/xtriggers/04-suite_state.t Outdated Show resolved Hide resolved
cylc/flow/xtrigger_mgr.py Show resolved Hide resolved
@MetRonnie
Copy link
Member

tests/k/xtriggers/01-workflow_state.t failing btw

@hjoliver hjoliver marked this pull request as draft April 30, 2024 07:49
cylc/flow/dbstatecheck.py Outdated Show resolved Hide resolved
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 reasonable; Given the amount on your plate I will start drafting tests for this so that we can ram it through.

I've added the following:hjoliver#50 - It's not a complete set of tests, but I've covered some of this. I'll do more tomorrow. If you want to get them in feel free to merge though.

cylc/flow/dbstatecheck.py Outdated Show resolved Hide resolved
cylc/flow/dbstatecheck.py Outdated Show resolved Hide resolved
@hjoliver hjoliver force-pushed the fix-workflow-state-check branch from ffc2b32 to b32f223 Compare June 13, 2024 05:09
@wxtim

This comment was marked as resolved.

@wxtim wxtim self-requested a review June 13, 2024 09:16
@hjoliver
Copy link
Member Author

One-line fix pushed for the function signature advice (we shouldn't advise adding all the null args with = None).

@hjoliver
Copy link
Member Author

hjoliver commented Jun 13, 2024

And another small commit handles "None" properly in xtrigger defintions, just in case someone does it.

@hjoliver
Copy link
Member Author

and the same as the above but with alt_cylc_run_dir=None added to the xtrigger args causes it the xtrigger to not return True.

That would be because it was interpreting the string "None" as an alternate run-dir. My previous commit will prevent that too.

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.

I've had a really decent go at breaking this, and run out of ideas.

@hjoliver
Copy link
Member Author

@MetRonnie - final comments addressed. Merge? 🙏

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.

Alright, think we're nearly there. However there is this still outstanding? hjoliver#54

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 June 17, 2024 12:57
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.

🚀

@wxtim wxtim merged commit 6eb8f61 into cylc:master Jun 17, 2024
27 checks passed
@hjoliver hjoliver deleted the fix-workflow-state-check branch June 17, 2024 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is wrong :( config change Involves a change to global or workflow config db change Change to the workflow database structure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

workflow-state: check latest instance for status
4 participants