From 0001aea47d3c11c7e5e29b4f8a34677f537af961 Mon Sep 17 00:00:00 2001 From: Jesus Talavera <145992175+jesus-talavera-ibm@users.noreply.github.com> Date: Wed, 30 Oct 2024 18:30:29 +0100 Subject: [PATCH] Preparing release qiskit-transpiler-service 0.4.11 (#102) * feat: Improve stability changing retry policy (#98) * Preparing release qiskit-transpiler-service 0.4.11 * chore: Fix tests after backend retirement (#91) * Fix tests --- CHANGELOG.md | 9 +- docs/conf.py | 2 +- qiskit_transpiler_service/wrappers/base.py | 43 ++++-- setup.py | 2 +- tests/ai/conftest.py | 4 +- tests/ai/test_clifford_ai.py | 20 +-- tests/ai/test_linear_function_ai.py | 12 +- tests/ai/test_permutation_ai.py | 32 ++-- tests/ai/test_routing_ai.py | 28 ++-- tests/conftest.py | 162 ++++++++++++++++++++- tests/test_transpiler_service.py | 10 +- 11 files changed, 252 insertions(+), 72 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 206e238..8b2379a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### 👾 Security +## [0.4.11] - 2024-10-30 + +### 🎉 Added + +- [#97](https://github.com/Qiskit/qiskit-transpiler-service/pull/97) In case of failure, always retry the GET request to retrieve a result until the timeout is reached. Increase the delay between requests to 5 seconds when we are over 1 minute. Retry transpilation POST request three times in case of failure. + ### ⚠️ Deprecated ## [0.4.10] - 2024-09-17 @@ -171,7 +177,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Publishing first version 0.1.2 for the IBM Quantum Summit. -[Unreleased]: https://github.com/Qiskit/qiskit-transpiler-service/compare/0.4.10...main-qiskit-transpiler-service +[Unreleased]: https://github.com/Qiskit/qiskit-transpiler-service/compare/0.4.11...main-qiskit-transpiler-service +[0.4.11]: https://github.com/Qiskit/qiskit-transpiler-service/compare/0.4.10...0.4.11 [0.4.10]: https://github.com/Qiskit/qiskit-transpiler-service/compare/0.4.9...0.4.10 [0.4.9]: https://github.com/Qiskit/qiskit-transpiler-service/compare/0.4.8...0.4.9 [0.4.8]: https://github.com/Qiskit/qiskit-transpiler-service/compare/0.4.7...0.4.8 diff --git a/docs/conf.py b/docs/conf.py index b8297eb..0531e95 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,7 +13,7 @@ project = "Qiskit Transpiler Service" copyright = "2024, IBM Quantum" author = "IBM Quantum" -release = "0.4.10" +release = "0.4.11" # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration diff --git a/qiskit_transpiler_service/wrappers/base.py b/qiskit_transpiler_service/wrappers/base.py index d313af9..794cede 100644 --- a/qiskit_transpiler_service/wrappers/base.py +++ b/qiskit_transpiler_service/wrappers/base.py @@ -10,6 +10,7 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. +import itertools import json import logging import os @@ -52,6 +53,12 @@ def _get_token_from_system(): return token +def _status_interval_generator(fast_interval, slow_interval, switch_time): + yield from itertools.chain( + itertools.repeat(fast_interval, switch_time), itertools.repeat(slow_interval) + ) + + class QiskitTranspilerService: """A helper class that covers some common basic funcionality for the Qiskit transpiler service""" @@ -104,15 +111,13 @@ def get_supported_backends(self): return resp def request_status(self, endpoint, task_id): - def _giveup(e): - # Only retry 520 errors - return e.response.status_code != 520 - @backoff.on_predicate( backoff.constant, lambda res: res.get("state") not in ["SUCCESS", "FAILURE"], jitter=None, - interval=1, # TODO: Define by config or circuit? + interval=_status_interval_generator( + fast_interval=1, slow_interval=5, switch_time=60 + ), # TODO: Define by config or circuit? max_time=self.timeout, ) @backoff.on_exception( @@ -123,7 +128,6 @@ def _giveup(e): requests.exceptions.JSONDecodeError, requests.exceptions.HTTPError, ), - giveup=_giveup, max_time=self.timeout, ) def _request_status(self, endpoint, task_id): @@ -148,14 +152,27 @@ def request_and_wait(self, endpoint: str, body: Dict, params: Dict): _raise_transpiler_error_and_log(f"Error: {exc}") def _request_and_wait(self, endpoint: str, body: Dict, params: Dict): - resp = requests.post( - f"{self.url}/{endpoint}", - headers=self.headers, - json=body, - params=params, + @backoff.on_exception( + backoff.expo, + ( + requests.exceptions.Timeout, + requests.exceptions.ConnectionError, + requests.exceptions.JSONDecodeError, + requests.exceptions.HTTPError, + ), + max_tries=3, ) - resp.raise_for_status() - resp = resp.json() + def _request_transp(endpoint: str, body: Dict, params: Dict): + resp = requests.post( + f"{self.url}/{endpoint}", + headers=self.headers, + json=body, + params=params, + ) + resp.raise_for_status() + return resp.json() + + resp = _request_transp(endpoint, body, params) task_id = resp.get("task_id") result = BackendTaskError( diff --git a/setup.py b/setup.py index 80d5380..740970a 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ setup( name="qiskit-transpiler-service", - version="0.4.10", + version="0.4.11", description="Deprecated: use qiskit-ibm-transpiler (https://pypi.org/project/qiskit-ibm-transpiler/) instead. A library to use Qiskit Transpiler service (https://docs.quantum.ibm.com/transpile/qiskit-transpiler-service) and the AI transpiler passes (https://docs.quantum.ibm.com/transpile/ai-transpiler-passes)", long_description=README, long_description_content_type="text/markdown", diff --git a/tests/ai/conftest.py b/tests/ai/conftest.py index ac561b5..e331a1d 100644 --- a/tests/ai/conftest.py +++ b/tests/ai/conftest.py @@ -46,10 +46,10 @@ def create_linear_circuit(n_qubits, gates): @pytest.fixture(scope="module") -def random_circuit_transpiled(backend, cmap_backend): +def random_circuit_transpiled(backend_27q, cmap_backend): circuit = create_random_circuit(27, 4, 2) qiskit_lvl3_transpiler = generate_preset_pass_manager( - optimization_level=3, coupling_map=cmap_backend[backend] + optimization_level=3, coupling_map=cmap_backend[backend_27q] ) return qiskit_lvl3_transpiler.run(circuit) diff --git a/tests/ai/test_clifford_ai.py b/tests/ai/test_clifford_ai.py index a43f2d8..0c60674 100644 --- a/tests/ai/test_clifford_ai.py +++ b/tests/ai/test_clifford_ai.py @@ -39,11 +39,11 @@ def test_clifford_wrong_backend(random_circuit_transpiled, caplog): @pytest.mark.skip( reason="Unreliable. It passes most of the times with the timeout of 1 second for the current circuits used" ) -def test_clifford_exceed_timeout(random_circuit_transpiled, backend, caplog): +def test_clifford_exceed_timeout(random_circuit_transpiled, backend_27q, caplog): ai_optimize_cliff = PassManager( [ CollectCliffords(), - AICliffordSynthesis(backend_name=backend, timeout=1), + AICliffordSynthesis(backend_name=backend_27q, timeout=1), ] ) ai_optimized_circuit = ai_optimize_cliff.run(random_circuit_transpiled) @@ -52,11 +52,11 @@ def test_clifford_exceed_timeout(random_circuit_transpiled, backend, caplog): assert isinstance(ai_optimized_circuit, QuantumCircuit) -def test_clifford_wrong_token(random_circuit_transpiled, backend, caplog): +def test_clifford_wrong_token(random_circuit_transpiled, backend_27q, caplog): ai_optimize_cliff = PassManager( [ CollectCliffords(), - AICliffordSynthesis(backend_name=backend, token="invented_token_2"), + AICliffordSynthesis(backend_name=backend_27q, token="invented_token_2"), ] ) ai_optimized_circuit = ai_optimize_cliff.run(random_circuit_transpiled) @@ -67,11 +67,11 @@ def test_clifford_wrong_token(random_circuit_transpiled, backend, caplog): @pytest.mark.disable_monkeypatch -def test_clifford_wrong_url(random_circuit_transpiled, backend, caplog): +def test_clifford_wrong_url(random_circuit_transpiled, backend_27q, caplog): ai_optimize_cliff = PassManager( [ CollectCliffords(), - AICliffordSynthesis(backend_name=backend, base_url="https://ibm.com/"), + AICliffordSynthesis(backend_name=backend_27q, base_url="https://ibm.com/"), ] ) ai_optimized_circuit = ai_optimize_cliff.run(random_circuit_transpiled) @@ -80,12 +80,12 @@ def test_clifford_wrong_url(random_circuit_transpiled, backend, caplog): @pytest.mark.disable_monkeypatch -def test_clifford_unexisting_url(random_circuit_transpiled, backend, caplog): +def test_clifford_unexisting_url(random_circuit_transpiled, backend_27q, caplog): ai_optimize_cliff = PassManager( [ CollectCliffords(), AICliffordSynthesis( - backend_name=backend, + backend_name=backend_27q, base_url="https://invented-domain-qiskit-transpiler-service-123.com/", ), ] @@ -100,11 +100,11 @@ def test_clifford_unexisting_url(random_circuit_transpiled, backend, caplog): assert isinstance(ai_optimized_circuit, QuantumCircuit) -def test_clifford_function(random_circuit_transpiled, backend): +def test_clifford_function(random_circuit_transpiled, backend_27q): ai_optimize_cliff = PassManager( [ CollectCliffords(), - AICliffordSynthesis(backend_name=backend), + AICliffordSynthesis(backend_name=backend_27q), ] ) ai_optimized_circuit = ai_optimize_cliff.run(random_circuit_transpiled) diff --git a/tests/ai/test_linear_function_ai.py b/tests/ai/test_linear_function_ai.py index 4b6ccb7..a84ae2e 100644 --- a/tests/ai/test_linear_function_ai.py +++ b/tests/ai/test_linear_function_ai.py @@ -114,7 +114,7 @@ def test_linear_function_unexisting_url(random_circuit_transpiled, backend, capl assert isinstance(ai_optimized_circuit, QuantumCircuit) -def test_linear_always_replace(backend, caplog): +def test_linear_always_replace(backend_27q, caplog): orig_qc = QuantumCircuit(3) orig_qc.cx(0, 1) orig_qc.cx(1, 2) @@ -122,7 +122,7 @@ def test_linear_always_replace(backend, caplog): [ CollectLinearFunctions(), AILinearFunctionSynthesis( - backend_name=backend, replace_only_if_better=False + backend_name=backend_27q, replace_only_if_better=False ), ] ) @@ -131,14 +131,14 @@ def test_linear_always_replace(backend, caplog): assert isinstance(ai_optimized_circuit, QuantumCircuit) -def test_linear_function_only_replace_if_better(backend, caplog): +def test_linear_function_only_replace_if_better(backend_27q, caplog): orig_qc = QuantumCircuit(3) orig_qc.cx(0, 1) orig_qc.cx(1, 2) ai_optimize_lf = PassManager( [ CollectLinearFunctions(min_block_size=2), - AILinearFunctionSynthesis(backend_name=backend), + AILinearFunctionSynthesis(backend_name=backend_27q), ] ) ai_optimized_circuit = ai_optimize_lf.run(orig_qc) @@ -147,11 +147,11 @@ def test_linear_function_only_replace_if_better(backend, caplog): assert isinstance(ai_optimized_circuit, QuantumCircuit) -def test_linear_function_pass(random_circuit_transpiled, backend, caplog): +def test_linear_function_pass(random_circuit_transpiled, backend_27q, caplog): ai_optimize_lf = PassManager( [ CollectLinearFunctions(), - AILinearFunctionSynthesis(backend_name=backend), + AILinearFunctionSynthesis(backend_name=backend_27q), ] ) ai_optimized_circuit = ai_optimize_lf.run(random_circuit_transpiled) diff --git a/tests/ai/test_permutation_ai.py b/tests/ai/test_permutation_ai.py index 9175172..21c7d92 100644 --- a/tests/ai/test_permutation_ai.py +++ b/tests/ai/test_permutation_ai.py @@ -21,8 +21,8 @@ @pytest.fixture -def permutations_circuit(backend, cmap_backend): - coupling_map = cmap_backend[backend] +def permutations_circuit(backend_27q, cmap_backend): + coupling_map = cmap_backend[backend_27q] cmap = list(coupling_map.get_edges()) orig_qc = QuantumCircuit(27) for i, j in cmap: @@ -64,11 +64,11 @@ def test_permutation_wrong_backend(caplog): @pytest.mark.skip( reason="Unreliable. It passes most of the times with the timeout of 1 second for the current circuits used" ) -def test_permutation_exceed_timeout(random_circuit_transpiled, backend, caplog): +def test_permutation_exceed_timeout(random_circuit_transpiled, backend_27q, caplog): ai_optimize_perm = PassManager( [ CollectPermutations(min_block_size=2, max_block_size=27), - AIPermutationSynthesis(backend_name=backend, timeout=1), + AIPermutationSynthesis(backend_name=backend_27q, timeout=1), ] ) ai_optimized_circuit = ai_optimize_perm.run(random_circuit_transpiled) @@ -80,11 +80,11 @@ def test_permutation_exceed_timeout(random_circuit_transpiled, backend, caplog): @pytest.mark.skip( reason="Unreliable many times. We'll research why it fails sporadically" ) -def test_permutation_wrong_token(random_circuit_transpiled, backend, caplog): +def test_permutation_wrong_token(random_circuit_transpiled, backend_27q, caplog): ai_optimize_perm = PassManager( [ CollectPermutations(min_block_size=2, max_block_size=27), - AIPermutationSynthesis(backend_name=backend, token="invented_token_2"), + AIPermutationSynthesis(backend_name=backend_27q, token="invented_token_2"), ] ) ai_optimized_circuit = ai_optimize_perm.run(random_circuit_transpiled) @@ -96,11 +96,13 @@ def test_permutation_wrong_token(random_circuit_transpiled, backend, caplog): reason="Unreliable many times. We'll research why it fails sporadically" ) @pytest.mark.disable_monkeypatch -def test_permutation_wrong_url(random_circuit_transpiled, backend): +def test_permutation_wrong_url(random_circuit_transpiled, backend_27q): ai_optimize_perm = PassManager( [ CollectPermutations(min_block_size=2, max_block_size=27), - AIPermutationSynthesis(backend_name=backend, base_url="https://ibm.com/"), + AIPermutationSynthesis( + backend_name=backend_27q, base_url="https://ibm.com/" + ), ] ) try: @@ -115,12 +117,12 @@ def test_permutation_wrong_url(random_circuit_transpiled, backend): reason="Unreliable many times. We'll research why it fails sporadically" ) @pytest.mark.disable_monkeypatch -def test_permutation_unexisting_url(random_circuit_transpiled, backend, caplog): +def test_permutation_unexisting_url(random_circuit_transpiled, backend_27q, caplog): ai_optimize_perm = PassManager( [ CollectPermutations(min_block_size=2, max_block_size=27), AIPermutationSynthesis( - backend_name=backend, + backend_name=backend_27q, base_url="https://invented-domain-qiskit-transpiler-service-123.com/", ), ] @@ -135,9 +137,9 @@ def test_permutation_unexisting_url(random_circuit_transpiled, backend, caplog): assert isinstance(ai_optimized_circuit, QuantumCircuit) -def test_permutation_collector(permutations_circuit, backend, cmap_backend): +def test_permutation_collector(permutations_circuit, backend_27q, cmap_backend): qiskit_lvl3_transpiler = generate_preset_pass_manager( - optimization_level=1, coupling_map=cmap_backend[backend] + optimization_level=1, coupling_map=cmap_backend[backend_27q] ) permutations_circuit = qiskit_lvl3_transpiler.run(permutations_circuit) @@ -158,14 +160,14 @@ def test_permutation_collector(permutations_circuit, backend, cmap_backend): assert not dag.named_nodes("clifford", "Clifford") -def test_permutation_pass(permutations_circuit, backend, caplog): +def test_permutation_pass(permutations_circuit, backend_27q, caplog): ai_optimize_perm = PassManager( [ CollectPermutations(max_block_size=27), - AIPermutationSynthesis(backend_name=backend), + AIPermutationSynthesis(backend_name=backend_27q), ] ) ai_optimized_circuit = ai_optimize_perm.run(permutations_circuit) - assert "Using the synthesized circuit" in caplog.text + assert "Requesting synthesis to the service" in caplog.text assert isinstance(ai_optimized_circuit, QuantumCircuit) diff --git a/tests/ai/test_routing_ai.py b/tests/ai/test_routing_ai.py index 6f627bb..70fcd09 100644 --- a/tests/ai/test_routing_ai.py +++ b/tests/ai/test_routing_ai.py @@ -21,18 +21,18 @@ @pytest.mark.parametrize("optimization_level", [0, 4, 5]) -def test_qv_routing_wrong_opt_level(optimization_level, backend, qv_circ): +def test_qv_routing_wrong_opt_level(optimization_level, backend_27q, qv_circ): pm = PassManager( - [AIRouting(optimization_level=optimization_level, backend_name=backend)] + [AIRouting(optimization_level=optimization_level, backend_name=backend_27q)] ) with pytest.raises(TranspilerError): pm.run(qv_circ) @pytest.mark.parametrize("layout_mode", ["RECREATE", "BOOST"]) -def test_qv_routing_wrong_layout_mode(layout_mode, backend, qv_circ): +def test_qv_routing_wrong_layout_mode(layout_mode, backend_27q, qv_circ): with pytest.raises(ValueError): - PassManager([AIRouting(layout_mode=layout_mode, backend_name=backend)]) + PassManager([AIRouting(layout_mode=layout_mode, backend_name=backend_27q)]) def test_routing_wrong_backend(random_circuit_transpiled): @@ -53,20 +53,20 @@ def test_routing_wrong_backend(random_circuit_transpiled): @pytest.mark.skip( reason="Unreliable. It passes most of the times with the timeout of 1 second for the current circuits used" ) -def test_routing_exceed_timeout(qv_circ, backend): +def test_routing_exceed_timeout(qv_circ, backend_27q): ai_optimize_lf = PassManager( [ - AIRouting(backend_name=backend, timeout=1), + AIRouting(backend_name=backend_27q, timeout=1), ] ) ai_optimized_circuit = ai_optimize_lf.run(qv_circ) assert isinstance(ai_optimized_circuit, QuantumCircuit) -def test_routing_wrong_token(qv_circ, backend): +def test_routing_wrong_token(qv_circ, backend_27q): ai_optimize_lf = PassManager( [ - AIRouting(backend_name=backend, token="invented_token_2"), + AIRouting(backend_name=backend_27q, token="invented_token_2"), ] ) try: @@ -77,10 +77,10 @@ def test_routing_wrong_token(qv_circ, backend): @pytest.mark.disable_monkeypatch -def test_routing_wrong_url(qv_circ, backend): +def test_routing_wrong_url(qv_circ, backend_27q): ai_optimize_lf = PassManager( [ - AIRouting(backend_name=backend, base_url="https://ibm.com/"), + AIRouting(backend_name=backend_27q, base_url="https://ibm.com/"), ] ) try: @@ -92,11 +92,11 @@ def test_routing_wrong_url(qv_circ, backend): @pytest.mark.disable_monkeypatch -def test_routing_unexisting_url(qv_circ, backend): +def test_routing_unexisting_url(qv_circ, backend_27q): ai_optimize_lf = PassManager( [ AIRouting( - backend_name=backend, + backend_name=backend_27q, base_url="https://invented-domain-qiskit-transpiler-service-123.com/", ), ] @@ -115,13 +115,13 @@ def test_routing_unexisting_url(qv_circ, backend): @pytest.mark.parametrize("layout_mode", ["KEEP", "OPTIMIZE", "IMPROVE"]) @pytest.mark.parametrize("optimization_level", [1, 2, 3]) -def test_qv_routing(optimization_level, layout_mode, backend, qv_circ): +def test_qv_routing(optimization_level, layout_mode, backend_27q, qv_circ): pm = PassManager( [ AIRouting( optimization_level=optimization_level, layout_mode=layout_mode, - backend_name=backend, + backend_name=backend_27q, ) ] ) diff --git a/tests/conftest.py b/tests/conftest.py index 84b58cd..1962514 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -13,6 +13,7 @@ import pytest from qiskit.transpiler.coupling import CouplingMap +from qiskit_ibm_runtime.fake_provider import FakeQuebec @pytest.fixture(autouse=True) @@ -42,14 +43,19 @@ def env_set(monkeypatch, request): @pytest.fixture(scope="module") -def backend(): - return "ibm_cairo" +def backend_27q(): + return "ibm_peekskill" + + +@pytest.fixture(scope="module") +def coupling_map(): + return FakeQuebec().coupling_map @pytest.fixture(scope="module") def cmap_backend(): return { - "ibm_cairo": CouplingMap( + "ibm_peekskill": CouplingMap( [ [0, 1], [1, 0], @@ -108,5 +114,153 @@ def cmap_backend(): [25, 26], [26, 25], ] - ) + ), + "ibm_quebec": CouplingMap( + [ + [1, 0], + [2, 1], + [3, 2], + [3, 4], + [4, 15], + [5, 4], + [5, 6], + [6, 7], + [7, 8], + [8, 16], + [9, 8], + [9, 10], + [11, 10], + [11, 12], + [13, 12], + [14, 0], + [14, 18], + [16, 26], + [17, 12], + [19, 18], + [19, 20], + [20, 33], + [21, 20], + [21, 22], + [22, 15], + [23, 22], + [24, 23], + [25, 24], + [26, 25], + [26, 27], + [28, 27], + [28, 35], + [29, 28], + [30, 17], + [30, 29], + [31, 30], + [31, 32], + [34, 24], + [34, 43], + [35, 47], + [36, 32], + [38, 37], + [38, 39], + [39, 33], + [39, 40], + [40, 41], + [41, 42], + [43, 42], + [43, 44], + [44, 45], + [46, 45], + [47, 46], + [48, 47], + [48, 49], + [50, 49], + [51, 36], + [51, 50], + [52, 37], + [52, 56], + [53, 41], + [53, 60], + [54, 45], + [54, 64], + [55, 49], + [55, 68], + [57, 56], + [58, 57], + [58, 59], + [59, 60], + [60, 61], + [62, 61], + [62, 63], + [62, 72], + [64, 63], + [65, 64], + [65, 66], + [66, 67], + [66, 73], + [68, 67], + [69, 68], + [70, 69], + [70, 74], + [71, 58], + [71, 77], + [74, 89], + [75, 76], + [76, 77], + [77, 78], + [79, 78], + [80, 79], + [80, 81], + [81, 72], + [82, 81], + [82, 83], + [83, 84], + [85, 73], + [85, 84], + [85, 86], + [86, 87], + [87, 88], + [87, 93], + [89, 88], + [90, 75], + [91, 79], + [91, 98], + [92, 83], + [94, 90], + [94, 95], + [96, 95], + [96, 109], + [97, 96], + [97, 98], + [98, 99], + [100, 99], + [100, 110], + [101, 100], + [101, 102], + [102, 92], + [103, 102], + [103, 104], + [104, 105], + [106, 93], + [106, 105], + [106, 107], + [108, 107], + [108, 112], + [109, 114], + [110, 118], + [111, 104], + [114, 113], + [115, 114], + [115, 116], + [116, 117], + [118, 117], + [118, 119], + [120, 119], + [121, 120], + [122, 111], + [122, 121], + [123, 122], + [123, 124], + [124, 125], + [126, 112], + [126, 125], + ] + ), } diff --git a/tests/test_transpiler_service.py b/tests/test_transpiler_service.py index 118117a..255dbe7 100644 --- a/tests/test_transpiler_service.py +++ b/tests/test_transpiler_service.py @@ -291,7 +291,7 @@ def test_transpile_malformed_body(): except Exception as e: assert ( str(e) - == "\"transpile() got an unexpected keyword argument 'failing_option'\"" + == "\"Error transpiling with Qiskit and qiskit_transpile_options: transpile() got an unexpected keyword argument 'failing_option'\"" ) @@ -381,20 +381,20 @@ def transpile_and_check_layout(cmap, circuit): compare_layouts(plugin_circ, non_ai_circ) -def test_layout_construction_no_service(backend, cmap_backend): +def test_layout_construction_no_service(backend_27q, cmap_backend): for n_qubits in [5, 10, 15, 20, 27]: circuit = random_circuit(n_qubits, 4, measure=True) - transpile_and_check_layout(cmap_backend[backend], circuit) + transpile_and_check_layout(cmap_backend[backend_27q], circuit) for n_qubits in [5, 10, 15, 20, 27]: circuit = EfficientSU2(n_qubits, entanglement="circular", reps=1).decompose() - transpile_and_check_layout(cmap_backend[backend], circuit) + transpile_and_check_layout(cmap_backend[backend_27q], circuit) for n_qubits in [5, 10, 15, 20, 27]: circuit = QuantumCircuit(n_qubits) circuit.cx(0, 1) circuit.cx(1, 2) circuit.h(4) - transpile_and_check_layout(cmap_backend[backend], circuit) + transpile_and_check_layout(cmap_backend[backend_27q], circuit) def test_fix_ecr_qasm2():