lab-cosmo / i-pi-dev_archive

Development version of i-PI
21 stars 12 forks source link

Exiting i-PI if one client died #206

Closed cgorgulla closed 5 years ago

cgorgulla commented 6 years ago

If a client connected to i-PI dies during runtime, the default behavior of i-PI is that it removes the client from the client list and uses the remaining clients. To achieve the alternative behavior that i-PI quits if one client dies, how would you recommend to implement it?

If in the file sockets.py I try to import the softexit object of the ipi.utils.softexit module and then trigger a softexit, i-PI quits indeed but rather disgracefully:

Exception in thread poll_cp2k:
Traceback (most recent call last):
  File ".../anaconda2/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File ".../anaconda2/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File ".../ipi/engine/forcefields.py", line 161, in _poll_loop
    self.poll()
  File ".../ipi/engine/forcefields.py", line 255, in poll
    self.socket.poll()
  File ".../ipi/interfaces/sockets.py", line 676, in poll
    self.pool_update()
  File ".../ipi/interfaces/sockets.py", line 496, in pool_update
    softexit.trigger("Error: One client has died unexpectedly. Exiting i-PI...") 
  File ".../ipi/utils/softexit.py", line 89, in trigger
    f()
  File ".../ipi/engine/forcefields.py", line 214, in softexit
    self.stop()
  File ".../ipi/engine/forcefields.py", line 269, in stop
    self._thread.join()
  File ".../anaconda2/lib/python2.7/threading.py", line 931, in join
    raise RuntimeError("cannot join current thread")
RuntimeError: cannot join current thread
venkatkapil24 commented 5 years ago

Hello @cgorgulla if you are still interested we ask you to post this on the google group https://groups.google.com/forum/#!forum/ipi-users since this is not really an issue.