Skip to content

add two link attributes#433

Merged
woutdenolf merged 18 commits into
mainfrom
428-remember-flag-for-optional-branches
Apr 13, 2026
Merged

add two link attributes#433
woutdenolf merged 18 commits into
mainfrom
428-remember-flag-for-optional-branches

Conversation

@woutdenolf

@woutdenolf woutdenolf commented Mar 6, 2026

Copy link
Copy Markdown
Member

Use case: ewoks-kit/ewoksppf#162

  • Added link attribute cache_if_not_required: cache inputs from non-required links just like required links.
  • Handle link attribute value required=False: for the link to be explicitly non-required.
  • Define in the Ewoks workflow specification that non-required and non-cached inputs are never lost
    when all required inputs are provided at any point in time.

@woutdenolf woutdenolf force-pushed the 428-remember-flag-for-optional-branches branch from 50774b3 to a0a5f9e Compare March 6, 2026 16:40
@woutdenolf woutdenolf requested a review from a team March 6, 2026 16:43
@codecov

codecov Bot commented Mar 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@loichuder loichuder left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is no implementation for cache_non_required required in ewokscore?

Comment thread doc/reference/specs.rst Outdated
Comment thread doc/reference/specs.rst Outdated
woutdenolf and others added 3 commits March 9, 2026 09:02
Co-authored-by: Loïc Huder <42204205+loichuder@users.noreply.github.com>
@woutdenolf

woutdenolf commented Mar 9, 2026

Copy link
Copy Markdown
Member Author

There is no implementation for cache_non_required required in ewokscore

Indeed. The engine does the caching.

This is already the case for all our engines for required links. When you have two required links coming in, the task gets executed with parameters from both. This means the engine needs to cache and merge somehow.

Only now we have the new parameter it becomes clear that this is an implicit behavior of DAGs which we don't think about.

Comment thread doc/reference/specs.rst Outdated
@woutdenolf

woutdenolf commented Mar 11, 2026

Copy link
Copy Markdown
Member Author

I think I have a better solution.

Seems to have fixed a bug as well. It broke a test of this graph

flowchart TD
    start([start])
    fan([fan])

    always1([always1])
    on_true1([on_true1])
    on_error1([on_error1])

    always2([always2])
    on_true2([on_true2])
    on_error2([on_error2])

    merge([merge])
    end_always([end_always])
    end_on_error([end_on_error])

    start --> fan

    fan --> always1
    fan -->|result == true| on_true1
    fan -->|error| on_error1

    always1 --> always2
    on_true1 --> on_true2
    on_error1 --> on_error2

    always2 --> merge
    on_true2 --> merge
    on_error2 --> merge

    merge --> end_always
    on_error2 --> end_on_error
Loading

But the links always1->always2 and always2->merge are required and the test assumed they were not.

@loichuder loichuder left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good!

Some naming suggestions.

Comment thread doc/reference/specs.rst Outdated
Comment thread doc/reference/specs.rst Outdated
Comment thread src/ewokscore/graph/analysis.py Outdated
Comment thread src/ewokscore/graph/analysis.py Outdated
Comment thread src/ewokscore/graph/analysis.py Outdated
Comment thread src/ewokscore/graph/analysis.py Outdated
Comment thread CHANGELOG.md Outdated
@loichuder loichuder self-requested a review March 11, 2026 16:20
@woutdenolf

Copy link
Copy Markdown
Member Author

Can ewoksweb handle a boolean field that also needs to be set to null (the default)?

@woutdenolf woutdenolf force-pushed the 428-remember-flag-for-optional-branches branch from 3693b6d to a4d63e9 Compare March 12, 2026 00:54
@woutdenolf

Copy link
Copy Markdown
Member Author

Whatever we decide in ewoks-kit/ewoksppf#162 (comment) should be added to the docs.

@loichuder

loichuder commented Mar 12, 2026

Copy link
Copy Markdown
Member

Can ewoksweb handle a boolean field that also needs to be set to null (the default)?

