alice-biometrics / petisco

🍪 petisco is a framework for helping Python developers to build clean Applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use Task instead cron definitions

acostapazo opened this issue · comments

Now, we can only set cron tasks

cron:
  dead-letter:
    seconds: 21600 # 6 hours
    handler: eventmanager.src.modules.events.requeue.application.requeue_event.subscribe_to_dead_letter

It should be awesome to set task of several types (some cron task, some one-shot tasks)

tasks:
  dead-letter:
      type: cron
      seconds: 21600 # 6 hours
      handler: petisco.src.subscribe_to_dead_letter
   migrate-database:
      type: environ_activation
      handler: petisco.src.migrate_database
tasks:
  recurring-task:
    run_in: 5 # seconds
    cron_interval: 10 # seconds
    handler: taskmanager.tasks.recurring_task
  scheduled-task:
    run_in: 10 # seconds
    handler: taskmanager.tasks.scheduled_task
  instant-task:
    handler: taskmanager.tasks.instant_task