Skip to content

Refactor bluesky-queueserver integration to work with any optimizer #265

@thopkins32

Description

@thopkins32

Currently, the bluesky-queueserver integration is handled via a custom Agent that is specific to Ax optimizers. This can be reworked to use Blop's protocols rather than integrate only with Ax optimizers.

Here is the proposed refactor:

  • Remove blop/ax/queueserver_agent.py
  • Create blop/queueserver.py file with 3 classes:
    • blop.queueserver.ConsumerCallback essentially unchanged
    • blop.queueserver.QueueserverClient
      • Handles interaction with REManagerAPI
      • Handles callbacks with RemoteDispatcher and ConsumerCallback
    • blop.queueserver.QueueserverOptimizationRunner
      • Runs the optimization loop through a Bluesky queueserver
      • Initialized with a blop.protocols.OptimizationProblem and a QueueserverClient
      • run() method that sends optimization iterations to the queue
  • In blop/ax/agent.py create a new agent that has a nice interface to the runner

Benefits of doing this are:

  • Separation of responsibility for interaction with the queueserver and managing the runtime (more modular code)
  • Enables the use of any optimizer (not just Ax) with the queueserver
  • Maintains the agent interface (that uses the new runner under the hood)

User supplies:

  • ZMQ addresses for communicaton
  • Evaluation function
  • Ophyd devices used (or rather their names)
  • DOFs / Objectives / constraints / etc.
  • Acquisition plan (or rather the plan name)

I may create a new OptimizationProblem dataclass that requires the actuators, sensors, and acquisition plan to be str rather than Python objects. The instances of the Python objects won't be available to the user, only the names of these objects would be.

Metadata

Metadata

Assignees

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