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

cylc set: log warning when no outputs specified and task has no required outputs #6505

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MetRonnie
Copy link
Member

@MetRonnie MetRonnie commented Nov 29, 2024

R1 = a? => b
$ cylc set workflow//1/a

does nothing and currently produces no warning.

This change makes it log a warning.

https://cylc.discourse.group/t/cylc-set-for-a-task-with-multiple-outputs-doesnt-seem-to-do-anything/1074

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).
  • No dependency changes
  • Tests are included
  • No changelog entry needed as minor
  • No docs needed
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@MetRonnie MetRonnie added small could be better Not exactly a bug, but not ideal. labels Nov 29, 2024
@MetRonnie MetRonnie added this to the 8.4.0 milestone Nov 29, 2024
@MetRonnie MetRonnie self-assigned this Nov 29, 2024
@hjoliver hjoliver self-requested a review December 2, 2024 00:20
@MetRonnie MetRonnie marked this pull request as draft December 2, 2024 11:00
@MetRonnie
Copy link
Member Author

MetRonnie commented Dec 2, 2024

I realised there was a slight mistake and the test was not quite what I wanted.

@oliver-sanders Why, for task a in

R1 = """
    a? => b
    a:x
"""

is the auto-generated completion statement (x and succeeded) or failed? This is making x optional even though it is not optional in the graph.

Shouldn't it be x and (succeeded or failed)?

@MetRonnie MetRonnie modified the milestones: 8.4.0, 8.4.1 Dec 2, 2024
@hjoliver
Copy link
Member

hjoliver commented Dec 3, 2024

Hmm, that does seem wrong.

Logically, it should be (x and succeeded) or (x and failed) i.e. x and (succeeded or failed).

@oliver-sanders
Copy link
Member

oliver-sanders commented Dec 3, 2024

is the auto-generated completion statement (x and succeeded) or failed? This is making x optional even though it is not optional in the graph.

Shouldn't it be x and (succeeded or failed)?

No, this is correct and as proposed (point 3).

There are four "final" task states:

  • succeeded
  • failed
  • submit-failed
  • expired

By default, outputs are associated with the success pathway. The task cannot be expected to complete these outputs in other scenarios as it hasn't necessarily run. Doing it as suggested above would prevent clean graph branching (e.g, in your example, you would need a suicide trigger to remove the task if it failed because it didn't produce the output "x").

Optional outputs as specified in the graph are used to configure the completion expression. The source of truth is in the completion expression itself.

@MetRonnie
Copy link
Member Author

MetRonnie commented Dec 3, 2024

Doing it as suggested above would prevent clean graph branching (e.g, in your example, you would need a suicide trigger to remove the task if it failed because it didn't produce the output "x").

Can't say I understand this. In my example x should be a required output. If it didn't produce the output "x" then that should need an intervention. As succeeded is optional, it doesn't matter what the exit code of the script is, just as long as x is outputted.

@hjoliver
Copy link
Member

hjoliver commented Dec 4, 2024

OK I can see that proposal point 3 does indeed lead to (x and succeeded) or failed:

the expression is automatically generated according to the rules:

i. All required outputs (referenced in the graph) must be satisfied.
ii. Or, if success is optional, then the outputs are complete if it fails.

but I'm no longer entirely convinced that that's correct.

By default, outputs are associated with the success pathway. The task cannot be expected to complete these outputs in other scenarios

You're saying failure is optional, and failure could occur early in execution, before a:x can be generated.

That's true, but I think it's still legit to have a graph that requires the a:x path regardless of a's success or failure - and hence manual intervention if a:x is not generated.

a? => a-success-path
a:fail? => a-failure-path
a:x => a-x-path  # required either way

It's conceivable that a has a known and handle-able failure mode late in execution, and we need a:x to be generated even if it fails.

(Is that what you're saying @MetRonnie ?)

@MetRonnie
Copy link
Member Author

Sorry to stoke an argument 🤭 I suggest we re-visit this after 8.4.0 is released. I will probably just stick completion = x on the task to make the test work

@oliver-sanders
Copy link
Member

It's conceivable that a has a known and handle-able failure mode late in execution, and we need a:x to be generated even if it fails.

Yep, and for this niche case, the user can configure a completion expression to achieve the desired behaviour:

completion = x and (succeeded or failed)

But for the more common case where failure means that the task is not able to do what it was supposed to do, the current behavior avoids the need for suicide triggers whilst maintaining consistency with the handling of the other two final outputs, submit-failed and expired (where the output x cannot be produced naturally in any case).

a?
a:x

completion = (x and succeeded) or failed
a:expired?
a:x

completion = (x and succeeded) or expired
a:submit-failed?
a:x

completion = (x and succeeded) or submit_failed

Sorry to stoke an argument 🤭 I suggest we re-visit this after 8.4.0 is released

Yes please. If we do need to revisit this, later, not now!

@hjoliver
Copy link
Member

hjoliver commented Dec 4, 2024

It comes down to what should be the default completion condition vs what should require a user-defined one.

Looking at succeed/fail alone, to my mind we've got it the wrong way around because the current default is not the most literal interpretation of the graph.

Point taken on consistency with submit-failed and expired, but I'm not sure that matters. Succeed and fail are fundamentally different from those because they involve actually executing the job, so it's seems fine to me to treat them slightly differently on that basis.

But OK, on the back-burner for post-8.4.0 revisit!

@MetRonnie
Copy link
Member Author

MetRonnie commented Dec 5, 2024

Btw it seems like instead of logging a warning, we might as well do what skip mode does and just emit the "success pathway" outputs if a user does cylc set task without the --out option and the task has no required outputs.

Arguably an enhancement so should go in 8.5.0 rather than 8.4.1?

@MetRonnie MetRonnie added the question Flag this as a question for the next Cylc project meeting. label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
could be better Not exactly a bug, but not ideal. question Flag this as a question for the next Cylc project meeting. small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants