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

Remove AerCircuit from result of backend.run() #1845

Merged
merged 3 commits into from
Jun 13, 2023
Merged
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
2 changes: 1 addition & 1 deletion qiskit_aer/backends/aerbackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ def _execute_circuits_job(self, circuits, noise_model, config, job_id="", format
for result in output["results"]:
if "header" not in result:
continue
result["header"]["metadata"] = metadata_map[result["circuit"]]
result["header"]["metadata"] = metadata_map[result.pop("circuit")]

# Add execution time
output["time_taken"] = time.time() - start
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
fixes:
- |
Results of ``backend.run()`` were not serializable because they include :class:`.AerCircuit`\ s.
This commit makes the results serializable by removing :class:`.AerCircuit`\ s from metadata.
3 changes: 2 additions & 1 deletion test/terra/backends/aer_simulator/test_circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
AerSimulator Integration Tests
"""
from math import sqrt
from copy import deepcopy
from ddt import ddt
import numpy as np
from qiskit import ClassicalRegister, QuantumCircuit, QuantumRegister, assemble
Expand Down Expand Up @@ -190,7 +191,7 @@ def test_metadata_protected(self):
self.assertEqual(circuit.metadata["foo"], "bar")
self.assertEqual(circuit.metadata["object"], object)

job.result()
deepcopy(job.result())

def test_run_qobj(self):
"""Test qobj run"""
Expand Down