I have a question regarding assets, dependencies a...
# ask-community
p
I have a question regarding assets, dependencies and jobs. I thought that if I have a DAG A->B->C and I schedule the materialization of C, then the dependency is inferred by Dagster, and A and B will be materialized as well as C depends on them. But the observation is that C fails due to the inavailability of B. I see that I can overcome this by saying
selection="*"
in
define_asset_job
but wonder if I do this correctly, becasue by doing so, I would include assets as well that are not required, and by being more selective, I would resolve the DAG manually and therefore the job definition would be tightly coupled to the DAG, while by specifying a job I really only want to say "I want C, and I don't care what C depends on, do the needful". Is my conclusion correct or am I using Dagster incorrectly?
🤖 1
v
You can use the
AssetSelection
syntax with
define_asset_job
(https://docs.dagster.io/_apidocs/assets#dagster.AssetSelection). Something like the following should work:
Copy code
define_asset_job(..., selection=AssetSelection.keys("C").upstream())
👍 1
p
Looks great!
My mental model was somewhat different, I thought that in a graph, only the terminal nodes are of interest, but within a job, I can basically materialize each node, and therefore, I need to specify it.