Skip to content

Scheduler

The scheduler kind runs a task on a recurring schedule defined by a Quartz cron expression.

Scheduler spec

The scheduler kind has the following specification parameters.

Parameter Type Description Default
task str Task to execute. required
template dict Configuration template for the run. {}
function str | None Function to execute. Provide this or workflow. None
workflow str | None Workflow to execute. Provide this or function. None
schedule str Quartz cron expression. required

Create

New

new_trigger

Create a new trigger entity in the backend.

Parameters:

Name Type Description Default
project str

Project name.

required
name str

Entity name.

required
kind str

Entity kind.

required
task str

Task reference.

required
function str

Function reference. Provide either function or workflow.

None
workflow str

Workflow reference. Provide either workflow or function. If both are provided, the workflow is used.

None
uuid str

Entity identifier.

None
description str

Human-readable entity description.

None
labels list[str]

Entity labels.

None
embedded bool

Whether to embed the entity specification in the project specification.

False
template dict

Trigger template. If omitted, a template is built from task and the selected executable reference.

None
**kwargs dict

Additional entity specification parameters.

{}

Returns:

Type Description
Trigger

Created trigger entity.

import digitalhub as dh

trigger = dh.new_trigger(
    project="my-project",
    name="daily-run",
    kind="scheduler",
    task="store://my-project/task/my-task:latest",
    function="store://my-project/function/my-function:latest",
    schedule="0 0 * * * ?",
)

Methods

The scheduler kind adds no instance methods. See Use a trigger for common methods.

Back to trigger kind selection