41 Commits
tmp ... master

Author SHA1 Message Date
0faba6f381 remove ppms and timestamp
- this is moved to nicos_sinq/linse_nicos, which is a new gitea repo
2025-11-19 13:31:06 +01:00
2439d5d603 log a warning when sea_recorder fails 2025-11-07 10:09:58 +01:00
26561833a2 restore previous envlist when NewExperiment is called.
- do this also on FinishExperiment
- but do do do it when the proposed environment is not contained
  in the previous envlist
+ fix a typo and a minor bug in output
2025-09-08 15:20:59 +02:00
c18fec4081 add general_stop_whitelist 2025-08-28 18:00:44 +02:00
d4adaff40d do not remove aliases with targets not inheriting frm SecopDevice 2025-07-14 11:47:17 +02:00
3d907bd11c resolve problem with DefuncDevice
renew envlist even when not changed
if not, devices in envlist are not exchanged by new instances.
2025-06-20 13:43:58 +02:00
806490322e change sea_recorder argument to dict
+ send sea_recorder to sea only when needed
2025-06-18 09:57:18 +02:00
c217b1c264 try-except around sea_recorder 2025-06-17 18:16:16 +02:00
a4df743570 add sea recorder when frappy is not already using sea 2025-06-17 11:24:26 +02:00
9f7413a1a5 split lab.py in labcommands.py and timestamp.py
- timestamp.TimeStamp is used as a dummy detector
- labcommands may be used in lab expts. but is somehow outdated
2025-04-29 08:48:13 +02:00
43853ae49c send udp message to feeder
inform the history feeder in case of a SECoP server without
UDP mechanism
2025-04-29 08:03:15 +02:00
b96a7dec1c fix bad path of Timestamp device 2025-04-24 14:05:13 +02:00
6a89ec8383 unify Frappy.show and Frappy.show_state
+ fix indentation
2024-12-03 15:01:47 +01:00
53057297d7 improve meaning handling
- Moveables with meaning 'temperature' are added to
  the 'temperature_regulation' target list
- Devices with meaning 'temperature_regulation' are added
  to 'temperature' target list, but with much lower priority
  (should be considered only when no sample quantity is detected)
2024-12-03 15:01:43 +01:00
4cbc5a9ec9 FrappyConfig.__call__: fix bug when main is None 2024-11-18 16:53:44 +01:00
dmc
034a2e4440 fix meaning bug 2024-10-24 11:44:56 +02:00
6b28b17823 improve mechanism to determine aliases
- meanings from name guessing has sligthly lower importance then
  given meanings
- then temperature meaning is missing, take temperature_regulation
2024-09-27 16:15:12 +02:00
8d722ad09f improve config guess 2024-09-27 16:15:12 +02:00
dmc
1fd0647d74 try to avoid 'None' as target
use '-' instead
2024-06-25 12:48:26 +02:00
c237718a2d try to treat FrappyNode.target == 'None' properly 2024-06-25 11:17:36 +02:00
868abb4ea2 do not show fm.error
as it will flood log output

- how to handle this properly?
2024-06-24 09:43:28 +02:00
4bde91d16b no warning 'does not match target' while restarting 2024-06-17 15:18:40 +02:00
f8440d38a4 fix 2 issues with starting stopping
- secnode devices were not disconnected before stopping
  leading to error messages
- target of secnodes not properly updated
2024-06-07 17:08:31 +02:00
l_samenv
e121c3ca8e FrappyNode.doInit must super call SecNodeDevice.doInit 2024-06-04 08:17:25 +02:00
974e729920 fix error with predef_aliases 2024-06-03 10:02:35 +02:00
29343faf8a FrappyNode.target must be set after stop but before restart 2024-05-29 15:13:13 +02:00
1a82818da4 FrappyNode.target must be set before restarting servers 2024-05-29 15:06:19 +02:00
6e4c53c881 fix envlist calculation
+ fix pathed loggers mechanism
2024-05-29 14:55:49 +02:00
0776b7575f add timestamp and ppms setups 2024-05-22 16:51:36 +02:00
e841b7bf0e frappy.show: do not show nicos column if equal to frappy 2024-05-13 15:02:59 +02:00
3bddd87609 frappy.show_state: do not show partial status 2024-05-13 13:14:28 +02:00
e213186295 nicer output of server state
- more outstanding output of frappy server state
- frappy() does now alse an update if needed
- frappy.show() to show state only
2024-05-13 08:43:22 +02:00
ead54b14a5 improve detect_changes
check also if envlist and aliases have to be rebuilt
2024-05-07 08:51:36 +02:00
b10102e052 [wip] auto sample environment change, basic version 2024-05-06 10:06:09 +02:00
09237e4118 frappy.has_changed() should not be triggered repeatedly
fix bug
2023-12-15 15:57:15 +01:00
5678530e6e rework frappy to be a device instead of a command
+ improve proposed config mechanism
2023-10-26 10:09:42 +02:00
807b9eb4e7 fix bad prefix in frappy_main setup 2023-10-26 10:09:03 +02:00
0290c06b66 call frappy_changed() on startup 2023-09-20 17:33:27 +02:00
083bd05b16 se_ prefix may be override by SE_PREFIX env var. 2023-09-20 17:33:27 +02:00
91dbc9f086 improve frappy() command
- only informational effect without arguments
- consider also cfg from sea
- on nicos restart, frappy nodes look also for sea device
2023-09-20 17:33:27 +02:00
ba0f4e62b6 improve frappy server management
- do connect in background when the frappy server is not running
  on startup
2023-09-20 17:26:01 +02:00
6 changed files with 664 additions and 291 deletions

View File

@@ -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()

File diff suppressed because it is too large Load Diff

View File

@@ -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()
''' '''

View File

@@ -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',
), ),
} }

View File

@@ -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'],
), ),
} }

View File

@@ -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',
), ),
} }