bluesky_tiled_plugins.exporters#
Module Contents#
Functions#
Reconstruct the sequence of |
|
Export BlueskyRun as newline-delimited sequence of JSON documents. |
API#
- bluesky_tiled_plugins.exporters.build_descriptor_docs(raw_metadata, stream_name, run_start_uid=None)#
Reconstruct the sequence of
EventDescriptordocuments for a single stream from the raw metadata dictionary cached on its Tiled node.The stored metadata on a Tiled node is user-arbitrary, so this helper narrows the raw metadata down to the fields that make up a valid
EventDescriptordocument (per theevent_modelschema) and validates the result before returning it. Sharing this assembly logic between the JSON-Seq exporter and the clientdescriptorsproperties keeps their output byte-identical.Parameters
raw_metadata : dict The
metadata()payload of the stream node. May contain arbitrary keys; only the ones defined by theEventDescriptorschema are consumed. Any_config_updateslist is unfolded into subsequent descriptor documents. stream_name : str Thenamefield to place on every reconstructed descriptor. run_start_uid : str or None The UID of theRunStartdocument that owns this stream. When supplied, it is written torun_starton every descriptor.Returns
list of dict One or more descriptor documents validated against the
event_modelEventDescriptorschema.
- async bluesky_tiled_plugins.exporters.json_seq_exporter(mimetype, adapter, metadata, filter_for_access)#
Export BlueskyRun as newline-delimited sequence of JSON documents.
This callback is to be configured on the server-side to enable exporting BlueskyRun objects in JSON-Seq format.
The resulting stream yields strings, each of which is a JSON document representing one of the standard Bluesky documents: start, descriptor, event, stream_resource, stream_datum, and stop, in the appropriate order.
For example:
{"name": "start", "doc": {...}} {"name": "descriptor", "doc": {...}} {"name": "event", "doc": {...}} {"name": "stream_resource", "doc": {...}} {"name": "stream_datum", "doc": {...}} ... {"name": "stop", "doc": {...}}