runner: Update task status only after sending the tasks to rabbitmq
Prior to this, the runner called the `grab_ready{_priority}_tasks` method. Those method update the task's status to 'next_run_scheduled' at the listing time. So it actually writes immediately to postgresql. So, failing to write to rabbitmq would update the status anyway. So we change the runner's calls to use the `peek_ready{_priority}_tasks` methods instead. This now only gets the task list to schedule. And at the end of the runner, there is a call of `mass_schedule_task_runs` method. This method is now in charge to update the tasks' status to 'next_run_scheduled' within the same transaction. Refs. swh/infra/sysadm-environment#5512
Showing
- swh/scheduler/backend.py 15 additions, 2 deletionsswh/scheduler/backend.py
- swh/scheduler/celery_backend/runner.py 4 additions, 4 deletionsswh/scheduler/celery_backend/runner.py
- swh/scheduler/in_memory.py 9 additions, 1 deletionswh/scheduler/in_memory.py
- swh/scheduler/interface.py 5 additions, 1 deletionswh/scheduler/interface.py
Loading
Please register or sign in to comment