Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Commit

Permalink
Remove extra decompose in RuntimeEncoder (#1094) (#1098)
Browse files Browse the repository at this point in the history
* Remove extra decompose in RuntimeEncoder (#1094)

* remove extra decompose

* fix lint

* fix lint again

* add release note

* Update release note with link to PR since there was no issue created

Co-authored-by: Jessie Yu <[email protected]>
  • Loading branch information
rathishcholarajan and jyu00 authored Dec 8, 2021
1 parent e840250 commit 502f525
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 0 additions & 4 deletions qiskit/providers/ibmq/runtime/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

from qiskit.circuit import (Instruction, ParameterExpression, QuantumCircuit,
qpy_serialization)
from qiskit.circuit.library import BlueprintCircuit
from qiskit.result import Result


Expand Down Expand Up @@ -184,9 +183,6 @@ def default(self, obj: Any) -> Any: # pylint: disable=arguments-differ
if hasattr(obj, 'to_json'):
return {'__type__': 'to_json', '__value__': obj.to_json()}
if isinstance(obj, QuantumCircuit):
# TODO Remove the decompose when terra 6713 is released.
if isinstance(obj, BlueprintCircuit):
obj = obj.decompose()
value = _serialize_and_encode(
data=obj,
serializer=lambda buff, data: qpy_serialization.dump(data, buff)
Expand Down
6 changes: 6 additions & 0 deletions releasenotes/notes/runtime-decompose-c6f719f99ae6f7c3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
fixes:
- |
Fix delivered in `#1094 <https://github.com/Qiskit/qiskit-ibmq-provider/pull/1094>`__ for
the issue wherein :class:`qiskit.providers.ibmq.runtime.RuntimeEncoder`
does an extra `decompose()` if the circuit being serialized is a ``BlueprintCircuit``.
2 changes: 1 addition & 1 deletion test/ibmq/test_ibmq_jobmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def test_job_qobjs(self):
job_set.results()
for i, qobj in enumerate(job_set.qobjs()):
rjob = self.fake_api_provider.backend.retrieve_job(jobs[i].job_id())
self.maxDiff = None # pylint: disable=invalid-name
self.maxDiff = None # pylint: disable=attribute-defined-outside-init,invalid-name
self.assertDictEqual(qobj.to_dict(), rjob.qobj().to_dict())

def test_error_message(self):
Expand Down

0 comments on commit 502f525

Please sign in to comment.