Slackbot
04/21/2023, 11:26 AMPeter Robinson
04/21/2023, 11:46 AMhamilton/hamilton/function_modifiers/configuration.py
to include config_used
as an arg to the config
class constructor. It seems like this gives None
when using a lambda/function for the config -
eg @config(some_func)
seems to now break thingsPeter Robinson
04/21/2023, 11:54 AM@config(some_func, config_used=[])
but this seems a little wrong in the long term...Elijah Ben Izzy
04/21/2023, 1:17 PMElijah Ben Izzy
04/21/2023, 5:38 PMconfig_used
): https://github.com/DAGWorks-Inc/hamilton/pull/144/. You can get it with:
pip install git+<https://github.com/dagworks-inc/hamilton.git@fix-config-base>
Otherwise I’ll be releasing 1.22.3
shortly 🙂Elijah Ben Izzy
04/21/2023, 5:40 PM@config
(the base one, not `@when`/`@when_in`). I think we can build a cleaner version:
@config.custom(lambda item_1, item_2=False : item_1 || item_1)
Which would mean that item_1
and item_2
are fields in the passed in config
— this could be more readable and folows a similar paradigm to our only other config-direct decorator @resolve
Elijah Ben Izzy
04/21/2023, 5:40 PMPeter Robinson
04/24/2023, 8:13 AMPeter Robinson
04/24/2023, 8:15 AM@config
like this:
def some_func(dag_config):
value = dag_config.get("key")
# any checks on value, returning bool
@config(some_func)
def dag_node(input):
# normal node impl
So passing in the full config and extracting the values I need in the function itself.Elijah Ben Izzy
04/24/2023, 2:00 PMwhen_not
and when_not_in
variants)? If there’s a general pattern that would be useful to others I’m happy to add…Peter Robinson
04/24/2023, 2:04 PMElijah Ben Izzy
04/24/2023, 2:08 PM