swh.scheduler.celery_backend.runner module

swh.scheduler.celery_backend.runner.run_ready_tasks(backend, app)[source]

Run tasks that are ready

Parameters
  • backend (Scheduler) – backend to read tasks to schedule

  • app (App) – Celery application to send tasks to

Returns

A list of dictionaries:

{
  'task': the scheduler's task id,
  'backend_id': Celery's task id,
  'scheduler': arrow.utcnow()
}

The result can be used to block-wait for the tasks’ results:

backend_tasks = run_ready_tasks(self.scheduler, app)
for task in backend_tasks:
    AsyncResult(id=task['backend_id']).get()

swh.scheduler.celery_backend.runner.main()[source]