rename to frappy_sinq
This commit is contained in:
@ -1,3 +1,3 @@
|
||||
# frappy_nicos
|
||||
# frappy_sinq
|
||||
|
||||
subdirectory of nicos_sinq in nicos tree, split out to be independent of nicos git
|
24
commands.py
24
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
|
||||
|
Reference in New Issue
Block a user