From 2450f1b477a451d9fc12e07ec074c6800338bc9b Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Wed, 13 Apr 2022 08:43:53 +0200 Subject: [PATCH] rename to frappy_sinq --- README.md | 4 ++-- commands.py | 24 +++++++++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8c43cd7..2c78269 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# frappy_nicos +# frappy_sinq -subdirectory of nicos_sinq in nicos tree, split out to be independent of nicos git \ No newline at end of file +subdirectory of nicos_sinq in nicos tree, split out to be independent of nicos git diff --git a/commands.py b/commands.py index 1785bd0..a1cfd7f 100644 --- a/commands.py +++ b/commands.py @@ -29,7 +29,7 @@ from nicos import session, config from nicos.utils import printTable from nicos.commands import helparglist, usercommand from nicos.commands.basic import AddSetup, CreateAllDevices, CreateDevice -from nicos.devices.secop import get_attaching_devices +from nicos.devices.secop import get_attaching_devices, SecopDevice home = expanduser('~') if home not in sys.path: @@ -66,10 +66,14 @@ def all_info(all_cfg): def applyAliasConfig(): - """Apply the desired aliases from session.alias_config.""" + """Apply the desired aliases from session.alias_config. + + in addition, return the targets inheriting from SecopDevice + """ # reimplemented from Session.applyAliasConfig # apply also when target dev name does not change, as the target device might have # be exchanged in the mean time + targets = [] for aliasname, targets in session.alias_config.items(): if aliasname not in session.devices: # complain about this; setups should make sure that the device @@ -82,12 +86,14 @@ def applyAliasConfig(): if target in session.devices: try: aliasdev.alias = target + targets.append(target) except Exception: session.log.exception("could not set '%s' alias", aliasdev) break else: session.log.warning('none of the desired targets for alias %r ' 'actually exist', aliasname) + return targets def frappy_start(service, cfg=None): @@ -131,7 +137,19 @@ def frappy_start(service, cfg=None): if cfg is not None: cleanup_defunct() CreateAllDevices() - applyAliasConfig() + targets = applyAliasConfig() + target_names = set(t.name for t in targets) + newlist = [] + for devname in session.experiment.envlist: + devname, _, stat = devname.partition(':') + dev = session.devices.get(devname) + if dev is not None: + if isinstance(dev, SecopDevice): + if devname in target_names: + .... + else: + newlist.append(dev.name) + if startnode and cfg == '': startnode.disable() return all_cfg