Attempt direct backend creation in service.backend() - #3308
Conversation
| instance: str, | ||
| use_fractional_gates: bool | None, | ||
| calibration_id: str | None = None, | ||
| cache: bool = True, |
There was a problem hiding this comment.
This change allows for "whenever a backend object needs to be created, have the caller decide whether its configuration is cached in the state variables of the service".
Without this change, backends that were created in the new code in .backend() would remain tied to the instance that created them (as they would be cached to that instance). Since the new feature is meant to be used in very specific cases (ie. retrieving a backend manually) and to be superseeded soon, relinquishing caching of that backend seems like a sane trade-off (still allows for ensuring that the created backend belongs to the right instance, at the expense of some extra API calls when the same backend is requested multiple times).
Samuele Ferracin (SamFerracin)
left a comment
There was a problem hiding this comment.
The PR looks good!
DM'ed you about the bigger picture
Summary
Allow
service.backend()to attempt to create a backend directly (as in, constructing thebackendobject from its properties and configuration) even if it is not returned in the list ofservice.backends().Details and comments
This prepares for an upcoming API change where the defaults for the backends endpoint might filter out some devices.
Fixes #3306
AI/LLM disclosure