Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1e9cbd1499 | |||
| c48203e45e | |||
| 436f42c6f5 | |||
| ffb02e54f7 | |||
| 9536ee3551 | |||
| 0c5727e093 | |||
| 26561833a2 | |||
| c18fec4081 | |||
| d4adaff40d | |||
| 3d907bd11c | |||
| 806490322e | |||
| c217b1c264 | |||
| a4df743570 | |||
| 9f7413a1a5 | |||
| 43853ae49c | |||
| b96a7dec1c | |||
| 6a89ec8383 | |||
| 53057297d7 | |||
| 4cbc5a9ec9 | |||
| 034a2e4440 | |||
| 6b28b17823 | |||
| 8d722ad09f | |||
| 1fd0647d74 | |||
| c237718a2d | |||
| 868abb4ea2 | |||
| 4bde91d16b | |||
| f8440d38a4 | |||
|
|
e121c3ca8e | ||
| 974e729920 | |||
| 29343faf8a | |||
| 1a82818da4 | |||
| 6e4c53c881 | |||
| 0776b7575f | |||
| e841b7bf0e | |||
| 3bddd87609 | |||
| e213186295 | |||
| ead54b14a5 | |||
| b10102e052 | |||
| 09237e4118 | |||
| 5678530e6e | |||
| 807b9eb4e7 | |||
| 0290c06b66 | |||
| 083bd05b16 | |||
| 91dbc9f086 | |||
| ba0f4e62b6 |
69
commands.py
69
commands.py
@@ -22,7 +22,8 @@
|
||||
from nicos import session, config
|
||||
from nicos.utils import printTable
|
||||
from nicos.commands import helparglist, usercommand
|
||||
from servicemanager import FrappyManager
|
||||
from .devices import get_frappy_config, all_info
|
||||
from servicemanager import FrappyManager, SeaManager
|
||||
|
||||
|
||||
SERVICES = FrappyManager.services
|
||||
@@ -30,57 +31,24 @@ SERVICES = FrappyManager.services
|
||||
|
||||
@usercommand
|
||||
def set_se_list():
|
||||
frappy_config = session.devices['frappy_config']
|
||||
frappy_config.set_envlist()
|
||||
fc = get_frappy_config()
|
||||
if fc:
|
||||
fc.set_envalias()
|
||||
|
||||
|
||||
@usercommand
|
||||
@helparglist('main [, stick [, addons]]')
|
||||
def frappy(*args, main=None, stick=None, addons=None, force=False):
|
||||
"""(re)start frappy server(s) with given configs and load setup if needed
|
||||
def frappy_main(*args):
|
||||
raise NameError('frappy_main(<cfg>) is no longer avaiable, use frappy(<cfg>) instead')
|
||||
|
||||
- without argument: list running frappy servers, restart failed frappy servers
|
||||
- frappy('<cfg>'): if available, the standard stick is added too
|
||||
- frappy(''): the stick is removed too
|
||||
- addons are not changed when not given
|
||||
- frappy(main='<cfg>') # main cfg is changed, but stick is kept
|
||||
- frappy('restart') # restart all frappy servers
|
||||
- frappy(stick='restart') # restart stick frappy server
|
||||
"""
|
||||
confirmed = FrappyManager().cfg_from_sea(config.instrument).get('confirmed')
|
||||
if args:
|
||||
if main is not None:
|
||||
raise TypeError('got multiple values for main')
|
||||
main = args[0]
|
||||
if len(args) == 1: # special case: main given as single argument
|
||||
if main == 'restart':
|
||||
stick = 'restart'
|
||||
addons = 'restart'
|
||||
elif stick is None: # auto stick
|
||||
if main == '':
|
||||
stick = '' # remove stick with main
|
||||
else:
|
||||
allsticks = FrappyManager().all_cfg(config.instrument, 'stick')
|
||||
stickcfg = main + 'stick'
|
||||
if stickcfg in allsticks:
|
||||
# if a default stick is available, start this also
|
||||
stick = stickcfg
|
||||
else:
|
||||
stick = '' # remove stick when main has changed
|
||||
else:
|
||||
if stick is not None:
|
||||
raise TypeError('got multiple values for stick')
|
||||
stick, *alist = args[1:]
|
||||
if alist:
|
||||
if addons is not None:
|
||||
raise TypeError('got multiple values for addons')
|
||||
addons = ','.join(alist)
|
||||
if confirmed and confirmed != main and main not in (None, 'restart') and not force:
|
||||
session.log.warning('%r is plugged to the cryostat control rack', confirmed)
|
||||
session.log.warning('if you are sure, use frappy(..., force=True)', confirmed)
|
||||
raise TypeError('refuse to override plugged device')
|
||||
frappy_config = session.devices['frappy_config']
|
||||
frappy_config.show_config(*frappy_config.check_or_start(main, stick, addons))
|
||||
|
||||
@usercommand
|
||||
def frappy_stick(*args):
|
||||
raise NameError('frappy_stick(<cfg>) is no longer avaiable, use frappy(stick=<cfg>) instead')
|
||||
|
||||
|
||||
@usercommand
|
||||
def frappy_addons(*args):
|
||||
raise NameError('frappy_addons(<cfg>) is no longer avaiable, use frappy(addons=<cfg>) instead')
|
||||
|
||||
|
||||
@usercommand
|
||||
@@ -104,8 +72,3 @@ def frappy_list(service=None):
|
||||
|
||||
FrappyManager().do_listcfg(config.instrument, service or 'main', prt)
|
||||
session.log.info('\n%s', '\n'.join(content))
|
||||
|
||||
|
||||
@usercommand
|
||||
def frappy_changed():
|
||||
session.devices['frappy_config'].changed()
|
||||
|
||||
847
devices.py
847
devices.py
File diff suppressed because it is too large
Load Diff
1598
secop/devices.py
Normal file
1598
secop/devices.py
Normal file
File diff suppressed because it is too large
Load Diff
@@ -4,10 +4,8 @@ group = 'optional'
|
||||
modules = ['nicos_sinq.frappy_sinq.commands']
|
||||
|
||||
devices = dict(
|
||||
frappy_config = device(
|
||||
frappy = device(
|
||||
'nicos_sinq.frappy_sinq.devices.FrappyConfig',
|
||||
# frappy_config does not need to be visible
|
||||
visibility = [],
|
||||
# the possible SECoP connections
|
||||
nodes = ['se_main', 'se_stick', 'se_addons'],
|
||||
#
|
||||
@@ -19,18 +17,19 @@ devices = dict(
|
||||
# the devices with the names given by key are added to determine the
|
||||
# device, using the given importance number, with similar values as
|
||||
# given by the SECoP standard (10: instrument, 20: cryostat, 30: insert)
|
||||
# the given numbers assume it is on the cryo, +10 / +20 is added for stick/addons
|
||||
temperature = { # the SECoP meaning
|
||||
'alias': ['Ts', 'temperature'], # the name(s) to be given to the alias
|
||||
'targets': # possible devices in addition with importance
|
||||
{'se_ts': 20, 'se_tt': 19, 'se_tm': 18},
|
||||
'alias': 'Ts', # the name(s) to be given to the alias
|
||||
'targets': # possible devices in addition with importance (numbers assume its on the cryo)
|
||||
{'se_ts': 20, 'se_tt': 20, 'se_tm': 20},
|
||||
},
|
||||
temperature_regulation = {
|
||||
'alias': 'T',
|
||||
'targets': {'se_ts': 20, 'se_tt': 19, 'se_tm': 18, 'se_T_stat': 17},
|
||||
'targets': {'se_ts': 27, 'se_tt': 27, 'se_tm': 27, 'se_T_stat': 27},
|
||||
'drivable_only': True,
|
||||
},
|
||||
magneticfield = {
|
||||
'alias': ['B', 'magfield'],
|
||||
'alias': 'B',
|
||||
'targets': {'se_mf': 20},
|
||||
},
|
||||
pressure = {
|
||||
@@ -46,22 +45,24 @@ devices = dict(
|
||||
},
|
||||
stick_rotation={
|
||||
'alias': 'dom',
|
||||
'targets': {'se_om': 20, 'se_stickrot': 19},
|
||||
'targets': {'se_om': 20, 'se_stickrot': 20},
|
||||
'envlist': False,
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
startupcode = '''
|
||||
printinfo("=======================================================================================")
|
||||
printinfo("Welcome to the NICOS frappy secnode setup!")
|
||||
printinfo(" ___________________________________________________________________________________________")
|
||||
printinfo(" ")
|
||||
printinfo("Usage:")
|
||||
printinfo(" frappy('<main cfg>') # change main SE configuration (e.g. cryostat)")
|
||||
printinfo(" frappy('<main cfg>', '<stick cfg>') # change main and stick cfg")
|
||||
printinfo(" frappy(stick='') # remove stick")
|
||||
printinfo(" frappy('') # remove main SE apparatus")
|
||||
printinfo(" frappy() # show the current SE configuration")
|
||||
printinfo("=======================================================================================")
|
||||
printinfo(" Welcome to the NICOS frappy secnode setup!")
|
||||
printinfo(" ")
|
||||
printinfo(" Usage:")
|
||||
printinfo(" frappy('<main cfg>') # change main SE configuration (e.g. cryostat)")
|
||||
printinfo(" frappy('<main cfg>', '<stick cfg>') # change main and stick cfg")
|
||||
printinfo(" frappy(stick='') # remove stick")
|
||||
printinfo(" frappy('') # remove main SE apparatus")
|
||||
printinfo(" frappy.read() # show the current SE configuration")
|
||||
printinfo(" frappy() # show and update SE configuration form server state")
|
||||
printinfo(" ___________________________________________________________________________________________")
|
||||
set_se_list()
|
||||
'''
|
||||
|
||||
@@ -6,6 +6,6 @@ devices = {
|
||||
'se_addons':
|
||||
device('nicos_sinq.frappy_sinq.devices.FrappyNode',
|
||||
description='SEC node', unit='', async_only=True,
|
||||
prefix='se_', auto_create=True, service='addons',
|
||||
prefix=environ.get('SE_PREFIX', 'se_'), auto_create=True, service='addons',
|
||||
),
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ devices = {
|
||||
'se_main':
|
||||
device('nicos_sinq.frappy_sinq.devices.FrappyNode',
|
||||
description='main SEC node', unit='', async_only=True,
|
||||
prefix='se_', auto_create=True, service='main',
|
||||
prefix=environ.get('SE_PREFIX', 'se_'), auto_create=True, service='main',
|
||||
general_stop_whitelist=['om', 'stickrot'],
|
||||
),
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ devices = {
|
||||
'se_stick':
|
||||
device('nicos_sinq.frappy_sinq.devices.FrappyNode',
|
||||
description='stick SEC node', unit='', async_only=True,
|
||||
prefix='se_', auto_create=True, service='stick',
|
||||
prefix=environ.get('SE_PREFIX', 'se_'), auto_create=True, service='stick',
|
||||
),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user