Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document adding aiida daemon as system service #1438

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/requirements_for_rtd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ python-mimeparse==0.1.4
pytz==2014.10
pyyaml
qe-tools==1.1.0
reentry == 1.1.2
reentry == 1.2.0a9
scipy<1.0.0
seekpath==1.8.0
setuptools==36.6.0
Expand Down
47 changes: 47 additions & 0 deletions docs/source/working_with_aiida/scripting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,50 @@ executable that is run using AiiDA. A simple example could be::

import aiida
print "AiiDA version is: {}".format(aiida.get_version())

Daemon as system service
------------------------
If you would like the AiiDA daemon to run at startup of your linux system,
you can set up a
`systemd service <https://www.freedesktop.org/software/systemd/man/systemd.service.html>`_
for it.

Create a file ``aiida-daemon.service`` using the template below, replacing
``{{ venv_dir }}``, ``{{ home_dir }}`` and ``{{ user }}`` by appropriate
values::

[Unit]
Description=AiiDA daemon service
After=network.target

[Service]
Type=forking
ExecStart={{ venv_dir }}/bin/verdi daemon start
PIDFile={{ home_dir }}/.aiida/daemon/log/celery.pid
# 2s delay to prevent read error on PID file
ExecStartPost=/bin/sleep 2

ExecStop={{ venv_dir }}/bin/verdi daemon stop
ExecReload={{ venv_dir }}/bin/verdi daemon restart

User={{ user }}
Group={{ user }}
Restart=on-failure
RestartSec=60 # Restart daemon after 1 min if crashes
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=aiida-daemon

[Install]
WantedBy=multi-user.target

Enable the service like so::

sudo cp aiida-daemon.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl start aiida-daemon.service

After this, the AiiDA daemon should start together with your system.
To remove the service again::

sudo systemctl disable aiida-daemon.service
3 changes: 1 addition & 2 deletions setup_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
# For further information please visit http://www.aiida.net #
###########################################################################
# Requirements for core AiiDA functionalities
REENTRY_PINNED = 'reentry == 1.1.2'

install_requires = [
'pip==9.0.1',
'setuptools==36.6.0',
REENTRY_PINNED,
'reentry == 1.2.0a9',
'wheel==0.29.0',
'python-dateutil==2.6.0',
'python-mimeparse==0.1.4',
Expand Down