-
Notifications
You must be signed in to change notification settings - Fork 88
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 the materializers to depend on functions & driver variables #431
Merged
elijahbenizzy
merged 8 commits into
main
from
enable_materializer_dependencies_to_depend_on_funcs
Oct 5, 2023
Merged
Enables the materializers to depend on functions & driver variables #431
elijahbenizzy
merged 8 commits into
main
from
enable_materializer_dependencies_to_depend_on_funcs
Oct 5, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6561d35
to
54f0639
Compare
elijahbenizzy
approved these changes
Oct 5, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
.execute() enables that. The materializers should also be able to handle it. The complication however is on who knows what and when to do it. So I made the decision to make the driver sanitize the materializers given the context that it has. New objects are returned so we don't modify the underlying materializer object -- that way if someone is reusing a materializer definition they can do so in other driver runs/etc.
Given A --> B For this directional edge to be valid we want A to be a subclass of what B takes. For loaders -- we're checking A, the loader, can be fed into B. e.g. is loader_A a subclass of input B can take. i.e. the decision function is (loader, function) For savers -- we're checking A, the function, can be fed into B the saver. e.g. function_A a subclass of input B the saver can take. i.e. the decision function is (function, loader) In the code, though, we are treating the two cases the same, as a decision of (loader, function). So this fixes that by creating two separate functions for a saver and a loader. That way the directional check is correct. Adds tests for it.
We want to enable the case where `Any` can be a super type of any type. So this change makes enables the code to short circuit if we're asking whether something is a subclass of the "Any" type.
Rather than default returning to the last one. We should check for all, and then return the last one, but warn in the case of multiple being present. This I think will result in a better experience. We could make the logging statement a debug one, but we can change that later.
So both the driver and materializer need to handle converting function names and variables into strings. This is a little messy -- but it centralizes logic in common. I didn't bother with another file because I didn't know what to call it. So putting under common seems fine. Otherwise I added tests to ensure that new functionality works, and left the existing tests to ensure nothing broke.
So that one can do the following: ```python to.memory( id="output_df", dependencies=outputs, combine=base.PandasDataFrameResult() ), ``` i.e. reuse any result builder and get that result return in memory. This is in effect helps one to dynamically add/adjust a result builder -- which I think is useful for development.
With the change of applies_to -- it means that single classes are not a good idea. So splitting up the default ones appropriately.
We missed adding it -- along with the nice error message for helping people get to slack. I think what I did makes sense, and mirrors what .execute() does right now.
f96fe39
to
6095852
Compare
elijahbenizzy
approved these changes
Oct 5, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
.execute() enables that. The materializers should also be able to handle it.
The complication however is on who knows what and when to do it. So I made the decision to make the driver sanitize the materializers given the context that it has. New objects are returned so we don't modify the underlying materializer object -- that way if someone is reusing a materializer definition they can do so in other driver runs/etc.
Changes
How I tested this
Notes
Checklist