My team and I have assets in 2 different code loca...
# ask-community
t
My team and I have assets in 2 different code locations. Both locations utilize automaterializations and freshness policies. One location is successfully auto materializing and keeping designated assets fresh. However, the other code location does not auto materialize or keep the designated asset fresh (according to the freshness policy). I have looked and dagit shows that the asset has both an auto materialization policy (eager) and a freshness policy (once an hour) attached to it. Is there any reason an auto materialization policy would run for one asset and not another? Note, the asset in question is at the very top of the lineage, i.e it has no dependencies on other assets.
d
Hi Tyler - I'm going to double-check this with the auto-materialization experts when they're back in the office in the next day or two - but are you saying that you want the eager auto-materialize policy asset to automatically fire in order to meet its freshness policy? I belive the policy needs to be set to 'lazy' rather than 'eager' for that to occur, as per https://docs.dagster.io/concepts/assets/asset-auto-execution#auto-materialize-policies-and-freshness-policies
t
AH I do see that, however shouldn't it still auto materialize to meet the asset's freshness policy even with eager? The asset in question is the top most upstream asset, so in theory eager vs. lazy shouldn't matter in terms of meeting the freshness policy correct?
d
I think you’re right - any chance you have a code snippet that reproduces this?
Also what version of dagster is this?
t
1. I am in an air-gapped environment so I will try to reproduce it on an open computer and send it to you 2. We are running version 1.4.10 as 1.4.11 has yet to be added to the air-gapped environment
@daniel Here are two code snippets giving you a high overview of the two assets in question. I apologize if there are any spelling mistakes I did this freehand🤣 So in one code location we have:
Copy code
@asset(required_resource_keys={'requests_session'},
        io_manager_key='pg_truncate',
        freshness_policy=FreshnessPolicy(maximum_lag_minutes=24 * 60)
        )
def generated_dictionary(context):
    #Do some work here
    
    return Output(value=generated_model, data_version=DataVersion(hashed_value_of_model))
And this successfully runs according to the asset's freshness policy. In another code location we have:
Copy code
@asset(
    required_resource_keys={'minio'},
    config_schema = {'bucket': Field(str, default_value='TeamBucket')},
    freshness_policy = FreshnessPolicy(maximum_lag_minutes=60),
    io_manager_key='pg'
    auto_materialize_policy=AutoMaterializePolicy.eager()
    )
def get_files(context: OpExecutionContext):
    #Get files from s3 here
    
    return Output(value=files_array, data_version=DataVersion(hashed_value_of_files))
This asset does not auto-materialize based on the freshness policy. However, I can still manually materialize the asset successfully. Both assets are the top most asset in their respective lineages, and are running through dagster-webserver 1.4.10 (corresponding with both asset's dagster versions)