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

Alec Ryan

04/20/2022, 11:49 AM
Are there any examples of how to partitioned job built by an asset group?
j

johann

04/20/2022, 2:06 PM
cc @claire
c

claire

04/20/2022, 4:58 PM
Hi Alec. I can provide a short one here:
Copy code
daily_partitions_def = DailyPartitionsDefinition(start_date="2020-01-01")


@asset(partitions_def=daily_partitions_def)
def upstream_daily_partitioned_asset(context):
    return 1


@asset(partitions_def=daily_partitions_def)
def downstream_daily_partitioned_asset(upstream_daily_partitioned_asset):
    return 2

partitioned_asset_job = AssetGroup.from_current_module().build_job("partitioned_asset_job")
a

Alec Ryan

04/20/2022, 6:12 PM
Hey Claire, thanks! Just what I was looking for
So, there is no need to specify whether or not the job is a partitioned job? The assets inform that?
c

claire

04/20/2022, 7:20 PM
nope! all the partitions definitions just need to be specified on the asset
❤️ 1
a

Alec Ryan

04/20/2022, 7:32 PM
thanks!
How would I schedule the job above?
c

claire

04/20/2022, 7:40 PM
The easiest way is probably to use the
build_schedule_from_partitioned_job
method:
Copy code
partitioned_asset_job_schedule = build_schedule_from_partitioned_job(partitioned_asset_job)
4 Views