Merge branch 'master' of gitlab.psi.ch:samenv/servicemanager
This commit is contained in:
5
base.py
5
base.py
@ -237,7 +237,10 @@ class ServiceManager:
|
|||||||
for p in procs.get(ins, {}).get(service, []):
|
for p in procs.get(ins, {}).get(service, []):
|
||||||
print_wait = True
|
print_wait = True
|
||||||
for action in ('terminate', 'kill'):
|
for action in ('terminate', 'kill'):
|
||||||
|
try:
|
||||||
getattr(p, action)() # p.terminate or p.kill
|
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
|
for i in range(10): # total 0.1 * 10 * 9 / 2 = 4.5 sec
|
||||||
try:
|
try:
|
||||||
p.wait(0.1 * i)
|
p.wait(0.1 * i)
|
||||||
@ -261,6 +264,8 @@ class ServiceManager:
|
|||||||
|
|
||||||
def do_stop(self, ins, service=None, *args):
|
def do_stop(self, ins, service=None, *args):
|
||||||
self.get_info()
|
self.get_info()
|
||||||
|
if ins is None:
|
||||||
|
raise ValueError('use stop all if you really want to stop all')
|
||||||
ins_list = self.wildcard(ins)
|
ins_list = self.wildcard(ins)
|
||||||
if ins_list is not None:
|
if ins_list is not None:
|
||||||
return ins_list
|
return ins_list
|
||||||
|
Reference in New Issue
Block a user