How can i select a subset of assets in dagster b...
# ask-community
m
How can i select a subset of assets in dagster based on config. For example if i have 30 assets I would like to choose a subset of them for each configuration. My config would be something like:
Copy code
config:
   job_type: ml
   job_sub_type: parameters
or another example would be:
Copy code
config:
   job_type: etl
   job_sub_type: batch_tables
So based on this, I would like to choose subset of assets.
This asset based job is triggered from a sensor, so likely that sensor can choose the assets through the
asset_selection
in
RunRequest
However for cases where this asset based job is run standalone, Not sure how to select assets based on config
o
hi @Murali Bala! there's no way to convert config to an asset selection, as both of these properties end up as parameters to the underlying
RunRequest
(so one can't impact the other) for sensors, you're correct that the
asset_selection
in the
RunRequest
would work. for standalone jobs, I'd recommend just making two separate jobs, i.e.:
Copy code
ml_job = define_asset_job("ml", selection=AssetSelection.<something>, config=...)

etl_job = define_asset_job("etl", selection=AssetSelection.<something else>, config=...)
👍 1
ty spinny 1