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
|
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.utils import printTable
|
||||||
from nicos.commands import helparglist, usercommand
|
from nicos.commands import helparglist, usercommand
|
||||||
from nicos.commands.basic import AddSetup, CreateAllDevices, CreateDevice
|
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('~')
|
home = expanduser('~')
|
||||||
if home not in sys.path:
|
if home not in sys.path:
|
||||||
@ -66,10 +66,14 @@ def all_info(all_cfg):
|
|||||||
|
|
||||||
|
|
||||||
def applyAliasConfig():
|
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
|
# reimplemented from Session.applyAliasConfig
|
||||||
# apply also when target dev name does not change, as the target device might have
|
# apply also when target dev name does not change, as the target device might have
|
||||||
# be exchanged in the mean time
|
# be exchanged in the mean time
|
||||||
|
targets = []
|
||||||
for aliasname, targets in session.alias_config.items():
|
for aliasname, targets in session.alias_config.items():
|
||||||
if aliasname not in session.devices:
|
if aliasname not in session.devices:
|
||||||
# complain about this; setups should make sure that the device
|
# complain about this; setups should make sure that the device
|
||||||
@ -82,12 +86,14 @@ def applyAliasConfig():
|
|||||||
if target in session.devices:
|
if target in session.devices:
|
||||||
try:
|
try:
|
||||||
aliasdev.alias = target
|
aliasdev.alias = target
|
||||||
|
targets.append(target)
|
||||||
except Exception:
|
except Exception:
|
||||||
session.log.exception("could not set '%s' alias", aliasdev)
|
session.log.exception("could not set '%s' alias", aliasdev)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
session.log.warning('none of the desired targets for alias %r '
|
session.log.warning('none of the desired targets for alias %r '
|
||||||
'actually exist', aliasname)
|
'actually exist', aliasname)
|
||||||
|
return targets
|
||||||
|
|
||||||
|
|
||||||
def frappy_start(service, cfg=None):
|
def frappy_start(service, cfg=None):
|
||||||
@ -131,7 +137,19 @@ def frappy_start(service, cfg=None):
|
|||||||
if cfg is not None:
|
if cfg is not None:
|
||||||
cleanup_defunct()
|
cleanup_defunct()
|
||||||
CreateAllDevices()
|
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 == '':
|
if startnode and cfg == '':
|
||||||
startnode.disable()
|
startnode.disable()
|
||||||
return all_cfg
|
return all_cfg
|
||||||
|
Reference in New Issue
Block a user