Introduction

Tilebox Workflows are not only capable of executing jobs once after they are submitted by a user, often also referred to as batch-processing. Instead, it’s also possible to execute jobs in near-real-time, by defining trigger conditions that result in jobs being executed based on external events. This requires no changes in the actual workflow code - the task implementations - at all, instead it’s just a different way of submitting jobs.

Tilebox Workflows currently supports the following trigger conditions:

Dataset Event Triggers, capable of triggering jobs because of new data points being ingested into a Tilebox dataset, are the next trigger type on the roadmap. Stay tuned for updates.

Recurrent Tasks

To create such a trigger, a special task needs to be defined, that acts as prototype for the tasks that are submitted as part of a job as response to a trigger. Such a task prototype is called a recurrent task.

Since a recurrent task acts as a prototype for an actual task that gets submitted, it has a task identifier, a version and input parameters just like any other regular task would. Recurrent tasks additionally also have a special trigger parameter. It differs for each instantiation of the recurrent task and contains information about the event that triggered the execution of the task.

Recurrent task client

The Tilebox workflows client provides a sub-client for interacting with recurrent tasks. This client can be instantiated by calling the recurrent_tasks method on the client instance.

Listing registered recurrent tasks

To list all registered recurrent tasks, you can use the all method on the recurrent task client.

Python
from tilebox.workflows import Client

client = Client()
recurrent_tasks = client.recurrent_tasks()

recurrent_tasks = recurrent_tasks.all()
print(recurrent_tasks)
Output
[
    RecurrentTaskPrototype(
        name='Run MyCronTask every hour at 15 minutes past the hour',
        prototype=TaskSubmission(
            cluster_slug='dev-cluster',
            identifier=TaskIdentifier(name='MyCronTask', version='v0.0'),
            input=b'{"message": "Hello"},
            dependencies=[],
            display='MyCronTask',
            max_retries=0), 
        storage_event_triggers=[],
        cron_triggers=[CronTrigger(schedule='15 * * * *')],
    )
]

Registering a recurrent tasks

To register a recurrent task, the recurrent task client provides create_recurring_... methods for each trigger type. Check out the documentation of the individual trigger types for more details.

Overview in the Tilebox Console

Other than using the Tilebox SDKs to list or register recurrent tasks, you can also manage them in the Tilebox Console. Head over to the Workflows tab to check it out.

There, you’ll find a list of all registered recurrent tasks.

Additionally, you’ll be able to register new recurrent tasks or edit/delete existing ones.