Compare commits
41 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0faba6f381 | |||
| 2439d5d603 | |||
| 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 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 servicemanager import FrappyManager
|
from .devices import get_frappy_config, all_info
|
||||||
|
from servicemanager import FrappyManager, SeaManager
|
||||||
|
|
||||||
|
|
||||||
SERVICES = FrappyManager.services
|
SERVICES = FrappyManager.services
|
||||||
@@ -30,57 +31,24 @@ SERVICES = FrappyManager.services
|
|||||||
|
|
||||||
@usercommand
|
@usercommand
|
||||||
def set_se_list():
|
def set_se_list():
|
||||||
frappy_config = session.devices['frappy_config']
|
fc = get_frappy_config()
|
||||||
frappy_config.set_envlist()
|
if fc:
|
||||||
|
fc.set_envalias()
|
||||||
|
|
||||||
|
|
||||||
@usercommand
|
@usercommand
|
||||||
@helparglist('main [, stick [, addons]]')
|
def frappy_main(*args):
|
||||||
def frappy(*args, main=None, stick=None, addons=None, force=False):
|
raise NameError('frappy_main(<cfg>) is no longer avaiable, use frappy(<cfg>) instead')
|
||||||
"""(re)start frappy server(s) with given configs and load setup if needed
|
|
||||||
|
|
||||||
- without argument: list running frappy servers, restart failed frappy servers
|
|
||||||
- frappy('<cfg>'): if available, the standard stick is added too
|
@usercommand
|
||||||
- frappy(''): the stick is removed too
|
def frappy_stick(*args):
|
||||||
- addons are not changed when not given
|
raise NameError('frappy_stick(<cfg>) is no longer avaiable, use frappy(stick=<cfg>) instead')
|
||||||
- frappy(main='<cfg>') # main cfg is changed, but stick is kept
|
|
||||||
- frappy('restart') # restart all frappy servers
|
|
||||||
- frappy(stick='restart') # restart stick frappy server
|
@usercommand
|
||||||
"""
|
def frappy_addons(*args):
|
||||||
confirmed = FrappyManager().cfg_from_sea(config.instrument).get('confirmed')
|
raise NameError('frappy_addons(<cfg>) is no longer avaiable, use frappy(addons=<cfg>) instead')
|
||||||
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
|
@usercommand
|
||||||
@@ -104,8 +72,3 @@ def frappy_list(service=None):
|
|||||||
|
|
||||||
FrappyManager().do_listcfg(config.instrument, service or 'main', prt)
|
FrappyManager().do_listcfg(config.instrument, service or 'main', prt)
|
||||||
session.log.info('\n%s', '\n'.join(content))
|
session.log.info('\n%s', '\n'.join(content))
|
||||||
|
|
||||||
|
|
||||||
@usercommand
|
|
||||||
def frappy_changed():
|
|
||||||
session.devices['frappy_config'].changed()
|
|
||||||
|
|||||||
842
devices.py
842
devices.py
File diff suppressed because it is too large
Load Diff
@@ -4,10 +4,8 @@ group = 'optional'
|
|||||||
modules = ['nicos_sinq.frappy_sinq.commands']
|
modules = ['nicos_sinq.frappy_sinq.commands']
|
||||||
|
|
||||||
devices = dict(
|
devices = dict(
|
||||||
frappy_config = device(
|
frappy = device(
|
||||||
'nicos_sinq.frappy_sinq.devices.FrappyConfig',
|
'nicos_sinq.frappy_sinq.devices.FrappyConfig',
|
||||||
# frappy_config does not need to be visible
|
|
||||||
visibility = [],
|
|
||||||
# the possible SECoP connections
|
# the possible SECoP connections
|
||||||
nodes = ['se_main', 'se_stick', 'se_addons'],
|
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
|
# the devices with the names given by key are added to determine the
|
||||||
# device, using the given importance number, with similar values as
|
# device, using the given importance number, with similar values as
|
||||||
# given by the SECoP standard (10: instrument, 20: cryostat, 30: insert)
|
# 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
|
temperature = { # the SECoP meaning
|
||||||
'alias': ['Ts', 'temperature'], # the name(s) to be given to the alias
|
'alias': 'Ts', # the name(s) to be given to the alias
|
||||||
'targets': # possible devices in addition with importance
|
'targets': # possible devices in addition with importance (numbers assume its on the cryo)
|
||||||
{'se_ts': 20, 'se_tt': 19, 'se_tm': 18},
|
{'se_ts': 20, 'se_tt': 20, 'se_tm': 20},
|
||||||
},
|
},
|
||||||
temperature_regulation = {
|
temperature_regulation = {
|
||||||
'alias': 'T',
|
'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,
|
'drivable_only': True,
|
||||||
},
|
},
|
||||||
magneticfield = {
|
magneticfield = {
|
||||||
'alias': ['B', 'magfield'],
|
'alias': 'B',
|
||||||
'targets': {'se_mf': 20},
|
'targets': {'se_mf': 20},
|
||||||
},
|
},
|
||||||
pressure = {
|
pressure = {
|
||||||
@@ -46,22 +45,24 @@ devices = dict(
|
|||||||
},
|
},
|
||||||
stick_rotation={
|
stick_rotation={
|
||||||
'alias': 'dom',
|
'alias': 'dom',
|
||||||
'targets': {'se_om': 20, 'se_stickrot': 19},
|
'targets': {'se_om': 20, 'se_stickrot': 20},
|
||||||
'envlist': False,
|
'envlist': False,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
startupcode = '''
|
startupcode = '''
|
||||||
printinfo("=======================================================================================")
|
printinfo(" ___________________________________________________________________________________________")
|
||||||
printinfo("Welcome to the NICOS frappy secnode setup!")
|
|
||||||
printinfo(" ")
|
printinfo(" ")
|
||||||
printinfo("Usage:")
|
printinfo(" Welcome to the NICOS frappy secnode setup!")
|
||||||
printinfo(" frappy('<main cfg>') # change main SE configuration (e.g. cryostat)")
|
printinfo(" ")
|
||||||
printinfo(" frappy('<main cfg>', '<stick cfg>') # change main and stick cfg")
|
printinfo(" Usage:")
|
||||||
printinfo(" frappy(stick='') # remove stick")
|
printinfo(" frappy('<main cfg>') # change main SE configuration (e.g. cryostat)")
|
||||||
printinfo(" frappy('') # remove main SE apparatus")
|
printinfo(" frappy('<main cfg>', '<stick cfg>') # change main and stick cfg")
|
||||||
printinfo(" frappy() # show the current SE configuration")
|
printinfo(" frappy(stick='') # remove stick")
|
||||||
printinfo("=======================================================================================")
|
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()
|
set_se_list()
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -6,6 +6,6 @@ devices = {
|
|||||||
'se_addons':
|
'se_addons':
|
||||||
device('nicos_sinq.frappy_sinq.devices.FrappyNode',
|
device('nicos_sinq.frappy_sinq.devices.FrappyNode',
|
||||||
description='SEC node', unit='', async_only=True,
|
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':
|
'se_main':
|
||||||
device('nicos_sinq.frappy_sinq.devices.FrappyNode',
|
device('nicos_sinq.frappy_sinq.devices.FrappyNode',
|
||||||
description='main SEC node', unit='', async_only=True,
|
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':
|
'se_stick':
|
||||||
device('nicos_sinq.frappy_sinq.devices.FrappyNode',
|
device('nicos_sinq.frappy_sinq.devices.FrappyNode',
|
||||||
description='stick SEC node', unit='', async_only=True,
|
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