Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add access to transpiled_circuits #1287

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions qiskit_ibm_runtime/api/clients/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,17 @@ def job_metadata(self, job_id: str) -> Dict[str, Any]:
"""
return self._api.program_job(job_id).metadata()

def job_transpiled_circuits(self, job_id: str) -> str:
"""Get job transpiled circuits.

Args:
job_id: Program job ID.

Returns:
Job transpiled circuits.
"""
return self._api.program_job(job_id).transpiled_circuits()

def cancel_session(self, session_id: str) -> None:
"""Close all jobs in the runtime session.

Expand Down
11 changes: 11 additions & 0 deletions qiskit_ibm_runtime/runtime_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
IBMRuntimeError,
RuntimeJobTimeoutError,
RuntimeJobMaxTimeoutError,
IBMInputValueError,
)
from .utils.result_decoder import ResultDecoder
from .api.clients import RuntimeClient, RuntimeWebsocketClient, WebsocketClientCloseCode
Expand Down Expand Up @@ -689,6 +690,16 @@ def usage_estimation(self) -> Dict[str, Any]:

return self._usage_estimation

@property
def transpiled_circuits(self) -> Dict[str, Any]:
"""Return the transpiled circuits for this job."""
if self._program_id == "estimator":
raise IBMInputValueError("Transpiled circuits are not available for estimator jobs.")
result = self._download_external_result(
self._api_client.job_transpiled_circuits(self.job_id())
)
return json.loads(result)

def queue_position(self, refresh: bool = False) -> Optional[int]:
"""Return the position of the job in the server queue.

Expand Down
Loading