Merge branch 'master' of gitlab.psi.ch-samenv:samenv/frappy_sinq
This commit is contained in:
36
commands.py
36
commands.py
@ -125,6 +125,34 @@ def set_se_list():
|
||||
frappy_config.set_envlist()
|
||||
|
||||
|
||||
@usercommand
|
||||
@helparglist('main [, stick [, addons]]')
|
||||
def frappy(main=None, stick=None, addons=None):
|
||||
"""(re)start frappy server(s) with given configs and load setup if needed
|
||||
|
||||
- without argument: list running frappy servers
|
||||
- frappy('<cfg>'): if available, the standard stick is added too
|
||||
- frappy(''): the stick is removed too
|
||||
- addons are not changed when not given!
|
||||
"""
|
||||
all_cfg = {}
|
||||
if main is not None:
|
||||
all_cfg = frappy_start('main', main)
|
||||
if stick is None:
|
||||
if main:
|
||||
stickcfg = main + 'stick'
|
||||
if stickcfg in FrappyNode.available_cfg('stick'):
|
||||
# if a default stick is available, start this also
|
||||
stick = stickcfg
|
||||
else:
|
||||
stick = ''
|
||||
if stick is not None:
|
||||
all_cfg = frappy_stick('stick', stick)
|
||||
if addons is not None:
|
||||
all_cfg = frappy_stick('addons', addons)
|
||||
session.log.info(all_info(all_cfg))
|
||||
|
||||
|
||||
@usercommand
|
||||
@helparglist('cfg')
|
||||
def frappy_main(cfg=None):
|
||||
@ -133,13 +161,7 @@ def frappy_main(cfg=None):
|
||||
- without argument: list running frappy servers
|
||||
- cfg = "": stop frappy_main server
|
||||
"""
|
||||
all_cfg = frappy_start('main', cfg)
|
||||
if cfg:
|
||||
stickcfg = cfg + 'stick'
|
||||
if stickcfg in FrappyNode.available_cfg('stick'):
|
||||
# if a default stick is available, start this also
|
||||
all_cfg = frappy_start('stick', stickcfg)
|
||||
session.log.info(all_info(all_cfg))
|
||||
session.log.info(all_info(frappy_start('main', cfg)))
|
||||
|
||||
|
||||
@usercommand
|
||||
|
14
devices.py
14
devices.py
@ -219,6 +219,9 @@ class FrappyNode(SecNodeDevice, Moveable):
|
||||
}
|
||||
parameters = {
|
||||
'service': Param('frappy service name (main, stick or addons)', type=str, default=''),
|
||||
'param_category': Param("category of parameters\n\n"
|
||||
"set to 'general' if all parameters should appear in the datafile header",
|
||||
type=str, default='', settable=True),
|
||||
}
|
||||
|
||||
_service_manager = FrappyManager()
|
||||
@ -237,6 +240,17 @@ class FrappyNode(SecNodeDevice, Moveable):
|
||||
self._cfgvalue = self._cache.get(self, 'value')
|
||||
return self._cfgvalue
|
||||
|
||||
def createDevices(self):
|
||||
super().createDevices()
|
||||
if self.param_category:
|
||||
for devname, (_, devcfg) in self.setup_info.items():
|
||||
params_cfg = devcfg['params_cfg']
|
||||
dev = session.devices[devname]
|
||||
for pname, pargs in params_cfg.items():
|
||||
pinfo = dev.parameters[pname]
|
||||
if not pinfo.category:
|
||||
pinfo.category = self.param_category
|
||||
|
||||
@classmethod
|
||||
def config_dirs(cls, ins, service):
|
||||
sm = cls._service_manager
|
||||
|
Reference in New Issue
Block a user