added forwarding of unknown arguments of SFAcquisition.acquire() to the Broker

This commit is contained in:
2023-06-20 12:12:19 +02:00
parent 094b896aeb
commit bdd28a7d1d
2 changed files with 11 additions and 3 deletions
+9 -1
View File
@@ -10,6 +10,7 @@ import numpy as np
from slic.utils import xrange, tqdm_mod, tqdm_sleep
from slic.utils import json_validate
from slic.utils.printing import printable_dict
from .broker_tools import get_current_pulseid, get_endstation
@@ -304,12 +305,13 @@ class BrokerConfig:
self.client_name = client_name
self.set(None) #TODO: sensible defaults?
def set(self, output_dir, detectors=None, channels=None, pvs=None, scan_info=None):
def set(self, output_dir, detectors=None, channels=None, pvs=None, scan_info=None, **kwargs):
self.output_dir = output_dir
self.detectors = detectors
self.channels = channels
self.pvs = pvs
self.scan_info = scan_info
self.kwargs = kwargs # unknown arguments will be forwarded verbatim to the broker
def to_dict(self, run_number, start_pulseid, stop_pulseid):
@@ -345,6 +347,12 @@ class BrokerConfig:
if self.scan_info:
config["scan_info"] = self.scan_info
kwargs = self.kwargs
if kwargs:
header="the following unknown arguments are forwarded verbatim to the server"
print(printable_dict(kwargs, header=header))
config.update(self.kwargs)
return config
+2 -2
View File
@@ -39,7 +39,7 @@ class SFAcquisition(BaseAcquisition):
self.current_task = None
def acquire(self, filename, data_base_dir=None, detectors=None, channels=None, pvs=None, scan_info=None, n_pulses=100, n_repeat=1, is_scan_step=False, wait=True):
def acquire(self, filename, data_base_dir=None, detectors=None, channels=None, pvs=None, scan_info=None, n_pulses=100, n_repeat=1, is_scan_step=False, wait=True, **kwargs):
if not is_scan_step:
run_number = self.client.next_run()
print(f"Advanced run number to {run_number}.")
@@ -74,7 +74,7 @@ class SFAcquisition(BaseAcquisition):
bschs.check()
client = self.client
client.set_config(n_pulses, filename, detectors=detectors, channels=channels, pvs=pvs, scan_info=scan_info)
client.set_config(n_pulses, filename, detectors=detectors, channels=channels, pvs=pvs, scan_info=scan_info, **kwargs)
paths = SwissFELPaths(self.instrument, self.pgroup)