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

Create subsection "Nested workflow" in the docs #277

Merged
merged 26 commits into from
Nov 12, 2024

Conversation

agoscinski
Copy link
Contributor

@agoscinski agoscinski commented Aug 27, 2024

Moves the graph builder, if task and while task examples into this subsection. Also removed the graph_builder.ipynb since it is now generated. Solves issue #195

@agoscinski agoscinski marked this pull request as ready for review August 27, 2024 12:19
@agoscinski agoscinski force-pushed the create-docs-nested-workflows branch 2 times, most recently from 94e0a29 to b4ed841 Compare August 27, 2024 12:26
@codecov-commenter
Copy link

codecov-commenter commented Aug 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.56%. Comparing base (5937b88) to head (120aa9a).
Report is 88 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #277      +/-   ##
==========================================
+ Coverage   75.75%   80.56%   +4.81%     
==========================================
  Files          70       66       -4     
  Lines        4615     5156     +541     
==========================================
+ Hits         3496     4154     +658     
+ Misses       1119     1002     -117     
Flag Coverage Δ
python-3.11 80.48% <ø> (+4.82%) ⬆️
python-3.12 80.48% <ø> (?)
python-3.9 80.52% <ø> (+4.78%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@agoscinski agoscinski force-pushed the create-docs-nested-workflows branch 3 times, most recently from 16e2070 to b059def Compare August 27, 2024 13:34
@agoscinski
Copy link
Contributor Author

test_pause_task_after_submit seems a bit unstable it failed already two times in different jobs

Copy link
Member

@superstar54 superstar54 left a comment

Choose a reason for hiding this comment

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

Looking at the if and while task again, because we now have new If task and while task, thus there are two ways to implement if

  • if task, dose not need nested workgraph
  • use graph_builder, thus nested workgraph.

thus it's better to keep if and while separately, and not move to the nested_workgraph.

I suggest at the end of the graph_builder.py, we make a link to show the application in the if and while.

@agoscinski agoscinski force-pushed the create-docs-nested-workflows branch 3 times, most recently from fb9410e to c344a45 Compare August 28, 2024 14:00
@agoscinski
Copy link
Contributor Author

I dont think the graph_builder example is really about the dynamic part as it just forwards inputs like any task does it. We could make another example that runs different tasks depending on the inputs. Something like

@task.calcfunction()
def add_one(x):
    return x.value+1

@task.calcfunction()
def modulo_five(x):
    return x % 5

@graph_builder(outputs = [...])
def my_modular(i: orm.Int):
    wg = WorkGraph()
    if i.value < 5:
        task = wg.add_task(add_one)
    else:
        task = wg.add_task(modulo_five)
    # need wg.selector to expose for linking?
    return wg

Then one could say that this does not preserve provenance and directly interlude to the If workgraph

@agoscinski
Copy link
Contributor Author

Added an example for a dynamic use case of the graph_builder

Copy link
Member

@superstar54 superstar54 left a comment

Choose a reason for hiding this comment

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

Hi @agoscinski , Thanks for the work.

I would suggest not creating a dynamic-workflows section, but moving all three notebooks into the howto, so that user can see the dynamic, if and while immediately.

@superstar54
Copy link
Member

Then one could say that this does not preserve provenance and directly interlude to the If workgraph

Why ti does not preserve provenance?

@agoscinski
Copy link
Contributor Author

I would suggest not creating a dynamic-workflows section, but moving all three notebooks into the howto, so that user can see the dynamic, if and while immediately.

Okay, but the howto's starting to get messy and need some structure at some point, but I think for now one still can put everything there

@agoscinski
Copy link
Contributor Author

Why ti does not preserve provenance?

I mean more that it does not store provenance as transparently as using the If WorkGraph, but looking at the provenance graph, It is not really capturing the if-then-else logic, but just only some additional information about the condition. But at least in the GUI the if-then-else is capture more transparently.

@agoscinski
Copy link
Contributor Author

I merged now the nested and dynamic example because it seemed strange to see them separate

Copy link
Member

@superstar54 superstar54 left a comment

Choose a reason for hiding this comment

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

Hi @agoscinski , thanks for the update!

The dynamic_graph_builder.py is not used, I think you want to remove it.

docs/source/howto/index.rst Outdated Show resolved Hide resolved
docs/gallery/howto/autogen/graph_builder.py Outdated Show resolved Hide resolved
docs/gallery/howto/autogen/graph_builder.py Outdated Show resolved Hide resolved
docs/gallery/howto/autogen/graph_builder.py Outdated Show resolved Hide resolved
docs/gallery/howto/autogen/graph_builder.py Outdated Show resolved Hide resolved
docs/gallery/howto/autogen/graph_builder.py Outdated Show resolved Hide resolved
docs/gallery/howto/autogen/graph_builder.py Outdated Show resolved Hide resolved
docs/gallery/howto/autogen/graph_builder.py Outdated Show resolved Hide resolved
@superstar54 superstar54 self-requested a review September 23, 2024 12:29
Copy link
Member

@superstar54 superstar54 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@superstar54 superstar54 merged commit f2304a2 into main Nov 12, 2024
8 checks passed
@superstar54 superstar54 deleted the create-docs-nested-workflows branch November 12, 2024 07:28
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.

3 participants