dagster-io / dagster

An orchestration platform for the development, production, and observation of data assets.
https://dagster.io
Apache License 2.0
11.33k stars 1.43k forks source link

How do I set a schedule to be enabled by default? #18097

Open dagsir[bot] opened 10 months ago

dagsir[bot] commented 10 months ago

Issue from the Dagster Slack

This issue was generated from the slack conversation at: https://dagster.slack.com/archives/C01U954MEER/p1700181847255259?thread_ts=1700181847.255259&cid=C01U954MEER


Conversation excerpt

U060JC70DHC: I have successfully defined a schedule as such


    job=master_inventory_list_job,
    cron_schedule="*/3 * * * *", 
)```
It defaults to not enabled in the UI, I need to manually enable it to watch it work. How do I get around that in my code?
U0300665S8G: <@U018K0G2Y85> issue How do I set a schedule to be enabled by default?

---

#### Message from the maintainers:

Do you care about this too? Give it a :thumbsup:. We factor engagement into prioritization.
zyd14 commented 10 months ago

It seems that the original conversation from slack got cut off, so here it is:

I have successfully defined a schedule as such

trip_update_schedule = ScheduleDefinition(
job=master_inventory_list_job,
cron_schedule="*/3 * * * *", 
)

It defaults to not enabled in the UI, I need to manually enable it to watch it work. How do I get around that in my code?

You can set a schedule to be enabled by default by using the default_status option:

from dagster import DefaultScheduleStatus, ScheduleDefinition

trip_update_schedule = ScheduleDefinition(
    job=master_inventory_list_job,
    cron_schedule="*/3 * * * *", 
    default_status=DefaultScheduleStatus.RUNNING
)
martonmesz commented 3 months ago

Why is the schedule disabled by default? Is there any justification for this?