Is there a way to have multiple asset groups in on...
# ask-community
a
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
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
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
I’m not sure off the top of my head, let me try to replicate
a
If it helps,
foo
has 1 @asset, while
bar
has multiple, including a @graph_asset
j
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
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
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
What about if it is in defined in a
ScheduleDefinition(job=define_asset_job("foo_name", selection=["foo"]))
?
j
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
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.