Skip to content

Attempt direct backend creation in service.backend() - #3308

Merged
Diego M. Rodríguez (diego-plan9) merged 5 commits into
Qiskit:mainfrom
diego-plan9:feature/backend-direct-retrieving
Sep 10, 2026
Merged

Attempt direct backend creation in service.backend()#3308
Diego M. Rodríguez (diego-plan9) merged 5 commits into
Qiskit:mainfrom
diego-plan9:feature/backend-direct-retrieving

Conversation

@diego-plan9

Copy link
Copy Markdown
Member

Summary

Allow service.backend() to attempt to create a backend directly (as in, constructing the backend object from its properties and configuration) even if it is not returned in the list of service.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

  • I didn't use LLM tooling, or only used it privately.

instance: str,
use_fractional_gates: bool | None,
calibration_id: str | None = None,
cache: bool = True,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR looks good!
DM'ed you about the bigger picture

Merged via the queue into Qiskit:main with commit 388bb35 Sep 10, 2026
18 checks passed
@diego-plan9
Diego M. Rodríguez (diego-plan9) deleted the feature/backend-direct-retrieving branch September 10, 2026 17:26
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

Successfully merging this pull request may close these issues.

Allow service.backend() to return a backend directly

2 participants