diff --git a/__init__.py b/__init__.py index 523c0a5..9a4edb7 100644 --- a/__init__.py +++ b/__init__.py @@ -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)]) diff --git a/frappy.py b/frappy.py index e690724..a45d1d2 100644 --- a/frappy.py +++ b/frappy.py @@ -21,7 +21,7 @@ # ***************************************************************************** import re -from servman import ServiceManager +from __init__ import ServiceManager class FrappyManager(ServiceManager): diff --git a/nicos.py b/nicos.py index eea4345..70290a6 100644 --- a/nicos.py +++ b/nicos.py @@ -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 = { diff --git a/sea.py b/sea.py index c2674fa..22d16d7 100644 --- a/sea.py +++ b/sea.py @@ -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')