https://dagster.io/ logo
#dagster-support
Title
# dagster-support
v

Vinnie

01/20/2023, 12:41 PM
Is there an (elegant) way to define what subset of assets in a
multi_asset
is required? For a current use case, I have a
multi_asset
generating roughly 8 assets, of which either all 8 or only a specific subset of them would be expected. I would know at runtime which case (all assets or subset) the run falls under.
c

chris

01/21/2023, 1:30 AM
cc @owen, but I believe you could provide an asset selection to job construction for example that cross-cuts your multi asset
o

owen

01/23/2023, 5:34 PM
Hi @Vinnie! There's no super-elegant way to describe this, to the asset layer, multi assets are basically just "you have to materialize all of these" or "you can materialize any subset of these". For your very specific use case, I think you could mark the "specific subset" of assets with
AssetOut(is_required=True)
, with the others as
AssetOut(is_required=False)
, which would at the very least error (at runtime) if you tried to materialize a subset that didn't contain all of the required ones
v

Vinnie

01/24/2023, 12:33 PM
Hm yeah that’s what I wound up doing. I guess I’ll build a check into the asset function that alerts in case not all are materialized.