add sea config information to sea list

+ fixed servman import (must be __init__)
This commit is contained in:
2020-11-03 12:06:29 +01:00
parent fcd85f1ca4
commit eee6c22b87
4 changed files with 22 additions and 10 deletions

View File

@ -154,12 +154,12 @@ class ServiceManager:
self.get_info()
return self.info[ins]
#def get_cfg(self, service, cmd):
# """return info about running program, if relevant
#
# example for frappy: return cfg
# """
# return ''
def get_cfg(self, service):
"""return cfg info about running programs, if relevant
example for sea: return samenv name
"""
return ''
def get_procs(self, groups=None, cfginfo=None):
"""return processes
@ -364,11 +364,12 @@ 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(serv)
if sm == self:
show_ins = True
gs = '%s %s' % (group, serv)
port = str(port or '')
run_info.append(('', gs, port, cfginfo.get((ins_i, serv), '')))
run_info.append(('', gs, port, cfg))
if len(plist) > 1:
rows.append(['', ' WARNING: multiple processes %s'
% ', '.join(str(p.pid) for p, _ in plist)])

View File

@ -21,7 +21,7 @@
# *****************************************************************************
import re
from servman import ServiceManager
from __init__ import ServiceManager
class FrappyManager(ServiceManager):

View File

@ -26,7 +26,7 @@ import shutil
from glob import glob
from os.path import join, abspath, dirname, expanduser, exists, islink
from configparser import ConfigParser
from servman import ServiceManager
from __init__ import ServiceManager
ENV_KEYS = {

13
sea.py
View File

@ -24,7 +24,8 @@ import sys
import time
import termios
import subprocess
from servman import ServiceManager, ServiceDown
from __init__ import ServiceManager, ServiceDown
from sicsclient import sics_command
def run_command(cmd, wait=False):
@ -70,3 +71,13 @@ class SeaManager(ServiceManager):
run_command('SeaClient %s' % ins)
print('starting sea gui %s' % ins)
time.sleep(5)
def get_cfg(self, service):
"""return cfg info about running programs, if relevant
example for sea: return samenv name
"""
if service != 'sea': # ignore when service == 'graph'
try:
return sics_command(('localhost', self.info['sea']['port']), 'samenv name')