You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, an entity's value is only recomputed if its inputs change or its code changes. However, sometimes people want entities to be recomputed whenever some amount of time has passed. For example, we may want to download new data from a database each day. Right now the best workaround is like this:
This fails because if we call flow.get('summary') and it finds a cached value, it will return it because it doesn't know that current_data ought to be recomputed. We need to invalidate not just current_data, but all downstream entities as well.
A better approach would be a way to tell Bionic that (a) an entity should be recomputed every time, and (b) downstream entities should only be recomputed if this entity's output changes. Maybe something like:
@builder
@bn.volatile # Always recompute
@bn.digestible # Hash the output to determine whether to recompute children
def date():
return datetime.today().strftime('%Y-%m-%d')
@builder
def current_data(date):
return download_data()
I'm not sure about the names, or about needing two separate decorators (although I do think they would be useful independently).
The text was updated successfully, but these errors were encountered:
Currently, an entity's value is only recomputed if its inputs change or its code changes. However, sometimes people want entities to be recomputed whenever some amount of time has passed. For example, we may want to download new data from a database each day. Right now the best workaround is like this:
This is a bit hacky and doesn't work if the flow is long-lived, because
date
only gets updated when the flow is defined.Note that the following does not work:
This fails because if we call
flow.get('summary')
and it finds a cached value, it will return it because it doesn't know thatcurrent_data
ought to be recomputed. We need to invalidate not justcurrent_data
, but all downstream entities as well.A better approach would be a way to tell Bionic that (a) an entity should be recomputed every time, and (b) downstream entities should only be recomputed if this entity's output changes. Maybe something like:
I'm not sure about the names, or about needing two separate decorators (although I do think they would be useful independently).
The text was updated successfully, but these errors were encountered: