Modules reference / task / Module scheduler
Modules reference / task / Module scheduler

Module scheduler

Module scheduler

Task scheduler (a cartridge role).

Functions

init (opts)

Initialize the scheduler, start cron background fiber.

Parameters:

  • opts:
    • runner: (string) name of the runner module name, default is task.runner.local
    • storage: (string) name of the storage module, default is task.storage.local

get_tasks ()

List registered tasks.

get_task_log (opts)

List task execution log, ordered by creation time.

Parameters:

  • opts:
    • filter: (table) must contain either an id number, or an array of names
    • limit: (number) the maximum length of a single task log fetched from storage
    • created: (string) ISO 8601 timestamp, acts as offset for pagination

start (name, args)

Start a task.

Parameters:

  • name: (string) name of the task
  • args: (table) array of arguments to be passed to task function

stop (id)

Stop a running or pending task.

Parameters:

  • id: (string) name of the task

forget (id)

Remove task execution log record from storage.

Parameters:

  • id: (string) name of the task

start_periodical_task (name, args)

Start a periodical task.

Parameters:

  • name: (string) name of the task
  • args: (table) array of arguments to be passed to the task function

register (tasks)

Register available tasks. Starts launching periodical and continuous tasks, allows to start single_shot tasks.

Parameters:

  • tasks: (table) names of tasks