https://dagster.io/ logo
#dagster-support
Title
# dagster-support
g

Gabe Schine

12/21/2022, 6:28 PM
Does calling an
@asset
function from a
@job
cause the asset to be re-materialized, or does it use whatever was the last materialization value?
🤖 1
@Dagster Jarred I've had trouble finding a definitive answer to this question in the documentation.
Doing my own testing, it appears that answer is "yes", it will re-materialize the asset?
In which case: let's say I want a job to run whenever one of the input assets is re-materialized, but I want to use whatever was the latest value for all of the assets, is there a way to do that?
d

Daniel Mosesson

12/21/2022, 9:43 PM
Why not use the
asset_sensor
?
g

Gabe Schine

12/21/2022, 9:58 PM
I am for triggering the job in response to the asset being updated by a
FreshnessPolicy
, but the job calls the asset function and it is re-materialized
Is there something in the use of
asset_sensor
that I am missing?
Example:
Copy code
@asset(freshness_policy=...)
def my_asset(): return 5

@job(...)
def use_my_asset():
  # This is where I'd like to load the value from the last materialization.
  asset_value = my_asset()
  do_stuff_with_value(asset_value)
I have an
asset_reconciliation_sensor
that is responsible for reloading
my_asset
, and an
@asset_sensor
that triggers
use_my_asset
d

Dagster Jarred

12/22/2022, 4:23 AM
thanks @Gabe Schine for pointing out this question. I’ll have to defer to one of our experts @sandy @owen @sean
g

Gabe Schine

12/22/2022, 5:39 AM
Hey - thanks @Dagster Jarred for looping back around.
s

sandy

12/22/2022, 6:39 AM
Hi Gabe, we don't currently have a straightforward way to use an asset as an input to one of the ops in a job, although we're interested in adding this. Here's the issue where we've been tracking this: https://github.com/dagster-io/dagster/issues/10874
g

Gabe Schine

12/22/2022, 6:43 AM
Gotcha thanks for the link! For now I guess I should model the downstream job as another asset to take advantage of the input handling there.
37 Views