marvel-nccr / ansible-role-aiida

An ansible role that installs and configures AiiDA on Ubuntu.
Other
2 stars 5 forks source link

Improvements for aiida-daemon service #8

Closed giovannipizzi closed 5 years ago

giovannipizzi commented 5 years ago

A few notes for discussion:

  1. After=network.target postgresql.service should now become After=network.target postgresql.service rabbitmq-server.service (TESTED: otherwise the daemon starts before rabbitmq and if fails). NOTE: do the same also in the aiida-rest.service (to be on the safe side)
  2. the Sockets= directive is wrong, I think: according to the man, it should be a "unit" i.e. a file describing the socket like, e.g., system/sockets.target.wants/acpid.socket. We are instead pointing to a text file that contains the path of a folder in which there are three socket files circus.?.sock (and actually the path is wrong because it also contains a /log/ subfolder). So this will not work. Indeed at boot I get:
    Apr 11 23:41:41 qmobile kernel: [    3.000026] systemd[1]: /etc/systemd/system/aiida-daemon.service:8: Unit must be of type socket, ignoring: /home/max/.aiida/daemon/log/circus-default.sockets
  3. Maybe we should specify instead a PIDFile= pointing to circus-default.pid (note to remove the /log/ component of the path). I tried and it works. However (but I'm not sure of this) does this mean that the service will try to keep the daemon running, so if you do verdi daemon stop by hand, after 60 seconds it will restart it without the user knowing (I imagine this is the role of the Restart= section? Do we want this? (Even if I'm not sure this is happening, I cannot see this, I see some information in sudo systemctl status aiida-daemon but it does not restart). [EDIT: I think that verdi daemon stop makes the process end with a 0 exit code, and since the policy is on-failure, this will not restart it - so maybe this is the right thing to do; even if, if the user restarts the daemon from the command line, systemctl will not notice the new daemon...]

@ltalirz if you agree with the changes above I'll make them

ltalirz commented 5 years ago

Re 1.: agreed!

Re 2.: ok, whatever you think is the right solution

Re 3.: I agree having two ways of controlling the daemon can be an issue. One could view it as two different use cases (an aiida "server" vs a tutorial machine). What about adding a aiida_daemon_service variable that determines whether the service is added (potentially also a aiida_daemon_service_autostart that allows you to have the service but not have it started at boot)? For the quantum mobile we probably don't even need the service since we want people to learn how to use aiida on their own.