Slackbot
06/26/2023, 9:33 PMElijah Ben Izzy
06/26/2023, 9:50 PMfoo
and bar
), you would use the resolve decorator, along with subdag
. What the resolve
decorator does is waits until after a config is available to create the DAG, rather than creating it from hardcoded items:
@resolve(
when=ResolveAt.CONFIG_AVAILABLE,
decorate_with=lambda bar_start, bar_end, features : subdag(
module_defining_features,
inputs={
'start': value(bar_start),
'end' : value(bar_end)
)
)
def bar(feature_1: pd.Series, feature_2: pd.Series, feature_3: pd.Series) -> pd.Series:
...
Then repeat the same for foo
. Note that this has two hardcoded assumptions (the feature names), so it isnât what you want. However, you can make it more flexible using @parameterized_subdag
â this enables you to run multiple subdags. The only challenge is dynamically specifying the outputs, which we donât yet have available, so youâd likely want to either (a) do one subdag per each foo/bar combination or do something a little smarter (output a dataframe, and select just the columns you need.).
I think to make this more ergonomic, weâd need to add parameterizing which outputs â will dig a bit to ensure there isnât an easier way to do that specifically.
That said, I think thereâs another solution to your issue thatâs pretty clean, and Iâd love to get your take. Writing down nowâŚElijah Ben Izzy
06/26/2023, 10:02 PMresolve
piece, or a custom results builder).
2. Pass each node its set of time ranges, so you only compute those, then use a node/custom results builder to join together at the end, and break columns into two.Elijah Ben Izzy
06/26/2023, 10:02 PMElijah Ben Izzy
06/26/2023, 11:24 PMElijah Ben Izzy
06/26/2023, 11:25 PMCulver McWhirter
06/27/2023, 4:25 PMCulver McWhirter
06/27/2023, 4:26 PMElijah Ben Izzy
06/27/2023, 4:27 PMinject
in that case is only because @subdag
doesnât allow you to dynamically specify what you want from the subdag (its from the fn name), so we use the @inject
to group/join. When you get your final code would love to see what you have so we can tune/add shortcuts in the API đ
Feel free to reach out with any more Qs â all the code I gave you works, you can just run the file with python
and see the outputs (itâll run each case).Elijah Ben Izzy
06/27/2023, 4:29 PMCulver McWhirter
06/27/2023, 11:33 PMElijah Ben Izzy
06/28/2023, 1:12 AM@inject
/`@resolve`Elijah Ben Izzy
06/28/2023, 1:12 AM