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

Require completion of at least one optional output #5423

Closed
hjoliver opened this issue Mar 21, 2023 · 4 comments
Closed

Require completion of at least one optional output #5423

hjoliver opened this issue Mar 21, 2023 · 4 comments

Comments

@hjoliver
Copy link
Member

Pasted from @oliver-sanders on Element chat:

E.G. here's the example I presented yesterday:

a:x? => x
a:y? => y
a:z? => z
x | y | z =? b

I said that Cylc would follow one of three possible pathways through the graph, but of course that's a bit of a lie. Cylc may follow zero pathways through the graph and shutdown as it is possible that a could succeed without generating any of the x, y or z outputs.

The awkward workaround is to force a stall with a pseudo dependency:

a => b

So our current interpretation of this:

a:x? => x
a:y? => y
a:z? => z

Is that "zero or more of x, y & z MUST be output"

However, it would be possible to interpret that as "one or more of x, y & z MUST be output" by making the assertion that when optionals (?) are used, at least one of them MUST be output. I think this is the user's intention for 99% of cases. The outliers being cases like this:

# we don't care if b fails
a => b?

Under this logic all pathways must be explicitly defined (explicit is better than implicit - PEP8), so we would have to explicitly state the error handling for the fail case here something like this:

a = b?
b:fail?  # if b fails do nothing
@hjoliver
Copy link
Member Author

hjoliver commented Mar 21, 2023

However, it would be possible to interpret that as "one or more of x, y & z MUST be output" by making the assertion that when optionals (?) are used, at least one of them MUST be output.

Agreed, but I think we need this to apply only to internal outputs.

(Note succeed and fail are already treated as special, because they are mutually exclusive).

Consider the case where success and failure are optional as well:

a:x? => x
a:y? => y
a:z? => z
a?
a:fail?
x | y | z => b 

The intention here would be that IF a succeeds, at least one of :x, :y, :z must be completed.

But a is allowed to fail too, in which case all bets are off on internal outputs.

If success is optional we can't just demand that one or more optional outputs must be completed, because then it would be OK for a to succeed without completing any of :x, :y, :z.

And if success/fail is (necessarily) treated as special, then I think its OK not to require explicit handling of :fail in this case:

# we don't care if b fails
a => b?

(Note that b? implies b:fail? because of the special properties of success and failure).

@hjoliver hjoliver changed the title Require at least one optional output Require completion of at least one optional output Mar 21, 2023
@oliver-sanders oliver-sanders added the question Flag this as a question for the next Cylc project meeting. label Mar 22, 2023
@oliver-sanders
Copy link
Member

The intention here would be that IF a succeeds, at least one of :x, :y, :z must be completed.

Sadly I think mutual exclusion cases are simply not something we can handle with the global optional outputs logic as it stands. I think this may have come up in the proposal, I've gotta feeling that sub-graphs were touted as the answer e.g:

{
  a:x? => x
  a:y? => y
  a:z? => z
} => b

{
  a? => good
  a:fail? => bad
} => whatever

whatever & b => something_else

For now I wonder whether requiring at least one optional output to be generated would make it harder to make mistakes with graph branching.

@oliver-sanders oliver-sanders added this to the cylc-8.x milestone Mar 22, 2023
@hjoliver
Copy link
Member Author

hjoliver commented Mar 22, 2023

The intention here would be that IF a succeeds, at least one of :x, :y, :z must be completed.

Sadly I think mutual exclusion cases are simply not something we can handle with the global optional ...

I agree, but note I was not talking about mutual exclusion cases there. ("at least one of", not "exactly one of".

My only point is just that we should not count :succeed? as one of the optional outputs that we require at least one of. Because if we do, the task can successfully finish without any of :x?, :y?, :z? being generated.

@oliver-sanders oliver-sanders removed this from the cylc-8.x milestone Jul 25, 2023
@oliver-sanders oliver-sanders removed the question Flag this as a question for the next Cylc project meeting. label Jul 25, 2023
@oliver-sanders
Copy link
Member

Superseded by #5640

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

No branches or pull requests

2 participants