Skip to content

Resolve Job inputs automatically in decorated flows - #885

Open
Andrew-S-Rosen wants to merge 17 commits into
materialsproject:mainfrom
Andrew-S-Rosen:agent/resolve-job-inputs-in-decorated-flows
Open

Resolve Job inputs automatically in decorated flows#885
Andrew-S-Rosen wants to merge 17 commits into
materialsproject:mainfrom
Andrew-S-Rosen:agent/resolve-job-inputs-in-decorated-flows

Conversation

@Andrew-S-Rosen

@Andrew-S-Rosen Andrew-S-Rosen commented Aug 10, 2026

Copy link
Copy Markdown
Member

Closes #884.

What changed

  • Convert Job and Flow values passed to jobs inside @flow-decorated functions into their output references automatically.
  • Apply the conversion recursively to list, tuple, and dictionary inputs.
  • Keep conversion limited to decorated-flow construction; runtime job execution is unchanged.
  • Add regression tests for the minimal example from Feature request: automatic .output resolving in flow-decorated functions #884.

Why

The decorated-flow build context already collects delayed jobs, but downstream job construction retained whole Job objects as inputs. This produced an invalid job argument and required users to write .output explicitly. Replacing these values while the decorated flow is being built makes the shorthand behave as expected without changing job construction outside @flow.

@Andrew-S-Rosen
Andrew-S-Rosen marked this pull request as ready for review August 10, 2026 21:07
@Andrew-S-Rosen
Andrew-S-Rosen force-pushed the agent/resolve-job-inputs-in-decorated-flows branch from 5cd6cf4 to e4b1f76 Compare August 11, 2026 17:04
@Andrew-S-Rosen

Copy link
Copy Markdown
Member Author

@utf --- could I get your review when you have a moment? Thanks.

@gpetretto gpetretto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @Andrew-S-Rosen,
I think this would be interesting. I have left a few cosmetic comments and one with a major concern.
In general, I don't expect this to conflict with #870

Comment thread src/jobflow/core/flow.py Outdated
Comment thread src/jobflow/core/job.py Outdated
Comment thread src/jobflow/core/job.py Outdated
Comment thread src/jobflow/core/job.py Outdated
@Andrew-S-Rosen

Andrew-S-Rosen commented Aug 20, 2026

Copy link
Copy Markdown
Member Author

@gpetretto Thank you very much for the helpful review! I think I have addressed your comments. The buggy code you pointed out has since been removed entirely. There was an edge case I was trying to resolve (mentioned in #885 (comment)), but it is different than #884 and probably not sensible anyway. I have streamlined this PR to focus on the main issue at hand.

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.

Feature request: automatic .output resolving in flow-decorated functions

2 participants