-
Notifications
You must be signed in to change notification settings - Fork 37
Conversation
5d2e92b
to
5e3bd18
Compare
This attempts to unit all the parametrized flavors of function_modifiers. Specifically, this enables one to specify two source of inputs: 1. literal 2. upstream Replacing the function's arguments, as well as direct assignment to a node name. Note that, currently, docstrngs are provided as part of the decorator. We will be allowing this to use parametrized docstrings. This intends to replace all types of parametrized decorators using delegation.
parametrized_full now has two ways of managing documentation: 1. Passing in documentation directly 2. Parametrizing documentation (as we currently do for parametrized_inputs) (1) is the easiest route and matches @parametrized (2) allows for us to have parametrizable docstrings. Note: 1. We use python's str.format(...) function to enable this 2. We automatically replace a docstring parameter with itself if it doesn't have a corresponding input parameter. Note that means that not providing parametrization for an input is still valid.
5e3bd18
to
6b04f8a
Compare
This s a WIP, but its on the right track. Things to do:
|
We now no longer need bespoke logic. Thus we remove the body of all variants, and replace with @parametrized_full. We can probably remove a little validation as well...
6b04f8a
to
eeaa5c6
Compare
Next we're going to add `@parameterize_inputs` and `@parameterize_values` to be the new decorators so its: 1. Consistent with the tenses (E.G. extract_columns) 2. Spelled consistently 3. Reduced surface area
Decided to build my own as I wanted to fully manage the lifecycle of items. Currently meant for dev use but I guess this could also be used for hamilton functions/nodes? Interesting... Some things to think about: 1. This allows us to keep something that's deprecated in the future. Unlikely to be useful but gives us some freedom. 2. All versions are standard, no funky versions or rc versions (the rc gets stripped) 3. This forces us into contracts. Though we can break them, I like the idea of making deprecations a planned event.
76adc9e
to
c6d3b52
Compare
1. @parameterize 2. @parameterize_values 3. @parameterize_inputs The rest are old and will be phased out eventually.
Some small fixes for the PR
638298b
to
71d6f4e
Compare
It should be called on function call. This, however, adds complexity, as we need to be able to decorate both classes (that define __call__) and functions (that happen to have __call__). There is some complexity that python doesn't handle well -- a third party library like wrapt might help but I wanted to keep it simple.
Need to run a ray/spark/dask test, but more likely will add some basic integration tests for everything -- E.G> a DAG that uses all our features. |
caafbb5
to
6492feb
Compare
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.
I think we should have a clearer migration section that we can link to so people know what to do and until when.
if bad_values: | ||
raise InvalidDecoratorException(f'@parameterize must specify a dependency type -- either upstream() or literal().' | ||
f'The following are not allowed: {bad_values}.') | ||
self.specified_docstrings = {key: value[1] for key, value in parametrization.items() if isinstance(value, tuple)} | ||
|
||
def expand_node(self, node_: node.Node, config: Dict[str, Any], fn: Callable) -> Collection[node.Node]: |
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.
can we break this function up at all into smaller testable chunks?
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.
Don't really think its worthwhile? Its about 40 lines, which doesn't seem ridiculous to me, and all kind of does one thing (gathers the nodes). Might be able to do something aroudn the docstirng, but I 've already streamlined that to some extent.
5d4e484
to
542cc7b
Compare
5bfd8dc
to
75c5109
Compare
5e98ae8
to
68b3165
Compare
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.
Just some documentation nits.
This is a temporary workaround, but its quite stable. In reality, `ray` should have something like this. Will open up an issue.
…pters We could probably improve the shared code here, but this is absolutely worth getting out as is. We test the most common functionalities in all graphadapters -- they can copy/paste each others tests. See comments in smoke_screen_module.py for core features.
68b3165
to
fa89410
Compare
Consolidates logic behind all
parametrized
decoratorsChanges
full_parametrized
decoratorTesting
Notes
Checklist
Testing checklist
Python - local testing