Merge branch 'master' of gitlab.psi.ch:samenv/servicemanager

This commit is contained in:
2023-09-11 08:36:27 +02:00

View File

@ -237,7 +237,10 @@ class ServiceManager:
for p in procs.get(ins, {}).get(service, []):
print_wait = True
for action in ('terminate', 'kill'):
getattr(p, action)() # p.terminate or p.kill
try:
getattr(p, action)() # p.terminate or p.kill
except psutil.NoSuchProcess:
continue # already killed
for i in range(10): # total 0.1 * 10 * 9 / 2 = 4.5 sec
try:
p.wait(0.1 * i)
@ -261,6 +264,8 @@ class ServiceManager:
def do_stop(self, ins, service=None, *args):
self.get_info()
if ins is None:
raise ValueError('use stop all if you really want to stop all')
ins_list = self.wildcard(ins)
if ins_list is not None:
return ins_list