You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a mapping of devices that I want to use in my queueserver startup, generated by an automatic tool. Right now, I load each one into globals by its device name, then I can execute plans using these device names.
However, with ophyd-async, these device names often contain characters that are not valid python variable names. They can get added to globals() fine, but the queueserver does not identify them as usable devices.
Expected Behavior
The following plan should correctly execute using the device named "high_heat_load_mirror_1-transverse", which is the name of a motor "transverse" which is the child of a parent device "high_heat_load_mirror_1".
Instead I receive an error when executing the plan about how a string type does not have the attribute name. I usually associate this with what happens when the queueserver cannot resolve the device variable name to an actual device.
Possible Solution
Not sure, I assumed that the queueserver checks for device names in globals(), since adding devices to globals() in the queueserver startup seems to work. I wasn't able to find the portion of the queueserver codebase where this translation happens.
Steps to Reproduce (for bugs)
In a queueserver startup file, create a device directly in globals: globals()["motor-1"] = Motor("255id:m1", name="motor-1").
From a separate python session, try to add this to the queue: api.item_add(BPlan("mv", "motor-1", 5))
Start the queue.
Context
I use a tool for creating ophyd(-async) devices from configuration files. The result is a dictionary-like object that holds all the devices. This includes children of devices, which can be retrieved either by their dotted name (e.g. "motor1.user_setpoint"), or their proper ophyd name (e.g. "motor1-user_setpoint"). To make them available in the queueserver, in qserver startup file I iterate through this dict and add each entry to globals(), so that the queue can use it.
My workaround for now is to add a translator, both to the queueserver startup and to the part of the GUI that prepares plans, that rewrite the names to replace "-" and "." with "_". This strikes me as a bit kludgy, though, so I'm wondering if there is a better way that ties into the queueserver device resolution machinery?
Your Environment
The text was updated successfully, but these errors were encountered:
I have a mapping of devices that I want to use in my queueserver startup, generated by an automatic tool. Right now, I load each one into globals by its device name, then I can execute plans using these device names.
However, with ophyd-async, these device names often contain characters that are not valid python variable names. They can get added to globals() fine, but the queueserver does not identify them as usable devices.
Expected Behavior
The following plan should correctly execute using the device named "high_heat_load_mirror_1-transverse", which is the name of a motor "transverse" which is the child of a parent device "high_heat_load_mirror_1".
Current Behavior
Instead I receive an error when executing the plan about how a string type does not have the attribute
name
. I usually associate this with what happens when the queueserver cannot resolve the device variable name to an actual device.Possible Solution
Not sure, I assumed that the queueserver checks for device names in
globals()
, since adding devices toglobals()
in the queueserver startup seems to work. I wasn't able to find the portion of the queueserver codebase where this translation happens.Steps to Reproduce (for bugs)
globals()["motor-1"] = Motor("255id:m1", name="motor-1")
.api.item_add(BPlan("mv", "motor-1", 5))
Context
I use a tool for creating ophyd(-async) devices from configuration files. The result is a dictionary-like object that holds all the devices. This includes children of devices, which can be retrieved either by their dotted name (e.g. "motor1.user_setpoint"), or their proper ophyd name (e.g. "motor1-user_setpoint"). To make them available in the queueserver, in qserver startup file I iterate through this dict and add each entry to globals(), so that the queue can use it.
My workaround for now is to add a translator, both to the queueserver startup and to the part of the GUI that prepares plans, that rewrite the names to replace "-" and "." with "_". This strikes me as a bit kludgy, though, so I'm wondering if there is a better way that ties into the queueserver device resolution machinery?
Your Environment
The text was updated successfully, but these errors were encountered: