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

Enables inputs to be also outputs; Fixes #936 #947

Merged
merged 3 commits into from
Jun 12, 2024
Merged

Conversation

skrawcz
Copy link
Collaborator

@skrawcz skrawcz commented Jun 12, 2024

This enables one to pass in inputs and request them as outputs independent of the graph.

The use case here is that you want to join some data at the end that is extra and not in the DAG. E.g. extra pandas data.

I skip the visualization parts because this is an odd case.

This was easier than expected because the new executor already uses inputs as outputs... So really only had to modify the old code path.

Changes

  • modifies dfs function to check inputs if node isn't in graph or config.

How I tested this

  • locally via unit tests

Notes

Checklist

  • PR has an informative and human-readable title (this will be pulled into the release notes)
  • Changes are limited to a single goal (no scope creep)
  • Code passed the pre-commit check & code is left cleaner/nicer than when first encountered.
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future TODOs are captured in comments
  • Project documentation has been updated if adding/changing functionality.

This enables one to pass in inputs and request them as outputs
independent of the graph.

The use case here is that you want to join some data at the end
that is extra and not in the DAG. E.g. extra pandas data.

Adds test cases to check for different angles.
@skrawcz skrawcz linked an issue Jun 12, 2024 that may be closed by this pull request
tests/test_end_to_end.py Show resolved Hide resolved
tests/test_end_to_end.py Show resolved Hide resolved
Copy link
Collaborator

@elijahbenizzy elijahbenizzy left a comment

Choose a reason for hiding this comment

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

I think this is a little too deep -- we can do this at the driver level only, no?

hamilton/graph.py Show resolved Hide resolved
hamilton/driver.py Show resolved Hide resolved
Copy link
Collaborator

@elijahbenizzy elijahbenizzy left a comment

Choose a reason for hiding this comment

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

Let's ship it. Still think it should be at the driver layer but this is OK for now.

@skrawcz skrawcz merged commit 4771dd0 into main Jun 12, 2024
23 checks passed
@skrawcz skrawcz deleted the fix_inputs_as_outputs branch June 12, 2024 22:26
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.

Enable outputs to access all inputs
3 participants