Commit 226219ba authored by Matias Guijarro's avatar Matias Guijarro
Browse files

fix issue #1475: possibility to specify scan saving config in session yml

parent fb2e0ead
......@@ -203,6 +203,9 @@ class Session:
self.__default_user_script_homedir = config_tree.get("default-userscript-dir")
if self.__default_user_script_homedir and not self._get_user_script_home():
self._set_user_script_home(self.__default_user_script_homedir)
self.__scan_saving_config = config_tree.get(
"scan_saving", self.config.root.get("scan_saving", {})
)
@property
def name(self):
......@@ -587,8 +590,7 @@ class Session:
if "user_script_run" not in env_dict:
env_dict["user_script_run"] = self.user_script_run
scan_saving_config = self.config.root.get("scan_saving", {})
scan_saving_class_name = scan_saving_config.get("class")
scan_saving_class_name = self.__scan_saving_config.get("class")
if scan_saving_class_name is not None:
scan_saving_class = getattr(scan_saving, scan_saving_class_name)
else:
......
......@@ -715,12 +715,19 @@ class ESRFScanSaving(BasicScanSaving):
"FAULT": "Device is not functioning correctly",
}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def __init__(self, name):
super().__init__(name)
self._tango_metadata_manager = None
self._tango_metadata_experiment = None
@property
def scan_saving_config(self):
session_config = current_session.config.get_config(current_session.name)
return session_config.get(
"scan_saving", session_config._config.root.get("scan_saving", {})
)
@property
def data_policy(self):
return "ESRF"
......@@ -744,10 +751,6 @@ class ESRFScanSaving(BasicScanSaving):
info_table.append(("Metadata", icat_state, icat_status))
return info_table
@property
def scan_saving_config(self):
return current_session.config.root.get("scan_saving", {})
@property
def images_path_relative(self):
# Always relative due to the data policy
......
......@@ -50,18 +50,20 @@ def test_print_sessions(beacon):
bliss_cmd_output, _ = bliss_shell.communicate()
assert set(bliss_cmd_output.split("\n")) == set(
"""test_session4
test_session2
test_session5
test_alias
test_alias2
"""
failing_setup_session
flint
test_session3
lima_test_session
test_session
freddy
lima_test_session
nexus_writer_session
scan_saving_test_session
test_alias
test_alias2
test_session
test_session2
test_session3
test_session4
test_session5
""".split(
"\n"
)
......
......@@ -105,4 +105,14 @@
name: failing_setup_session
setup-file: ./test_failing_setup.py
config-objects: []
- class: Session
name: scan_saving_test_session
setup-file: ./test_setup.py
config-objects: []
scan_saving:
class: ESRFScanSaving
beamline: id00_test_scan_saving
tmp_data_root: /tmp/scans/tmp_test_scan_saving
visitor_data_root: /tmp/scans/visitor_test_scan_saving
inhouse_data_root: /tmp/scans/inhouse_test_scan_saving
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment