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
{{ message }}
Repository navigation
Refactor: Combine functionality of Device and Device model #1725
The distinction between actual ophyd-async devices stored in the context
and the model used to represent them is useful as the worker shouldn't
need to have any understanding of the user side of the interface that
calls it. However with the desire to have better modelling of devices
and their children for use in the client, having these separate will
cause more duplicated code and generation of objects on the fly will
have a performance overhead.
Falling in line with the plan model refactoring we can instead keep a
dictionary of BlueapiDevices which have a to_model function in them.
This will be a more involved change than the plans to ensure the
reference cache still behaves.
class BlueapiDevice(BlueapiBaseModel):
name: str = Field(description="Name of the device")
device: Device
def to_model(self) -> dict[str, Any]:
return {
"name": self.name,
"protocols": ist(_protocol_info(self)),
}
The name checking would have to happen on the device registration if it
still needs to be done
name = device.name if isinstance(device, HasName) else _UNKNOWN_NAME
Acceptance Criteria
The dictionary of name to device in the context now stores name to
BlueapiDevice
The blueapi device has a method on it that created the model for
the rest interface
Similar to how #1728 was closed in order to keep both Plan and PlanModel separate, I think this issue can also be closed as not planned because we want to keep Device and DeviceModel separate.
Just to check @tpoliaw am I fine to close this issue?
Activity
shree-iyengar-dls commentedon Nov 10, 2026
Similar to how #1728 was closed in order to keep both
PlanandPlanModelseparate, I think this issue can also be closed as not planned because we want to keepDeviceandDeviceModelseparate.Just to check @tpoliaw am I fine to close this issue?
tpoliaw commentedon Nov 10, 2026
Makes sense to me