Skip to content
Snippets Groups Projects
Commit 40e2e324 authored by Antoine Lambert's avatar Antoine Lambert
Browse files

docker: Improve swh-scheduler-schedule-recurrent service startup

In order for the origin loading tasks resulting from a listing to be
successfully scheduled by that service, the loading task types must
have been registered in the scheduler database prior the execution of
the main command of that service.

So make the service depends on the swh-loader one and use a Python script
to check the celery worker used to execute loading tasks have been started.
parent 82c252c2
No related branches found
No related tags found
1 merge request!269docker: Improve swh-scheduler-schedule-recurrent service startup
......@@ -232,6 +232,7 @@ services:
command: schedule-recurrent
depends_on:
- swh-scheduler
- swh-loader
- amqp
volumes:
- "./conf/scheduler.yml:/scheduler.yml:ro"
......
......@@ -16,8 +16,19 @@ case "$1" in
wait_pgsql
wait-for-it swh-scheduler:5008 -s --timeout=0
wait-for-it amqp:5672 -s --timeout=0
echo "Starting the swh-scheduler $1"
exec wait-for-it amqp:5672 -s --timeout=0 -- swh --log-level ${LOGLEVEL} scheduler -C /scheduler.yml $@
echo "Waiting for loader task types to be registered in scheduler db"
until python3 -c "
from celery import Celery
app = Celery('swh', broker='amqp://guest:guest@amqp/')
assert any(worker_name.startswith('loader@')
for worker_name in app.control.inspect().active())" 2>/dev/null
do
sleep 1
done
echo "Starting swh scheduler $1"
exec swh --log-level ${LOGLEVEL} scheduler -C /scheduler.yml $@
;;
esac
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment