Skip to content

Commit c890e46

Browse files
[fix] [quera] Follow-up to PR#2528 which unintentionally broke the Python support (#2555)
* Restore the server helper library target. * Also, remove the redundant code for mock qpu which was not being used. Signed-off-by: Pradnya Khalate <[email protected]>
1 parent 4711146 commit c890e46

File tree

4 files changed

+14
-175
lines changed

4 files changed

+14
-175
lines changed

python/tests/backends/test_QuEra.py

+5-25
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,17 @@
1010
from cudaq.operator import *
1111
import json
1212
import numpy as np
13-
import os
1413
import pytest
15-
from multiprocessing import Process
16-
from network_utils import check_server_connection
17-
18-
try:
19-
from utils.mock_qpu.quera import startServer
20-
except:
21-
print("Mock qpu not available, skipping QuEra tests.")
22-
pytest.skip("Mock qpu not available.", allow_module_level=True)
23-
24-
# Define the port for the mock server
25-
port = 62444
2614

2715

2816
@pytest.fixture(scope="session", autouse=True)
29-
def startUpMockServer():
30-
# NOTE: Credentials can be set with AWS CLI
31-
cudaq.set_target('quera')
32-
# Launch the Mock Server
33-
p = Process(target=startServer, args=(port,))
34-
p.start()
35-
if not check_server_connection(port):
36-
p.terminate()
37-
pytest.exit("Mock server did not start in time, skipping tests.",
38-
returncode=1)
17+
def do_something():
18+
cudaq.set_target("quera")
3919
yield "Running the tests."
40-
p.terminate()
20+
cudaq.reset_target()
4121

4222

43-
@pytest.mark.skip(reason="Amazon Braket credentials required")
23+
@pytest.mark.skip(reason="Amazon Braket must be installed")
4424
def test_JSON_payload():
4525
'''
4626
Test based on https://docs.aws.amazon.com/braket/latest/developerguide/braket-quera-submitting-analog-program-aquila.html
@@ -88,7 +68,7 @@ def test_JSON_payload():
8868
json.dumps(input))
8969

9070

91-
@pytest.mark.skip(reason="Braket credentials required")
71+
@pytest.mark.skip(reason="Amazon Braket credentials required")
9272
def test_ahs_hello():
9373
'''
9474
Test based on

runtime/cudaq/platform/quera/CMakeLists.txt

+9
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,12 @@ target_link_libraries(${LIBRARY_NAME}
3131
install(TARGETS ${LIBRARY_NAME} DESTINATION lib)
3232

3333
add_target_config(quera)
34+
35+
add_library(cudaq-serverhelper-quera SHARED QuEraExecutor.cpp QuEraServerHelper.cpp)
36+
target_link_libraries(cudaq-serverhelper-quera
37+
PUBLIC
38+
cudaq-serverhelper-braket
39+
cudaq-common
40+
fmt::fmt-header-only
41+
)
42+
install(TARGETS cudaq-serverhelper-quera DESTINATION lib)

utils/mock_qpu/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@
1212
from .ionq import *
1313
from .iqm import *
1414
from .quantinuum import *
15-
from .quera import *

utils/mock_qpu/quera/__init__.py

-149
This file was deleted.

0 commit comments

Comments
 (0)