Scheduling Jobs and Pipelines

Scheduling

The scheduler takes cron expressions to create schedules for when to run both sync and pipeline transactions.

Scheduling Jobs

Creating a New Schedule

To create a new schedule for a job you can use the scheduler /sync/config endpoint.

To create a schedule for a job, you will need the job ID of the job you want to schedule and the cron expression for the schedule. This example creates a schedule that runs the job every minute.

curl --request POST '{{impulse-protocol}}://{{impulse-domain}}:{{impulse-port}}/private/scheduler/config' \
--header 'Content-Type: application/json' \
--data-raw '{
  "cronregexp": "* * * * *",
  "jobid": "{{job-id}}"
}'

The response will provide the id of the newly created schedule config. You can save this ID to later update the config.

This endpoint can be used to create multiple schedules for the job.

Updating an Existing Schedule

To update an existing schedule you can use the scheduler's /sync/config/{{config-id}} endpoint.

To update an existing schedule you will need the schedule config ID, the job ID, and the cron expression for the schedule. This example updates the schedule to run the job every 5 minutes.

curl --request PUT '{{impulse-protocol}}://{{impulse-domain}}:{{impulse-port}}/private/scheduler/config/{{config-id}}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "cronregexp": "*/5 * * * *",
  "jobid": "{{job-id}}"
}'

Scheduling Pipelines

Creating a New Schedule

To create a new schedule for a pipeline you can use the scheduler /pipeline/config endpoint.

To create a schedule for a pipeline, you will need the pipeline ID of the pipeline you want to schedule and the cron expression for the schedule. This example creates a schedule that runs the pipeline every minute.

curl --request POST '{{impulse-protocol}}://{{impulse-domain}}:{{impulse-port}}/private/scheduler/pipeline/config' \
--header 'Content-Type: application/json' \
--data-raw '{
  "cronregexp": "* * * * *",
  "pipelineid": "{{pipeline-id}}"
}'

This endpoint can be used to create multiple schedules for the pipeline.

Updating an Existing Schedule

To update an existing schedule you can use the scheduler's /pipeline/config/{{configID}} endpoint.

To update an existing schedule you will need the schedule config ID, the pipeline ID, and the cron expression for the schedule. This example updates the schedule to run the pipeline every 5 minutes.

curl --request PUT '{{impulse-protocol}}://{{impulse-domain}}:{{impulse-port}}/private/scheduler/pipeline/config/{{config-id}}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "cronregexp": "*/5 * * * *",
  "pipelineid": "{{pipeline-id}}"
}'

Getting Schedules

You can get schedules either by ID or all the schedules at one time.

The scheduler's /config endpoint can be used to retrieve all schedules created.

curl --request GET '{{impulse-protocol}}://{{impulse-domain}}:{{impulse-port}}/private/scheduler/config'

This will show all the schedules created both for job and pipelines.

The scheduler's /config/{{configID}} endpoint can be used to retrieve a single schedule.

curl --request GET '{{impulse-protocol}}://{{impulse-domain}}:{{impulse-port}}/private/scheduler/config/{{config-id}}'

This will show the single schedule for the passed in id.

Removing a Schedule

If you no longer want a schedule, you can remove it by using the /config/{{configID}} endpoint.

curl --request DELETE '{{impulse-protocol}}://{{impulse-domain}}:{{impulse-port}}/private/scheduler/config/{{config-id}}'

This will remove the schedule so that it will no longer run.

Last updated