Use cron automations when a workflow should run on a schedule, such as hourly catalog checks, daily quality-control jobs, or recurring data processing.
Tilebox automations submit workflow jobs when their trigger condition matches. A runner on the target cluster still needs to execute the submitted tasks.
Define the automation task
Section titled “Define the automation task”Create a task that can run from a scheduled trigger.
from tilebox.workflows import ExecutionContextfrom tilebox.workflows.automations import CronTask
class DailyCatalogCheck(CronTask): def execute(self, context: ExecutionContext) -> None: context.logger.info("Running daily catalog check", trigger=str(self.trigger))Register the cron automation
Section titled “Register the cron automation”Use the automation client to register a schedule and target cluster.
from tilebox.workflows import Client
client = Client()automations = client.automations()
automations.create_cron_automation( "daily-catalog-check", DailyCatalogCheck(), cron_schedules=["0 6 * * *"],)Keep a runner available
Section titled “Keep a runner available”The automation submits jobs. It does not execute them by itself. Start a runner that can execute the task identifier.
runner = client.runner(tasks=[DailyCatalogCheck])runner.run_forever()