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

Aaron T

03/23/2023, 2:09 PM
Is there a way to have multiple asset groups in one definition? - something like:
Copy code
defs = Definitions(
    assets=[
        load_assets_from_modules(foo, group_name="foo"),
        load_assets_from_modules(bar, group_name="bar")
    ]
...
j

jamie

03/23/2023, 2:20 PM
yeah, the return from
load_assets_from_modules
is a list so you could do
Copy code
assets=load_assets_from_modules(foo, group_name="foo") + load_assets_from_modules(bar, group_name="bar")
or
Copy code
assets=[*load_assets_from_modules(foo, group_name="foo"), *load_assets_from_modules(bar, group_name="bar")]
a

Aaron T

03/23/2023, 2:50 PM
Thanks! that works. What might be a reason that a group would not show up in the UI? went with this format -
Copy code
defs = Definitions(
    assets=[
        *load_assets_from_modules([foo], group_name="foo"), #asset is loaded under default, does not show group in UI
        *load_assets_from_modules([bar], group_name="bar")  #shows group in the UI
    ]
j

jamie

03/23/2023, 2:58 PM
I’m not sure off the top of my head, let me try to replicate
a

Aaron T

03/23/2023, 3:03 PM
If it helps,
foo
has 1 @asset, while
bar
has multiple, including a @graph_asset
j

jamie

03/23/2023, 3:08 PM
i dont think that would have any affect. i tried replicating with plain @asset in foo and bar and i’m not replicating it. what version of dagster are you on? might be a bug in an older version
a

Aaron T

03/23/2023, 3:09 PM
dagster 1.2.2
that module was written by someone else. Might be how it is written. I'll take a look at that. Appreciate you trying to replicate.
j

jamie

03/23/2023, 3:10 PM
ok. as far as i know there wasn’t a bug fix for this kind of thing recently… things to look for on your end could be any manual setting of
group_name
on the assets or and AssetGroups that are created (although i’m pretty sure that’s in the process of being deprecated, so you’d see deprecation warnings)
a

Aaron T

03/23/2023, 3:13 PM
What about if it is in defined in a
ScheduleDefinition(job=define_asset_job("foo_name", selection=["foo"]))
?
j

jamie

03/23/2023, 3:15 PM
huh. i’m honestly surprised that works at all haha, usually the job attached to a schedule needs to also be in the definitions. so you’d have to do something like this
Copy code
foo_asset_job = define_asset_job("foo_name", selection=["foo"])
ScheduleDefinition(job=foo_asset_job)

defs = Definitions(
    assets=...,
    jobs=[foo_asset_job]
)
🤔 1
that could be part of the issue. we might be doing some implicit adding of that job to the definitions and perhaps the group name isn’t attached so it gets the default designation
a

Aaron T

03/23/2023, 4:26 PM
I removed the schedule from the defs, but didn't seem to have any affect. But thinking about it now, no real reason to have a scheduled asset. Just set a freshness policy.
16 Views