Skip to content

Cronjobs

PERSEUS supports custom cronjobs. Cronjobs can e.g. be used with services to schedule reoccurring function calls or with states to pull new projects from a proposal frontend.

All cronjobs are running as threads in a concurrent.futures.ThreadPoolExecuter executer pool.

The tool perseus.utils.add_cronjob() expects a Callable function and the time schedule.

The specified schedule time is in the standard UNIX cron format.

The example below is from service perseus.services.DataDeletionManager.

from perseus.utils import add_cronjob
from .BaseService import BaseService
class DataDeletionManager(BaseService):
@classmethod
def initialize(cls):
...
def run_data_deletion():
...
add_cronjob(run_data_deletion, "0 */1 * * *") # at minute 0 past every hour