https://dagster.io/ logo
#ask-community
Title
# ask-community
b

Brian Ren

04/05/2023, 12:46 PM
And the second question is that: For the same function, when the
DagsterRunStatus.SUCCESS
shows in the log, the
context.dagster_run.asset_selection
is None. Why is that
s

sandy

04/05/2023, 7:11 PM
If a run targets all the assets in the job, then the asset_selection field won't get filled out. If you want to find all the materializations that were planned as part of a run, you can do
Copy code
materializations_planned = context.instance.get_records_for_run(
            run_id=run_id, of_type=DagsterEventType.ASSET_MATERIALIZATION_PLANNED
        ).records
        asset_keys = set(cast(AssetKey, record.asset_key) for record in materializations_planned)
b

Brian Ren

04/06/2023, 10:29 AM
Hi Sandy, but in our case, only a single Asset is included in the Run
s

sandy

04/06/2023, 4:43 PM
Does the job have more than a single asset?
b

Brian Ren

04/06/2023, 6:58 PM
No, every job we have only has a single asset
s

sandy

04/06/2023, 8:48 PM
In that case, the run is targeting all the assets in the job, so the asset_selection field won't get filled out The above snippet should still work though for finding the asset targeted by the job
👍 1