Pipeline Jobs

What is a Pipeline Job?

Sometimes it is necessary that you trigger your persisted pipeline after a certain time interval. For this you can use the concept of pipeline jobs in PIPEFORCE.

Only persisted pipelines can be triggered by a job.

Creating a Pipeline Job

To register a pipeline job, you can use the job command.

Let's assume you have a pipeline like the one below which sends an email with current date and time:

pipeline: - mail.send: to: "user@company.tld" subject: "Reminder" message: "Hello, it's ${@date.nowIso8601()}"

In case you would like to send this email every 5 minutes, you simply need to add the job command at the very beginning:

pipeline: - job: schedule: "EVERY_5_MIN" - mail.send: to: "user@company.tld" subject: "Reminder" message: "Hello, it's #{@date.nowIso8601()}"

As soon as you save this pipeline in the property store, a new job will be scheduled which runs every 5 minutes and executes any command below.

  • The job command must be the very first command in the pipeline.

  • It's not allowed to have more than one such command per pipeline.

When you delete a pipeline with a job command in it, the according job will be deleted. The same is true in case you remove the job command from the pipeline. In case you rename the pipeline or change parameters of the command, the pipeline job will be replaced by a new one. So make sure to change such a pipeline only in development mode, never in production.

Schedules

Fixed schedules

There are different fixed schedules available:

  • EVERY_2_MIN - Deprecated: Since version 9.0 this will always fallback to EVERY_5_MIN.

  • EVERY_5_MIN - Runs every 5 minutes (Enterprise hosting only).

  • EVERY_15_MIN - Runs every 15 minutes.

  • EVERY_30_MIN - Runs every 30 minutes.

  • EVERY_45_MIN - Runs every 45 minutes.

  • HOURLY - Runs at every full hour initially starting at a random minute.

  • DAILY - Runs every day at the very morning on a random time between 2AM and 4AM.

  • WEEKLY - Runs weekly at a random day and on a random time between 2AM and 4AM.

  • MONTHLY - Runs monthly at a random day and on a random time between 2AM and 4AM.

Example:

pipeline: - job: schedule: "HOURLY" # The commands, the job must execute go here...

In case you need to increase those limits, please talk to the PIPEFORCE support.

Dynamic schedules

Dynamic triggers, also known as cron expressions, are not enabled by default.

Since they can slow down the system drastically and therefore need to be managed carefully, you have to enable this kind of triggers separately by asking the PIPEFORCE support.

List all Pipeline Jobs

In order to monitor the registered pipeline jobs, you can use the command job.list. This will return a JSON with information about all currently registered pipeline jobs. Such a result can look like this:

In case you would like to get information about a single job, you can use the job.status command instead.