From 2974934832db22122cb743c7caab0548f7ebe289 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Wed, 8 Jun 2022 17:09:54 +0200 Subject: [PATCH 1/2] add frappy command - frappy(
, ) changes main and stick (+addons) in one go - frappy_main(..) not longer deals with standard stick --- commands.py | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/commands.py b/commands.py index 372478b..e7b8f9b 100644 --- a/commands.py +++ b/commands.py @@ -125,6 +125,33 @@ 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(''): if available, the standard stick is added too + - frappy(''): the stick is removed too + - addons are not changed when not given! + """ + 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 +160,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 From 9af6266c4cf2782ee2ba4ca2271143b34878464d Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Tue, 14 Jun 2022 15:26:58 +0200 Subject: [PATCH 2/2] allow to configure category of parameters by default, in datafile headers only value, status etc. is stored. put the sec node devices 'param_category' to 'general' will put all parameters into the header --- commands.py | 1 + devices.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/commands.py b/commands.py index e7b8f9b..033ec58 100644 --- a/commands.py +++ b/commands.py @@ -135,6 +135,7 @@ def frappy(main=None, stick=None, addons=None): - 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: diff --git a/devices.py b/devices.py index b75505b..c6d5caa 100644 --- a/devices.py +++ b/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