Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding an mv plan to the queue fails pydantic validation #310

Open
canismarko opened this issue Oct 28, 2024 · 6 comments
Open

Adding an mv plan to the queue fails pydantic validation #310

canismarko opened this issue Oct 28, 2024 · 6 comments

Comments

@canismarko
Copy link

I'm trying to add an item to the queue using the bluesky-queueserver-api package. It receives a response from the queueserver saying that Plan validation failed: Unable to generate pydantic-core schema for <class 'bluesky.protocols.NamedMovable'>.

Expected Behavior

The queue should contain a new item that will execute the bps.mv plan using the device specified. We should also get a response with response['status'] == True.

Current Behavior

The request fails, with an error message saying that pydantic validation failed. Here is the ipython session that had this issue.

https://gist.github.com/canismarko/ef234d5336e1f325139036a5384a4799

sim_motor_2 is an instance of ophyd_async.epics.motor.Motor. Further down, I tried with a different plan, namely bp.count, and this worked. In that case, sim_det is a threaded ophyd area detector, and I0 is an ophyd_async.core.StandardReadable object.

Steps to Reproduce (for bugs)

  1. Launch a queueserver which defines an ophyd-async epics motor in its queueserver startup (e.g. "sim_motor_2")
  2. In a separate python session, create and connect a bluesky_queueserver_api to the queueserver
  3. Create a bluesky plan to send to the queueserver: mv_plan = BPlan("mv", "sim_motor_2", 5)
  4. Add this item to the queue through the api: api.item_add(mv_plan)

Context

I have a GUI that uses the queueserver to execute plans. We have a window for adding the mv plan. This user selects the device for the mv plan, and the destination, then clicks a button that creates the BPlan item and send it to the queueserver.

Your Environment

Here are all the packages installed in the environment: https://gist.github.com/canismarko/ef234d5336e1f325139036a5384a4799#file-mamba-list I tried this with both bluesky 1.13, and bluesky installed directly from github (1.14.dev23+g3bce96b8). Here is the specific device that I'm using the make sim_motor_2: https://github.com/spc-group/haven/blob/f8855aa160f23c7f7222541c430f3d9c20cd1c14/src/haven/devices/motor.py#L19

@canismarko canismarko changed the title Adding an mv plan to the queue Adding an mv plan to the queue fails pydantic validation Oct 28, 2024
@whs92
Copy link
Member

whs92 commented Oct 31, 2024

@danielballan this feels related to the problem reported by Zach Arthur in the community call last week.

@whs92
Copy link
Member

whs92 commented Oct 31, 2024

@canismarko you said this previously worked. What version of qserver api or qserver did it work with?

@whs92
Copy link
Member

whs92 commented Oct 31, 2024

And can you share the code from the qserver RE ipython env where you define the count and mv plans. Do you set any plan annotation?

@canismarko
Copy link
Author

@whs92 I set up a completely separate environment so I could test this better.

I found that actually the bluesky version is what determines whether this issue pops up:

  • bluesky==1.12.0
    • ✓ bluesky-queueserver==0.0.21
    • ✓ bluesky-queueserver==0.0.20
    • ✓ bluesky-queueserver==0.0.19
  • bluesky==1.13.0
    • ✘ bluesky-queueserver==0.0.21
    • † bluesky-queueserver==0.0.20
    • † bluesky-queueserver==0.0.20

† I couldn't test older bluesky-queueserver versions with bluesky==1.13.0 because those annotated plan stubs aren't recognized by bluesky-queueserver.

Do you set any plan annotation?

No, I just imported the standard bluesky plan stubs. Here is the queueserver startup code: https://gist.github.com/canismarko/3dde96e28c1dda1784d07801123d5934#file-queue_mv_plan_startup-py

@dmgav
Copy link
Contributor

dmgav commented Nov 1, 2024

The issue is reproducible with Bluesky from main branch. It is being resolved in #312 Currently it's half-working: the NamedMovable protocol is added and is recognized, but there are a few more problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants