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

Rahul Dave

01/30/2023, 2:36 PM
But where is "graph_asset" defined? Or is this some kind of default name?
v

Vinnie

01/30/2023, 2:44 PM
In this case
"graph_asset"
would just be the name scoped to the job created by
define_asset_job()
. You could pass any other string to it.
r

Rahul Dave

01/30/2023, 2:53 PM
What is it labeling though? Suppose I had 2 graphs here and 2 jobs corresponding to these graphs..how would i keep them straight
if i understand you right, here the job "graph_asset" corresponds to the job defined in the assets array in Definitions
in other words is definitions positional? first asset with first job, second with second job, and so on?
v

Vinnie

01/30/2023, 2:58 PM
Try this:
Copy code
my_asset = AssetsDefinition.from_graph(my_graph, keys_by_output_name={"result": AssetKey("my_asset")})
my_job = define_asset_job("my_job", selection=["my_asset"])

my_other_asset = AssetsDefinition.from_graph(my_other_graph, keys_by_output_name={"result": AssetKey("my_other_asset"))
my_other_job = define_asset_job("my_other_job", selection=["my_other_asset"])

defs = Definitions(
    assets=[my_asset, my_other_asset],
    jobs=[my_job, my_other_job],
)
r

Rahul Dave

01/30/2023, 3:06 PM
Aha, the lineage now is way clearer! Thanks! How does the example in the docs get away without such explicit definition? Because its only one?
v

Vinnie

01/30/2023, 3:07 PM
I think someone from the Dagster team will be better equipped to answer that. I’ve only used explicit definitions.
r

Rahul Dave

01/30/2023, 3:07 PM
with you on being explicit!!!
j

jamie

01/30/2023, 4:07 PM
Hi @Rahul Dave if you don’t provide an explicit selection to
define_asset_job
it will create a job that will materialize all of the assets in your definition. So you could in theory have jobs for each asset by providing the
selection
parameter and then one encompassing job that can materialize every single asset