This feature is only available in the Python SDK.
Creating Cron tasks
Cron tasks run repeatedly on a specified cron schedule. To create a Cron task, usetilebox.workflows.automations.CronTask
as your tasks base class instead of the regular tilebox.workflows.Task
.
Python
Registering a Cron trigger
After implementing a Cron task, register it to be triggered according to a Cron schedule. When the Cron expression matches, a new job is submitted consisting of a single task instance derived from the Cron task prototype.Python
The syntax for specifying the cron triggers is a CRON expression.
A helpful tool to test your cron expressions is crontab.guru.
Starting a Cron Task Runner
With the Cron automation registered, a job is submitted whenever the Cron expression matches. But unless a task runner is available to execute the Cron task the submitted jobs remain in a task queue. Once an eligible task runner becomes available, all jobs in the queue are executed.Python
Output
Inspecting in the Console
The Tilebox Console provides a straightforward way to inspect all registered Cron automations.
Deleting Cron automations
To delete a registered Cron automation, useautomations.delete
. After deletion, no new jobs will be submitted by that Cron trigger. Past jobs already triggered will still remain queued.
Python
Submitting Cron jobs manually
You can submit Cron tasks as regular tasks for testing purposes or as part of a larger workflow. To do so, instantiate the task with a specific trigger time using theonce
method.
Submitting a job with a Cron task using
once
immediately schedules the task, and a runner may pick it up and execute it. The trigger time set in the once
method does not influence the execution time; it only sets the self.trigger.time
attribute for the Cron task.Python