Skip to content

Expose multiple files written by multiple Odin writers in a single StreamResource #1176

@coretl

Description

@coretl

We are about to write StreamResource/StreamDatum support for Odin. Odin supports frames being written in a round robin fashion between N writers, and writers that produce each M files for a particular acquisition by automatically advancing when a certain number of frames are written. We have 4 options to expose this:

  1. Produce NxM StreamResource documents, one for every file that every writer produces, and add the concept of step to a StreamRange so that StreamDatum contiguous indices map to every Nth seq_num. Requires significant rework to bluesky bundlers.
  2. Produce M StreamResource documents, one for set of N files that the writers produce, parameterizing the uri with a writer number, and adding the number of writers and round robin strategy StreamResource document to allow the consolidator to work out which of the N files the frame lives in
  3. Produce one StreamResource document, with uri parameterized on writer number and file number, with number of writers, number of frames per file and round robin strategy in the StreamResource document
  4. We write a VDS encoding this information, and make the StreamResource point at that, but still include the parameters from 3 in case we need to do direct chunk read from the underlying datasets

We decided to do 4.

The parameters for the StreamResource should be a key virtual_dataset with members:

  • source_file_template: a parameterized string with {writer_number} and {file_number} in it that gives the filename for the given writer number and file number (0 indexed)
  • source_dataset: the dataset within the source file to read from
  • number_of_writers: the number of writers writing files
  • events_per_file: the maximum number of events in each file (of the shape given in the descriptor, i.e. could be multiple frames)
  • events_per_writer: the number of sequential events that will be written to a single writer before moving onto the next one

The algorithm for picking the parameters to get the right file is:

writer_number = (event_number // events_per_writer) % number_of_writers
file_number = (event_number // number_of_writers) // events_per_file

Acceptance Criteria

  • VDS created from Odin
  • StreamResource created by the Odin ophyd-async support that points at the VDS
  • ADR written with the above

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions