Hi All. Just started with dagster recently so forg...
# ask-community
y
Hi All. Just started with dagster recently so forgive my ignorance. when scheduling an asset, how to I force the downstream assets to run after the upstream asset completed? the schedule seems to only run the asset in the selection. The code I have for scheduling the asset in the definitions is:
Copy code
schedules=[
        ScheduleDefinition(
            job=define_asset_job("daily_process", selection=["get_session"]),
            cron_schedule="*/5 * * * *"
        )
    ]
dagster bot responded by community 1
v
You can pass an
AssetSelection
class to the
selection
argument to include downstream asset(s) by calling its
.downstream()
method. https://github.com/dagster-io/dagster/blob/master/python_modules/dagster/dagster/_core/definitions/asset_selection.py#L17 The following should work:
Copy code
schedules=[
        ScheduleDefinition(
            job=define_asset_job("daily_process", selection=AssetSelection.keys(AssetKey(["get_session"])).downstream()),
            cron_schedule="*/5 * * * *"
        )
    ]
clapping all 1
c
looks like you can also use this kind of sensor to materialize assets even if they are in different definitions https://docs.dagster.io/_apidocs/schedules-sensors#dagster.build_asset_reconciliation_sensor
y
Thanks for the insights @Vinnie and @cvb. Gonna check now and let you know.
@Vinnie worked like a charm; Thanks
@cvb will check the sensor implementation too