better args checking, sea list: cfg shown only on single items
This commit is contained in:
16
base.py
16
base.py
@ -119,8 +119,7 @@ class ServiceManager:
|
||||
def get_info(self):
|
||||
"""returns port numbers,commands and environment variables
|
||||
|
||||
the result is a dict[<service>] of dict(ins=.., port= ..., cmd= ...)
|
||||
if ins is omitted, return a list of above for all ins
|
||||
the result is a dict[<ins>] of dict[<service>] of port or None
|
||||
"""
|
||||
result = OrderedDict()
|
||||
parser = get_config()
|
||||
@ -319,7 +318,7 @@ class ServiceManager:
|
||||
continue
|
||||
|
||||
print_wait = True
|
||||
for i in range(10): # total 10 * 9 / 2 * 0.1 = 4.5 sec
|
||||
for i in range(15): # total 15 * 14 / 2 * 0.1 = 10.5 sec
|
||||
returnvalue = process.poll()
|
||||
if returnvalue is not None:
|
||||
logger.info('started process failed, try to find out why')
|
||||
@ -388,22 +387,25 @@ class ServiceManager:
|
||||
for serv, port in info_grp.items():
|
||||
plist = procs_dict.get(serv)
|
||||
if plist:
|
||||
cfg = cfginfo.get((ins_i, serv), '') or sm.get_cfg(ins_i, serv)
|
||||
if ins is None:
|
||||
cfg = ''
|
||||
else:
|
||||
cfg = cfginfo.get((ins_i, serv), '') or sm.get_cfg(ins_i, serv)
|
||||
if sm == self:
|
||||
show_ins = True
|
||||
gs = '%s %s' % (group, serv)
|
||||
port = str(port or '')
|
||||
run_info.append(('', gs, port, cfg))
|
||||
if len(plist) > 1:
|
||||
rows.append(['', ' WARNING: multiple processes %s'
|
||||
% ', '.join(str(p.pid) for p in plist)])
|
||||
run_info.append(['', ' WARNING: multiple processes %s'
|
||||
% ', '.join(str(p.pid) for p in plist)])
|
||||
extra = sm.extra_info(ins_i)
|
||||
if extra and show_ins:
|
||||
run_info.append(['', extra])
|
||||
if show_ins:
|
||||
rows.extend(run_info)
|
||||
print('')
|
||||
printTable(('inst', 'service', 'port', 'cfg'), rows, print)
|
||||
printTable(('inst', 'service', 'port', '' if ins is None else 'cfg'), rows, print)
|
||||
|
||||
@staticmethod
|
||||
def extra_info(ins):
|
||||
|
Reference in New Issue
Block a user