Commit deba5562 authored by Valentin Valls's avatar Valentin Valls
Browse files

Fill metadata per controllers imprementing HasMetadataForScan

parent e3a0ac68
......@@ -116,3 +116,16 @@ class IcatPublisher(ABC):
Return a dict containing metadata
"""
raise NotImplementedError
class HasMetadataForScan(ABC):
"""
Any controller which provides metadata during a scan life cycle.
"""
def metadata_when_prepared(self) -> dict:
"""
Return a dict containing metadata when the device was prepared by the
scan.
"""
raise NotImplementedError
......@@ -15,6 +15,7 @@ import collections
import gevent
from treelib import Tree
from bliss.common.protocols import HasMetadataForScan
from bliss.common.event import dispatcher
from bliss.common.alias import CounterAlias
from bliss.common.cleanup import capture_exceptions
......@@ -463,13 +464,16 @@ class AcquisitionObject:
In this method, acquisition device should collect and meta data
related to this device and prepare it for publishing. it is called
during the scan initialization.
This can be used in two ways:
1) attaching meta data to the scan_meta object and publishing it in scan_info
i.e: scan_meta.instrument.set(self,{"timing mode":"fast"})
2) the return value of this function is used to fill the meta data of the
node attached to this AcqObj
"""
device = self.device
if isinstance(device, HasMetadataForScan):
return device.metadata_when_prepared()
return None
def fill_meta_at_scan_end(self, scan_meta):
......@@ -477,7 +481,7 @@ class AcquisitionObject:
In this method, acquisition device should collect and meta data
related to this device and prepare it for publishing. it is called
at the end of the scan.
This can be used in two ways:
1) attaching meta data to the scan_meta object and publishing it in scan_info
......
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