I think yes. There will be some head-scratching for the UI (I can't use a simple checkbox since there are three states) but the value can be serialized/deserialized as true, false or null so no technical issue.

Issue created at ewoks-kit/ewoksweb#852

@woutdenolf

Copy link
Copy Markdown
Member Author

Technical discussion + decision in node execution semantics: https://confluence.esrf.fr/display/AAWWK/Ewoks+graph+analysis%3A+input+caching

Only affects the SPEC and ewoksppf.

@woutdenolf woutdenolf force-pushed the 428-remember-flag-for-optional-branches branch 2 times, most recently from 04aee7b to cbd5ae2 Compare March 24, 2026 16:19
@woutdenolf woutdenolf force-pushed the 428-remember-flag-for-optional-branches branch 2 times, most recently from 19a1ee0 to cf6e5d5 Compare March 24, 2026 16:43
@woutdenolf woutdenolf force-pushed the 428-remember-flag-for-optional-branches branch from cf6e5d5 to 3869a46 Compare March 24, 2026 16:45
@woutdenolf

woutdenolf commented Mar 24, 2026

Copy link
Copy Markdown
Member Author

I keep modifying the examples. I now have two examples which I think covers all permutations of options and arrival orders.

@woutdenolf woutdenolf requested a review from loichuder March 24, 2026 16:53
@woutdenolf

Copy link
Copy Markdown
Member Author

The main sections in the SPEC are now:

Graph definition
     Graph attributes
     Node attributes
     Link attributes
Node execution semantics
     Before the first execution
     First execution
     After the first execution
     Summary
     Example 1
     Example 2
Task scheduling
Task implementation

@woutdenolf

woutdenolf commented Mar 24, 2026

Copy link
Copy Markdown
Member Author

I just realized that all engines other than ppf would need to refuse executing graphs with required=False. They already refuse graphs that have loops or conditions.

@woutdenolf woutdenolf force-pushed the 428-remember-flag-for-optional-branches branch from 8757c91 to aafbeb5 Compare March 24, 2026 17:30
@woutdenolf

Copy link
Copy Markdown
Member Author

I introduced graph_is_not_standard_dag so that the other engines can use this and not worries about complex graphs.

I also realized that the sequential engine does not need to reject workflow with required=False. It does a topological sort of the graph so all parents are executed before their children.

@woutdenolf

woutdenolf commented Mar 24, 2026

Copy link
Copy Markdown
Member Author

Actually no, scratch that: a workflow that does not handle the link attribute required=False can execute the graph perfectly fine. It just removes the race-conditions. I'll stop pushing changes. To be discussed in person.

Edit: this was agreed upon during the workflow meeting

  • Engines that don't handle required can just ignore it
  • No extra function for the engines like graph_is_cyclic and graph_has_conditional_links is needed (the engines use this to check whether that can execute a graph or not).

@woutdenolf woutdenolf force-pushed the 428-remember-flag-for-optional-branches branch from dfed2ae to 3869a46 Compare April 1, 2026 14:40
@woutdenolf

woutdenolf commented Apr 1, 2026

Copy link
Copy Markdown
Member Author

@loichuder Original review suggestions were addressed and I improved the SPEC docs (including examples).

Comment thread doc/reference/specs.rst Outdated
Comment thread doc/reference/specs.rst
Comment thread doc/reference/specs.rst Outdated
links are always cached. Only one non-required non-cached input is cached. Non-required cached imputs are cached
like required inputs.

Node execution semantics

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd say it is more explanation than reference, according to diataxis but no need to delve into semantics

Comment thread src/ewokscore/graph/analysis.py Outdated
Comment thread CHANGELOG.md Outdated
woutdenolf and others added 2 commits April 2, 2026 11:32
Co-authored-by: Loïc Huder <42204205+loichuder@users.noreply.github.com>
@woutdenolf

Copy link
Copy Markdown
Member Author

Thanks for the review!

I will now adapt the associated ewoks-kit/ewoksppf#162.

After that we can merge and make a major release.

@woutdenolf

woutdenolf commented Apr 2, 2026

Copy link
Copy Markdown
Member Author

Should we use cache_if_optional instead of cache_if_not_required?

Some sentences to see whether this could cause confusion:

  • Tasks have optional and required inputs.
  • Links can be optional or required.
  • Links are optional because they are explicitly not required or they are conditional or any upstream link is optional.
  • Links are conditional when they have conditions or on_error=True.

Edit: In the SPEC we use the word non-required so that could be optional as well. We just need to make sure that it is clear we are talking about links and not task inputs.

@loichuder

Copy link
Copy Markdown
Member

Should we use cache_if_optional instead of cache_if_not_required?

No hard stop for me. As long as we have clear about what we are talking about and it is written clearly in the spec

@woutdenolf

Copy link
Copy Markdown
Member Author

Now we talk about "optional links" instead of "not required links" or "non required links".

Added:

  • Make clear that optional/required of links and task inputs are unrelated concepts
  • Make clear that the caching is per link

@woutdenolf woutdenolf merged commit 9d6c7e6 into main Apr 13, 2026
14 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.

Remember flag for optional branches

2 participants