Commit 7d546b3a authored by Wout De Nolf's avatar Wout De Nolf
Browse files

Do not gather AcquisitionObject metadata for HasMetadataForScan controller....

Do not gather AcquisitionObject metadata for HasMetadataForScan controller. Before the opposite was done.
parent 87a0fc2c
...@@ -1471,18 +1471,35 @@ class Scan: ...@@ -1471,18 +1471,35 @@ class Scan:
else: else:
return return
if self._controllers_scan_meta:
instrument = self._controllers_scan_meta.instrument
instrument = None
for acq_obj in self.acq_chain.nodes_list: for acq_obj in self.acq_chain.nodes_list:
with KillMask(masked_kill_nb=1): # Controllers with the HasScanMetadata interface, as
fill_meta = getattr(acq_obj, method_name) # opposed to HasScanMetadataExclusive, will have their
metadata = fill_meta() # metadata already in scan_info.
if instrument:
if instrument.is_set(acq_obj):
# There is a difference between None and an empty dict. # There is a difference between None and an empty dict.
# An empty dict shows up as a group in the Nexus file # An empty dict shows up as a group in the Nexus file
# while None does not. # while None does not.
with KillMask(masked_kill_nb=1):
fill_meta = getattr(acq_obj, method_name)
metadata = fill_meta()
if metadata is None: if metadata is None:
continue continue
# Publish to the Redis node of the controller
node = self.nodes.get(acq_obj) node = self.nodes.get(acq_obj)
if node is not None: if node is not None:
update_node_info(node, metadata) update_node_info(node, metadata)
# Add to the local scan_info, but in a different
# place than where _controllers_scan_meta would put it
self._scan_info._set_device_meta(acq_obj, metadata) self._scan_info._set_device_meta(acq_obj, metadata)
...@@ -1502,23 +1519,14 @@ class Scan: ...@@ -1502,23 +1519,14 @@ class Scan:
@property @property
def _user_scan_meta(self): def _user_scan_meta(self):
if self.__user_scan_meta is None: if self.__user_scan_meta is None and self._enable_scanmeta:
self.__user_scan_meta = get_user_scan_meta().copy() self.__user_scan_meta = get_user_scan_meta().copy()
return self.__user_scan_meta return self.__user_scan_meta
@property @property
def _controllers_scan_meta(self): def _controllers_scan_meta(self):
if self.__controllers_scan_meta is None: if self.__controllers_scan_meta is None and self._enable_scanmeta:
# The metadata of controllers involved in the scan is collected self.__controllers_scan_meta = get_controllers_scan_meta()
# directly by `_metadata_of_acq_controllers`
scan_controller_names = []
for acq_obj in self.acq_chain.nodes_list:
# Register metadata generators for controllers not involved
# in the scan (filter out the scan_controller_names).
self.__controllers_scan_meta = get_controllers_scan_meta(
return self.__controllers_scan_meta return self.__controllers_scan_meta
def _update_scan_info_in_redis(self): def _update_scan_info_in_redis(self):
...@@ -278,7 +278,7 @@ def get_user_scan_meta(): ...@@ -278,7 +278,7 @@ def get_user_scan_meta():
def get_controllers_scan_meta(filtered_controller_names=None): def get_controllers_scan_meta():
"""A new instance is created for every scan. """A new instance is created for every scan.
""" """
scan_meta = ScanMeta() scan_meta = ScanMeta()
...@@ -293,11 +293,6 @@ def get_controllers_scan_meta(filtered_controller_names=None): ...@@ -293,11 +293,6 @@ def get_controllers_scan_meta(filtered_controller_names=None):
continue continue
if not obj.scan_metadata_enabled: if not obj.scan_metadata_enabled:
continue continue
if filtered_controller_names and in filtered_controller_names:
# Controllers from which we need metadata, whether it is part of
# a scan or not, derive from HasMetadataForScan. When part of the
# scan the name will be in filtered_controller_names.
def metadata_generator(scan, obj=obj): def metadata_generator(scan, obj=obj):
""" """
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