Skip to content

Commit

Permalink
Add methods and properties
Browse files Browse the repository at this point in the history
  • Loading branch information
kt474 committed Dec 19, 2024
1 parent 00501b0 commit 0e1e0b7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
19 changes: 18 additions & 1 deletion qiskit_ibm_runtime/fake_provider/local_runtime_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def __init__( # type: ignore[no-untyped-def]
future,
backend: FakeBackendV2,
primitive: Literal["sampler", "estimator"],
inputs: dict,
*args,
**kwargs,
) -> None:
Expand All @@ -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()
Expand Down Expand Up @@ -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."""
Expand Down
1 change: 1 addition & 0 deletions qiskit_ibm_runtime/fake_provider/local_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ def _run_backend_primitive_v2(
future=primitive_job._future,
backend=backend,
primitive=primitive,
inputs=inputs,
)

return local_runtime_job

0 comments on commit 0e1e0b7

Please sign in to comment.