Skip to content

Commit

Permalink
avoid serialization of circuit metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
hhorii committed Feb 28, 2022
1 parent b075ec0 commit f47fd62
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions qiskit/providers/aer/backends/aerbackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,20 @@ def _run(self, qobj, job_id='', format_result=True):
# Start timer
start = time.time()

# Take metadata for JSON serialization
metadata_list = []
for expr in qobj.experiments:
if hasattr(expr.header, 'metadata'):
metadata_list.append(expr.header.metadata)
del(expr.header.metadata)
else:
metadata_list.append(None)

# Run simulation
output = self._execute(qobj)
for expr, metadata in zip(qobj.experiments, metadata_list):
if metadata:
expr.header.metadata = metadata

# Validate output
if not isinstance(output, dict):
Expand Down

0 comments on commit f47fd62

Please sign in to comment.