From 0e1e0b764d98a2e7405ff62b1f1f00220054eb20 Mon Sep 17 00:00:00 2001 From: kevin-tian Date: Thu, 19 Dec 2024 12:08:23 -0500 Subject: [PATCH] Add methods and properties --- .../fake_provider/local_runtime_job.py | 19 ++++++++++++++++++- .../fake_provider/local_service.py | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/qiskit_ibm_runtime/fake_provider/local_runtime_job.py b/qiskit_ibm_runtime/fake_provider/local_runtime_job.py index 913bb72a4..6d7307822 100644 --- a/qiskit_ibm_runtime/fake_provider/local_runtime_job.py +++ b/qiskit_ibm_runtime/fake_provider/local_runtime_job.py @@ -28,6 +28,7 @@ def __init__( # type: ignore[no-untyped-def] future, backend: FakeBackendV2, primitive: Literal["sampler", "estimator"], + inputs: dict, *args, **kwargs, ) -> None: @@ -41,6 +42,7 @@ def __init__( # type: ignore[no-untyped-def] self._future = future self._backend = backend self._primitive = primitive + self._inputs = inputs self._created = datetime.now() self._running = datetime.now() self._finished = datetime.now() @@ -74,9 +76,24 @@ def usage(self) -> float: return 0 def properties(self) -> BackendProperties: - """Return the backend properties for this job""" + """Return the backend properties for this job.""" return self._backend.properties() + def error_message(self) -> str: + """Returns the reason if the job failed.""" + return "" + + @property + def inputs(self) -> Dict: + """Return job input parameters.""" + return self._inputs + + @property + def session_id(self) -> str: + """Return the Session ID which would just be the job ID in local mode.""" + + return self._job_id + @property def creation_date(self) -> datetime: """Job creation date in local time.""" diff --git a/qiskit_ibm_runtime/fake_provider/local_service.py b/qiskit_ibm_runtime/fake_provider/local_service.py index a7748dcc1..494fad51d 100644 --- a/qiskit_ibm_runtime/fake_provider/local_service.py +++ b/qiskit_ibm_runtime/fake_provider/local_service.py @@ -275,6 +275,7 @@ def _run_backend_primitive_v2( future=primitive_job._future, backend=backend, primitive=primitive, + inputs=inputs, ) return local_runtime_job