2021-06-28 12:18:48 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2023-11-15 19:13:48 -05:00
|
|
|
# pvcworkerd.py - API Celery worker daemon startup stub
|
2021-06-28 12:18:48 -04:00
|
|
|
# Part of the Parallel Virtual Cluster (PVC) system
|
|
|
|
#
|
2022-10-06 11:55:27 -04:00
|
|
|
# Copyright (C) 2018-2022 Joshua M. Boniface <joshua@boniface.me>
|
2021-06-28 12:18:48 -04:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, version 3.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
CELERY_BIN="$( which celery )"
|
|
|
|
|
|
|
|
# This absolute hackery is needed because Celery got the bright idea to change how their
|
|
|
|
# app arguments work in a non-backwards-compatible way with Celery 5.
|
|
|
|
case "$( cat /etc/debian_version )" in
|
|
|
|
10.*)
|
2023-11-16 12:35:54 -05:00
|
|
|
CELERY_ARGS="worker --app pvcapid.flaskapi.celery --events --concurrency 3 --hostname pvcworkerd@$(hostname -s) --queues $(hostname -s) --loglevel INFO"
|
2021-06-28 12:18:48 -04:00
|
|
|
;;
|
|
|
|
*)
|
2023-11-16 12:35:54 -05:00
|
|
|
CELERY_ARGS="--app pvcapid.flaskapi.celery worker --events --concurrency 3 --hostname pvcworkerd@$(hostname -s) --queues $(hostname -s) --loglevel INFO"
|
2021-06-28 12:18:48 -04:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
${CELERY_BIN} ${CELERY_ARGS}
|
|
|
|
exit $?
|