Vadim Ogranovich
09/05/2024, 3:01 PM@parameterize(
SOME_OUTPUT_NAME=dict(n_off_date=source('SOME_INPUT_NAME'), shift_by=value(1)),
)
def date_shifter(n_off_date: pd.Series, shift_by: int = 1) -> pd.Series:
"""{one_off_date} shifted by shift_by to create {output_name}"""
return n_off_date.shift(shift_by)
...
node = driver.graph.nodes['SOME_OUTPUT_NAME']
Is there a way to get shift_by from node?Elijah Ben Izzy
09/05/2024, 3:05 PMSOME_OUTPUT_NAME_<i>
2. just remember a mapping — us e as it of name -> shift values
That said, I think this could be useful, and we could encode the parameters in tags (which are accessible). Mind opening up an issue?Stefan Krawczyk
09/05/2024, 3:51 PMStefan Krawczyk
09/05/2024, 4:12 PMStefan Krawczyk
09/05/2024, 4:12 PMpartial function that would hold the bound valuesStefan Krawczyk
09/05/2024, 4:12 PMElijah Ben Izzy
09/05/2024, 4:13 PMElijah Ben Izzy
09/05/2024, 4:13 PMStefan Krawczyk
09/05/2024, 4:14 PMStefan Krawczyk
09/05/2024, 4:14 PMStefan Krawczyk
09/05/2024, 4:15 PMElijah Ben Izzy
09/05/2024, 4:15 PMStefan Krawczyk
09/05/2024, 4:17 PMVadim Ogranovich
09/05/2024, 8:45 PMdefault_optional_values attribute of the node. It would make it consistent with the use of the attribute in the regular, aka function, node.
There should be no difference between
def a(x = {}): ...
and
@inject(dict(x=value({})))
def a(x): ...Vadim Ogranovich
09/05/2024, 8:57 PMStefan Krawczyk
09/05/2024, 9:01 PMVadim Ogranovich
09/05/2024, 9:02 PMStefan Krawczyk
09/05/2024, 9:08 PMVadim Ogranovich
09/05/2024, 9:10 PMx via the node object. For vanilla nodes one can already do it via default_optional_values. For parameterized nodes each generated node should have its own x and I want to be able to get hold of and manipulate it. Does this make sense?Stefan Krawczyk
09/05/2024, 9:12 PMVadim Ogranovich
09/05/2024, 9:14 PMx['foo'] = 1, outside of the dag execution.Vadim Ogranovich
09/05/2024, 9:21 PMinspect magic, is available in the default_optional_values attribute of the DAG node.Vadim Ogranovich
09/05/2024, 9:24 PMElijah Ben Izzy
09/05/2024, 9:35 PMdef a(x: dict={}) is effectively saying “if x does not exist (either as an upstream node or an input), then it has a value of empty dict)`
The second one says: “the a node has a fixed value of x ”
Thus if you provide x as an input it’ll work for the first one — but for the second one I don’t think we can use it as an input.
To be clear though, by “manipulate” — do you mean change the parameter at runtime? E.g. dynamically alter the inputs?Stefan Krawczyk
09/05/2024, 9:45 PMVadim Ogranovich
09/05/2024, 9:53 PMvalue(...) of @parameterize. My apologies, I started to use @inject as the baseline example. With an implicit implication that it should apply to @parameterize too.Vadim Ogranovich
09/05/2024, 9:55 PMStefan Krawczyk
09/05/2024, 9:59 PMStefan Krawczyk
09/05/2024, 9:59 PM@resolve.Stefan Krawczyk
09/05/2024, 10:01 PMVadim Ogranovich
09/05/2024, 10:01 PMdef a(x: dict={}) is effectively saying “if x does not exist (either as an upstream node or an input), then it has a value of empty dict)`
The second one says: “the a node has a fixed value of x ”
I understand this distinction, and it's an issue indeed, but it doesn't affect my use case. You guys can keep the two semantics and each of them will work for me.Stefan Krawczyk
09/05/2024, 10:04 PMVadim Ogranovich
09/05/2024, 10:04 PM@resolve . It "might" do the trick, but it's too bulky for my use case. I'd rather do without @parameterize and clone nodes manually.Stefan Krawczyk
09/05/2024, 10:05 PMI’d rather do withoutSide comment: I have thought about “compiling” away some decorators, and outputting verbose code — but there really hasn’t been a use case for it.and clone nodes manually.@parameterize
Vadim Ogranovich
09/05/2024, 10:07 PMdefault_optional_values on vanilla nodes do the trick for me. I am just "asking" for more comfort 🙂Stefan Krawczyk
09/05/2024, 10:08 PMVadim Ogranovich
09/05/2024, 10:08 PM@parameterize not going to work out.