determine environment from alias definitions
secop devices are added automatically to the environment if the appear in the alias_config. secop devices no longer available are remove from the envrionment list. + fix rename nicos_sinq/frappy to nicos_sinq/frappy_sinq
This commit is contained in:
24
commands.py
24
commands.py
@ -37,7 +37,7 @@ if home not in sys.path:
|
||||
# for newer Frappy installations this should be home (= /home/<instrument>)
|
||||
# the following line fixes this in case nicos.conf is not yet updated
|
||||
sys.path.append(home)
|
||||
from nicos_sinq.frappy.devices import FrappyNode
|
||||
from nicos_sinq.frappy_sinq.devices import FrappyNode
|
||||
from servicemanager import FrappyManager
|
||||
|
||||
|
||||
@ -68,7 +68,8 @@ def all_info(all_cfg):
|
||||
def applyAliasConfig():
|
||||
"""Apply the desired aliases from session.alias_config.
|
||||
|
||||
in addition, return the targets inheriting from SecopDevice
|
||||
in addition, return the names of targets inheriting from SecopDevice
|
||||
as a list
|
||||
"""
|
||||
# reimplemented from Session.applyAliasConfig
|
||||
# apply also when target dev name does not change, as the target device might have
|
||||
@ -86,7 +87,7 @@ def applyAliasConfig():
|
||||
if target in session.devices:
|
||||
try:
|
||||
aliasdev.alias = target
|
||||
targets.append(target)
|
||||
targets.append(target.name)
|
||||
except Exception:
|
||||
session.log.exception("could not set '%s' alias", aliasdev)
|
||||
break
|
||||
@ -138,18 +139,15 @@ def frappy_start(service, cfg=None):
|
||||
cleanup_defunct()
|
||||
CreateAllDevices()
|
||||
targets = applyAliasConfig()
|
||||
target_names = set(t.name for t in targets)
|
||||
newlist = []
|
||||
for devname in session.experiment.envlist:
|
||||
devname, _, stat = devname.partition(':')
|
||||
for itemname in session.experiment.envlist:
|
||||
devname = itemname.split(':')[0]
|
||||
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 dev is not None and (not isinstance(dev, SecopDevice) or devname in targets):
|
||||
newlist.append(itemname)
|
||||
newlist.extend(t for t in targets if t not in newlist)
|
||||
if newlist != session.experiment.envlist:
|
||||
session.experiment.setEnvironment(newlist)
|
||||
if startnode and cfg == '':
|
||||
startnode.disable()
|
||||
return all_cfg
|
||||
|
@ -1,7 +1,7 @@
|
||||
description = 'frappy'
|
||||
group = 'optional'
|
||||
|
||||
modules = ['nicos_sinq.frappy.commands']
|
||||
modules = ['nicos_sinq.frappy_sinq.commands']
|
||||
|
||||
devices = {
|
||||
'temperature': device('nicos.devices.generic.DeviceAlias'),
|
||||
|
@ -4,7 +4,7 @@ group = 'optional'
|
||||
|
||||
devices = {
|
||||
'se_addons':
|
||||
device('nicos_sinq.frappy.devices.FrappyNode',
|
||||
device('nicos_sinq.frappy_sinq.devices.FrappyNode',
|
||||
description='SEC node', unit='',
|
||||
prefix='se_', auto_create=True, service='addons',
|
||||
),
|
||||
|
@ -4,7 +4,7 @@ group = 'optional'
|
||||
|
||||
devices = {
|
||||
'se_main':
|
||||
device('nicos_sinq.frappy.devices.FrappyNode',
|
||||
device('nicos_sinq.frappy_sinq.devices.FrappyNode',
|
||||
description='main SEC node', unit='',
|
||||
prefix='se_', auto_create=True, service='main',
|
||||
),
|
||||
|
@ -4,7 +4,7 @@ group = 'optional'
|
||||
|
||||
devices = {
|
||||
'se_stick':
|
||||
device('nicos_sinq.frappy.devices.FrappyNode',
|
||||
device('nicos_sinq.frappy_sinq.devices.FrappyNode',
|
||||
description='stick SEC node', unit='',
|
||||
prefix='se_', auto_create=True, service='stick',
|
||||
),
|
||||
|
Reference in New Issue
Block a user