Changeset View
Changeset View
Standalone View
Standalone View
dockerfiles/swh-scheduler-worker/entrypoint.sh
- This file was added.
Property | Old Value | New Value |
---|---|---|
File Mode | null | 100755 |
#!/bin/bash | |||||
set -e | |||||
if [[ -d /src ]] ; then | |||||
for srcrepo in /src/swh-* ; do | |||||
pushd $srcrepo | |||||
pip install -e . | |||||
popd | |||||
done | |||||
fi | |||||
echo "${PGHOST}:5432:${POSTGRES_DB}:${PGUSER}:${POSTGRES_PASSWORD}" > ~/.pgpass | |||||
cat > ~/.pg_service.conf <<EOF | |||||
[swh] | |||||
dbname=${POSTGRES_DB} | |||||
host=${PGHOST} | |||||
port=5432 | |||||
user=${PGUSER} | |||||
EOF | |||||
chmod 0400 ~/.pgpass | |||||
case "$1" in | |||||
"shell") | |||||
exec bash -i | |||||
;; | |||||
"listener") | |||||
echo Starting the swh-scheduler listener | |||||
exec python -m swh.scheduler.celery_backend.listener | |||||
;; | |||||
"runner") | |||||
echo Starting the swh-scheduler runner | |||||
exec sh -c 'while true; do | |||||
echo running pending tasks at `/bin/date`; | |||||
python -m swh.scheduler.celery_backend.runner; | |||||
sleep 10; | |||||
done' # beuark | |||||
vlorentz: Why `exec sh -c` instead of directly running the loop? | |||||
Done Inline Actions
I just used what's in the systemd service file. douardda: > Why exec sh -c instead of directly running the loop?
I just used what's in the systemd… | |||||
Not Done Inline Actions@douardda That's because systemd doesn't run commands in an actual shell. It's not needed here. vlorentz: @douardda That's because systemd doesn't run commands in an actual shell. It's not needed here. | |||||
Done Inline Actions
if we want to keep the exec command, we need it. And I'm inclined to think it's best to keep the exec statement instead of running the for loop from within the case block. douardda: > It's not needed here.
if we want to keep the exec command, we need it. And I'm inclined to… | |||||
Not Done Inline Actionslol isn't there a flag to the runner so that it does it itself? Checked and no! ardumont: lol
isn't there a flag to the runner so that it does it itself?
Checked and no! | |||||
;; | |||||
*) | |||||
echo "Provide a command (shell|listener|runner)" | |||||
exit 1 | |||||
;; | |||||
esac |
Why exec sh -c instead of directly running the loop?