This repository has been archived by the owner on Jul 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Implements opinionated decorator lifecycle #28
Merged
Merged
Commits on Feb 6, 2022
-
Implements opinionated decorator lifecycle
This adds to the set of decorators that can be applied to a node, and puts them in a uniform setting. The ordering is provided in function_base.resolve_nodes -- the algorithm is as follows: 1. If there is a list of function resolvers, apply them one after the other. Otherwise, apply the default function resolver which will always return just the function. This determines whether to proceed -- if any function resolver is none, short circuit and return an empty list of nodes. 2. If there is a list of node creators, that list must be of length 1 -- this is determined in the node creator class. Apply that to get the initial node. 3. If there is a list of node expanders, apply them. Otherwise apply the default nodeexpander This must be a list of length one. This gives out a list of nodes. 4. If there is a node transformer, apply that. Note that the node transformer gets applied individually to just the sink nodes in the subdag. It subclasses "DagTransformer" to do so. 5. Return the final list of nodes.
Configuration menu - View commit details
-
Copy full SHA for 57aba12 - Browse repository at this point
Copy the full SHA 57aba12View commit details -
Builds an expression transform object
This allows us to run nodes like the following: @Transform('a=a+b+c') def a(): ... And now a will be the result of adding a to b to c. Note a, b, c, currently have to be a node or a config item. Some caveats: 1. Its unsafe! We use eval now 2. Its just called transform. Re (2) we should make it so the transform utilizes the same pattern as config: 1. The transform takes in a lambda that takes in a dict 2. transform.to(...) takes in an expression and creates (1) by passing to a superclass
Configuration menu - View commit details
-
Copy full SHA for d453399 - Browse repository at this point
Copy the full SHA d453399View commit details -
Allows for adding in optional dependencies to Node
For when the function signature doesn't accurately reflect the dependency type -- E.G. in created nodes (such as a transform) in which we want to use kwargs.
Configuration menu - View commit details
-
Copy full SHA for aa0c57e - Browse repository at this point
Copy the full SHA aa0c57eView commit details -
Fixes case in which config.when() and transform work together
There's some subtlety with the name. Previously, config.when would change the function name accordingly. This was so that later on decorators could refer to the function by its true name. However, this broke depending on decorator ordering. This change adds a sanitize_name functionality to unblock the transform decorator, but does not yet take away the name changing functionality. We'll need to think through that, but this is a happy medium for now I think.
Configuration menu - View commit details
-
Copy full SHA for 9a38bbc - Browse repository at this point
Copy the full SHA 9a38bbcView commit details -
Adds a layer of indirection for a model
This solves #53 This allows us to decouple the notion of dynamic_transform from model. Model was specific to Stitch Fix's use-case. With this change, we can build more complex dynamic transforms that aren't limited to pd.Series or simple combinations of nodes. This is also more readable/makes more inherent sense. Note that full backwards compatibility has been maintained by subclassing and keeping parameter names.
Configuration menu - View commit details
-
Copy full SHA for 2a29bb9 - Browse repository at this point
Copy the full SHA 2a29bb9View commit details -
Configuration menu - View commit details
-
Copy full SHA for e3c72e8 - Browse repository at this point
Copy the full SHA e3c72e8View commit details -
This is not going to make it into the final release. Instead see draft PR #60
Configuration menu - View commit details
-
Copy full SHA for 60f6415 - Browse repository at this point
Copy the full SHA 60f6415View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6d4edf7 - Browse repository at this point
Copy the full SHA 6d4edf7View commit details
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.