GitHub user gidhubuser255 added a comment to the discussion: APIs for updating
underlying function of a node (2 part question)
> the Ds are not the same on the right.
Agreed, within the wider context of the full graph (and more specifically the
upstream node differences). To clarify, what I was referring to was, for the
node in isolation the underlying functions/computation logic is identical. The
reason I pointed this out was to draw attention to the fact that even though
they are identical in isolation, they can not be currently represented in
hamilton by a single static function because they have different upstream
dependencies. So they either need to be represented as separate static
functions (e.g. my enumerated X_thru_Y examples in the OP), or some mechanism
would need to take a single function and apply its logic to separate nodes in
the graph (which I will look into subdag etc to see how those can help).
To expand on my immediate use case I'm currently working on building a web-UI
framework with hamilton as the underlying engine. Imagine this contrived
pseudo-code/pseudo-typed DAG:
```
def main_view(orders_view: HTMLString, shipments_view: HTMLString) ->
HTMLString:
return f'''
{orders_view}
{shipments_view}
'''
def orders_view(orders: List[Order]) -> HTMLString:
# includes orders date picker
...
def shipments_view(shipments: List[Shipment]) -> HTMLString:
# include shipments date picker
...
def orders(date: Date) -> List[Order]:
...
def shipments(orders: List[Order], date: Date) -> List[Shipment]:
...
def date() -> Date:
...
```
Now let's say in my UI I want to select a new date for the shipments view. I
don't want my orders view to be affected, but they share upstream components so
currently there's no way to just take the above defined functions and get the
behavior I want. With my proposed api I could just do this:
```
driver = driver.update(date=new_date, in_path=['shipment_view'])
driver.execute('main_view')
```
Besides this UI example the path specific update concept is very useful in
identifying sensitivities and error sources in timeseries forecasting.
GitHub link:
https://github.com/apache/hamilton/discussions/1397#discussioncomment-14581669
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to:
[email protected]