-
Notifications
You must be signed in to change notification settings - Fork 13
Stopping webserver mode
Sometime, something went wrong, and D-Genies services need to be stopped by hand.
In webserver mode, D-Genies uses the wsgi part for user interactions and runs a local scheduler in the background for managing job computation.
When launched in this mode, D-Genies will populate the crontab
of the user with 2 following tasks (use --no-cron
option if you do not want this behaviour).
$ crontab -l
0 1 * * * /usr/local/venv/dgenies/bin/python3 /usr/local/venv/dgenies/lib/python3.6/site-packages/dgenies/bin/clean_jobs.py > /home/dgenies/.dgenies/logs/clean.log 2>&1 # dgenies
* * * * * /usr/local/venv/dgenies/lib/python3.6/site-packages/dgenies/bin/start_local_scheduler.sh /usr/local/venv/dgenies/lib/python3.6/site-packages/dgenies /usr/local/venv/dgenies/bin/python3 /home/dgenies/.dgenies/.local_scheduler_pid /dev/null > /dev/null 2>&1 & # dgenies
The first line will clean the job following the delay set in configuration file. The second line will starts the scheduler and restart it when stopped for any reason, even a computer restart.
When everything is right, D-Genies can be stopped with this two actions:
- for the wsgi part, by stopping the wsgi server (e.g.
systemctl stop httpd
if you use apache2 + mod_wsgi on CentOS) - for the local scheduler part, run
dgenies clear -c
. It will stop the local scheduler and remove dgenies entries fromcrontab
. Version <1.3 didn't remove the local scheduler pid file correctly, it needs to be remove by hand.
When something went wrong, we need sometime to stop manually D-Genies.
The wsgi part still the same (e.g. systemctl stop httpd
), but the local scheduler part needs some actions.
We take a look at the crontab
before cleaning it. We need to check where .local_scheduler_pid
is located.
$ crontab -l
0 1 * * * /usr/local/venv/dgenies/bin/python3 /usr/local/venv/dgenies/lib/python3.6/site-packages/dgenies/bin/clean_jobs.py > /home/dgenies/.dgenies/logs/clean.log 2>&1 # dgenies
* * * * * /usr/local/venv/dgenies/lib/python3.6/site-packages/dgenies/bin/start_local_scheduler.sh /usr/local/venv/dgenies/lib/python3.6/site-packages/dgenies /usr/local/venv/dgenies/bin/python3 /home/dgenies/.dgenies/.local_scheduler_pid /dev/null > /dev/null 2>&1 & # dgenies
We can now clear the crontab
. It can be either done by using the dgenies clear -c
command, or editing it with crontab -e
command.
Now we check if the local scheduler is stopped. If the pid in .local_scheduler_pid
mismatch the local scheduler pid, the dgenies clear -c
command will not stop it.
$ cat /home/dgenies/.dgenies/.local_scheduler_pid # registred pid
6489
$ ps -aux | grep dgenies
dgenies 6510 3.5 0.8 539684 69476 ? Sl 13:56 0:00 /usr/local/venv/dgenies/bin/python3 bin/local_scheduler.py -d True -l /home/dgenies/.dgenies/conf/logs/local_scheduler.log
We need to kill the scheduler in this case, and remove its pid file.
# kill scheduler
$ kill -15 6510
# remove pid file
$ rm /home/dgenies/.dgenies/.local_scheduler_pid