rework sea cfg
use seaststus.tcl instead of a live connection for getting the current SEA cfg. cfg is now shown also when all instruments are listed
This commit is contained in:
parent
b387177668
commit
91cf31dde5
5
base.py
5
base.py
@ -416,9 +416,6 @@ class ServiceManager:
|
||||
for serv, port in info_grp.items():
|
||||
plist = procs_dict.get(serv)
|
||||
if plist:
|
||||
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
|
||||
@ -434,7 +431,7 @@ class ServiceManager:
|
||||
if show_ins:
|
||||
rows.extend(run_info)
|
||||
print('')
|
||||
printTable(('inst', 'service', 'port', '' if ins is None else 'cfg'), rows, print)
|
||||
printTable(('inst', 'service', 'port', 'cfg'), rows, print)
|
||||
|
||||
@staticmethod
|
||||
def extra_info(ins):
|
||||
|
27
seaman.py
27
seaman.py
@ -25,9 +25,12 @@ import time
|
||||
import termios
|
||||
import subprocess
|
||||
import os
|
||||
import re
|
||||
from os.path import join, exists
|
||||
from servicemanager.base import ServiceManager, ServiceDown, UsageError
|
||||
from servicemanager.sicsclient import sics_client
|
||||
|
||||
CFGLINE = re.compile(r'(device makeitem (name|stick_name) "(.*)" ""|'
|
||||
r'addon_list makeitem (.*) ("permanent"|"volatile"))')
|
||||
|
||||
|
||||
def run_command(cmd, wait=False):
|
||||
@ -116,7 +119,27 @@ class SeaManager(ServiceManager):
|
||||
if service != 'sea': # ignore when service == 'graph'
|
||||
return ''
|
||||
try:
|
||||
return sics_client(('localhost', self.info[ins]['sea']), 'samenv name')
|
||||
searoot = self.env[ins].get('SEA_ROOT', '')
|
||||
seastatus = join(searoot, ins, 'status', 'seastatus.tcl')
|
||||
if not exists(seastatus):
|
||||
seastatus = join(searoot, 'status', 'seastatus.tcl')
|
||||
if not exists(seastatus):
|
||||
return '?'
|
||||
result = ['', '']
|
||||
with open(seastatus, 'r', encoding='utf-8') as f:
|
||||
for line in f:
|
||||
match = CFGLINE.match(line)
|
||||
if match:
|
||||
_, key, dev, addon, _ = match.groups()
|
||||
if addon:
|
||||
result.append(addon)
|
||||
elif key == 'name':
|
||||
result[0] = dev
|
||||
else:
|
||||
result[1] = dev
|
||||
if not result[-1]:
|
||||
result.pop()
|
||||
return '/'.join(result)
|
||||
except Exception as e:
|
||||
return repr(e)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user