Skip to content

Simplify Concurrency Design #371

Closed as not planned
Closed as not planned

Description

@callumforrester

Background

At this point, blueapi uses both subprocess and threads manage the concurrent operations of:

  • REST API exposure
  • Management/introspection of RunEngine, plans, devices, etc.
  • Actually running plans

blueapi-subprocess-and-thread(1)

I wonder if this can be simplified.

Proposal

We could ditch the worker thread and make the running of plans block the subprocess. To maintain state querying throughout the running of a plan, we would have to cache state somewhere, possibly in the main process.

blueapi-subprocess-proposal

It's important to add that I don't know if this is actually possible! I don't know if asynchronous updating is supported by subprocess, but it's worth considering.

Would be interested in your thoughts @joeshannon

Activity

  1. added
    enhancement
    tests
    c: worker
    and removed
    tests
    on Feb 7, 2024
  2. joeshannon commented on Feb 8, 2024

    @joeshannon
    Contributor

    There are queues and pipes in the multiprocessing module so I imagine the worker would be able to update the cached state in the API process by putting something onto a queue.

    In terms of blocking the subprocess, this would simplify things but do we need any provision for cancelling running plans?

  3. stan-dot commented on Mar 8, 2024

    @stan-dot
    Contributor

    what if we use something like redis

  4. abbiemery commented on Feb 25, 2026

    @abbiemery
    Contributor

    Neither of these are currently relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: workerenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions