From eee6c22b877a19d8f245f10759b8053e5df92a88 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Tue, 3 Nov 2020 12:06:29 +0100 Subject: [PATCH] add sea config information to sea list + fixed servman import (must be __init__) --- __init__.py | 15 ++++++++------- frappy.py | 2 +- nicos.py | 2 +- sea.py | 13 ++++++++++++- 4 files changed, 22 insertions(+), 10 deletions(-) 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')