https://dagster.io/ logo
Title
n

Nicholas Pezolano

02/24/2023, 12:13 AM
What's the recommended way to run a single job/asset group on multiple schedules? Create a job for each schedule of the same asset group?
c

claire

02/24/2023, 12:22 AM
Hi Nicholas. Yep, I would recommend creating a different schedule for the same job/asset group as desired.
:dagster: 1
n

Nicholas Pezolano

02/24/2023, 12:25 AM
Thanks, If I use the same job it throws an error
dagster._core.errors.DagsterInvalidDefinitionError: Duplicate definition found for my_job_schedule
So I create a new job with the same asset group?
c

claire

02/24/2023, 9:38 PM
So schedule names need to be unique (as do jobs, assets, sensors, etc). My guess as to why you're seeing this is you have something like:
my_schedule = ScheduleDefinition(
    job=my_job, cron_schedule="5 8 * * 1-5", execution_timezone='America/New_York'
)

schedule_2 = ScheduleDefinition(
    job=my_job, cron_schedule="* 8 * * 1-5", execution_timezone='America/New_York'
)
which creates two schedules with name
my_job_schedule
. You'll need to specify the name param on one of those schedules to give it a different unique name:
schedule_2 = ScheduleDefinition(
    job=my_job, cron_schedule="* 8 * * 1-5", execution_timezone='America/New_York', name="foo"
)