diff --git a/commands.py b/commands.py index 8d80c68..82b8ea7 100644 --- a/commands.py +++ b/commands.py @@ -69,7 +69,7 @@ def all_info(all_cfg): info.append('%s=%r' % (srv, cfginfo)) else: info.append(repr(cfginfo)) - return 'currently configured: frappy(%s)' % ', '.join(info) + return 'frappy(%s)' % ', '.join(info) def frappy_start(**services): @@ -178,10 +178,10 @@ def frappy(*args, main=None, stick=None, addons=None): raise TypeError('got multiple values for addons') addons = ','.join(alist) allcfg = frappy_start(main=main, stick=stick, addons=addons) - session.log.info(all_info(allcfg)) + session.log.info('currently configured %s', all_info(allcfg)) else: allcfg = frappy_start(main=main, stick=stick, addons=addons) - session.log.info(all_info(allcfg)) + session.log.info('currently configured %s', all_info(allcfg)) guess1 = {} guess2 = {} for s in SERVICES: @@ -198,9 +198,9 @@ def frappy(*args, main=None, stick=None, addons=None): elif guess1 or guess2: session.log.info('please consider to call:') if guess1: - session.log.info(all_info(guess1)) + session.log.info('from frappy / cache: %s', all_info(guess1)) if guess2: - session.log.info(all_info(guess2)) + session.log.info('including info from sea: %s', all_info(guess2)) @usercommand @@ -211,7 +211,7 @@ def frappy_main(cfg=None): - without argument: list running frappy servers - cfg = "": stop frappy_main server """ - session.log.info(all_info(frappy_start(main=cfg))) + session.log.info('currently configured %s', all_info(frappy_start(main=cfg))) @usercommand @@ -222,7 +222,7 @@ def frappy_stick(cfg=None): - without argument: list running frappy servers - cfg = "": stop frappy_stick server """ - session.log.info(all_info(frappy_start(stick=cfg))) + session.log.info('currently configured %s', all_info(frappy_start(stick=cfg))) @usercommand @@ -233,7 +233,7 @@ def frappy_addons(cfg=None): - without argument: list running frappy servers - cfg = "": stop frappy_addons server """ - session.log.info(all_info(frappy_start(addons=cfg))) + session.log.info('currently configured %s', all_info(frappy_start(addons=cfg))) @usercommand diff --git a/devices.py b/devices.py index 66f22fa..1b76b08 100644 --- a/devices.py +++ b/devices.py @@ -229,7 +229,6 @@ class FrappyNode(SecNodeDevice, Moveable): type=str, default='', settable=True), } - _service_manager = FrappyManager() _cfgvalue = None def doStart(self, value): @@ -251,8 +250,12 @@ class FrappyNode(SecNodeDevice, Moveable): return self.secnode.descriptive_data['_frappy_config'] except (KeyError, AttributeError): pass - if self._cfgvalue is None and self._cache: - self._cfgvalue = self._cache.get(self, 'value') + if self._cfgvalue is None: + sea_cfg = FrappyManager().cfg_from_sea(config.instrument).get(self.service) + if sea_cfg: + return sea_cfg + if self._cache: + self._cfgvalue = self._cache.get(self, 'value') return self._cfgvalue def createDevices(self): @@ -269,9 +272,7 @@ class FrappyNode(SecNodeDevice, Moveable): @classmethod def config_dirs(cls, ins, service): # TODO: no more needed after allowing ~cfg in FrappyManager.do_start - sm = cls._service_manager - sm.get_info() - return sm.config_dirs(ins, service) + return FrappyManager().config_dirs(ins, service) @classmethod def available_cfg(cls, service): @@ -308,12 +309,13 @@ class FrappyNode(SecNodeDevice, Moveable): if cfg is None: cfg = self._cfgvalue ins = config.instrument - info = self._service_manager.get_ins_info(ins) + fm = FrappyManager() + info = fm.get_ins_info(ins) cfginfo = {} - self._service_manager.get_procs(cfginfo=cfginfo) + fm.get_procs(cfginfo=cfginfo) running_cfg = cfginfo.get((ins, self.service), '') if not forced: - sea_cfg = self._service_manager.cfg_from_sea(ins).get(self.service) + sea_cfg = fm.cfg_from_sea(ins).get(self.service) if sea_cfg == '?': self.log.warning('undefined sea device') cfg = '' # stop server @@ -327,7 +329,7 @@ class FrappyNode(SecNodeDevice, Moveable): self.disable() if running_cfg: self._disconnect() - self._service_manager.do_stop(ins, self.service) + fm.do_stop(ins, self.service) is_cfg = cfg and ':' not in cfg if is_cfg: available_cfg = self.available_cfg(self.service) @@ -347,7 +349,7 @@ class FrappyNode(SecNodeDevice, Moveable): self.uri = '' # disconnect if uri: if is_cfg: - self._service_manager.do_start(ins, self.service, cfg, logger=self.log) + fm.do_start(ins, self.service, cfg, logger=self.log) self.uri = uri # connect self._cfgvalue = cfg if self._cache: