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

David Mulhall

05/27/2022, 8:03 AM
Hi All, Is there a way to dynamically create multiple schedules from the same job, just with different configs
🤖 1
s

sean

05/27/2022, 1:25 PM
Hi David, Do you mean for (rather than from) the same job? If so: • Since schedules are defined in Python code, there’s no reason you can’t create them dynamically • You can define multiple schedules for the same job
d

David Mulhall

05/30/2022, 5:43 AM
Yes, I have one Job and want multiple schedules: At the moment I am creating multiple Run Request from the same Schedule:
Copy code
@schedule(
    job=job1,
    execution_timezone="Europe/Berlin",
    cron_schedule="*/5 * * * *",
    default_status=DefaultScheduleStatus.RUNNING

)
def job1_schedule():
    for config in [config1, config2, config3, ....]
        yield RunRequest(
            run_key="job1",
            run_config= config
        )
Is there a way to loop over my configs and create a schedule for each one?
s

sean

05/30/2022, 10:45 PM
If I understand you, something like this should work:
Copy code
schedules = []

for i, config in enumerate([config1, config2, config3]):
    @schedule(job=job1, name=f"job1_schedule_{i}", ...)
    def schedule_func():
        yield RunRequest(...)
    schedules.append(schedule_func)
Has that solved your issue?
d

David Mulhall

06/03/2022, 6:03 AM
Sorry only getting back to this now, yes thank you this helped me
👌 1
10 Views