Dagster multi asset always reads all the dependent...
# ask-community
m
Dagster multi asset always reads all the dependent source assets even when I materialize one Output in the Dagit UI. In the Decorator function however I am able to specify what assets to Yield as Output but still all the source assets gets read. In the below code snippet, even when I try to materialize my_asset1, both sourceAsset1 and sourceAsset2 gets read.
Copy code
@multi_asset(
     outs={
        "my_asset1": AssetOut(),
        "my_asset2": AssetOut(),
    }
    )
    def _asset(sourceAsset1,sourceAsset2):
    	if "my_asset1" in context.selected_output_names:
            yield Output(sourceAsset1, "my_asset1")
        if "my_asset2" in context.selected_output_names:
            yield Output(sourceAsset2, "my_asset2")
Is there a way in Dagster to restrict this?
t
Hi! If you'd like to manage the I/O yourself, you can use the
non_argument_deps
argument to specify your dependencies, and then load your data manually the asset function
Here's a simplified example from the tutorial https://docs.dagster.io/tutorial/managing-your-own-io