ZeroThree
ZeroThree

Reputation: 61

Start Dagster Schedule automatically

Hi i am learning dagster and i want help with starting schedule I am able to add and start schedule in dagit but i want to start schedule automatically instead of turn on every schedule from dagit.

#Here is my code

@solid()
def test(context):
   context.log.info("test")
  
@pipeline()
def testPipeline():
    test()

@schedule(
    cron_schedule="* * * * *", pipeline_name="testPipeline", execution_timezone="Asia/Kolkata"
)
def scheduleTest():
    return {}

@repository()
def testRepo():
    return [testPipeline, scheduleTest]

Upvotes: 6

Views: 1155

Answers (3)

doublethink13
doublethink13

Reputation: 1015

According to the docs you can try this:

my_running_schedule = ScheduleDefinition(
    job=my_job, cron_schedule="0 9 * * *", default_status=DefaultScheduleStatus.RUNNING
)

Upvotes: 3

Radoslav Bodó
Radoslav Bodó

Reputation: 661

I had a very same question on dagster slack so I'm forwarding Daniel Gibson's answer which might help.

  • since 0.14.0 release, it will be possible to create already enabled schedule (will be released in a week).

  • also, there's a dagster schedule start --start-all command line command, calling that any time you add a schedule would be one workaround

Upvotes: 4

Donny Winston
Donny Winston

Reputation: 2452

There's a startSchedule mutation in the Dagster GraphQL API, which has a Python client. I'm not sure how to call it to start your specific schedule, but I think this route is a good way to go.

Upvotes: 2

Related Questions