Does calling an `@asset` function from a `@job` ca...
# ask-community
g
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
Why not use the
asset_sensor
?
g
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
thanks @Gabe Schine for pointing out this question. I’ll have to defer to one of our experts @sandy @owen @sean
g
Hey - thanks @Dagster Jarred for looping back around.
s
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
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.