From ae425957a9eb30d8340704c84dc76ff417b48bfe Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Fri, 17 May 2024 18:59:16 +0200 Subject: [PATCH] fix: fetching IBM backend properties deactivated --- .../providers/ibm/ibm_provider_backend.py | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/planqk/qiskit/providers/ibm/ibm_provider_backend.py b/planqk/qiskit/providers/ibm/ibm_provider_backend.py index b07c541..160c3bf 100644 --- a/planqk/qiskit/providers/ibm/ibm_provider_backend.py +++ b/planqk/qiskit/providers/ibm/ibm_provider_backend.py @@ -2,18 +2,17 @@ from typing import Dict from typing import Optional, List -from qiskit import QuantumCircuit -from qiskit.providers.models import BackendStatus -from qiskit_ibm_provider import IBMBackend -from qiskit_ibm_provider.job import IBMCircuitJob -from qiskit_ibm_provider.utils import RuntimeEncoder - from planqk.qiskit import PlanqkJob from planqk.qiskit.client.backend_dtos import STATUS from planqk.qiskit.client.client import _PlanqkClient from planqk.qiskit.client.job_dtos import JobDto, INPUT_FORMAT, RuntimeJobParamsDto from planqk.qiskit.planqk_runtime_job import PlanqkRuntimeJob from planqk.qiskit.providers.ibm.ibm_backend import PlanqkIbmBackend +from qiskit import QuantumCircuit +from qiskit.providers.models import BackendStatus +from qiskit_ibm_provider import IBMBackend +from qiskit_ibm_provider.job import IBMCircuitJob +from qiskit_ibm_provider.utils import RuntimeEncoder def _encode_circuit_base64(circuit: QuantumCircuit): @@ -27,8 +26,11 @@ class PlanqkIbmProviderBackend(PlanqkIbmBackend): def __init__(self, **kwargs): PlanqkIbmBackend.__init__(self, **kwargs) - self.ibm_backend = IBMBackend(configuration=self.configuration(), provider=None, api_client=None) + self.ibm_backend = IBMBackend(configuration=self.configuration(), + provider=kwargs.get('provider'), + api_client=None) self.ibm_backend._runtime_run = self._submit_job + self.ibm_backend.properties = self._backend_properties self.ibm_backend.status = self.status def run(self, circuit, **kwargs) -> PlanqkRuntimeJob: @@ -70,6 +72,10 @@ def _submit_job( return PlanqkRuntimeJob(backend=self, job_details=job_request) + def _backend_properties(self): + # Supported for loading dynamic properties currently not supported + return None; + def retrieve_job(self, job_id: str) -> PlanqkJob: job_details = _PlanqkClient.get_job(job_id) return PlanqkRuntimeJob(backend=self, job_id=job_id, job_details=job_details)