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

Updated qemist_client monitor_problem_status args. #175

Merged
merged 2 commits into from
Jul 1, 2022
Merged
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
14 changes: 7 additions & 7 deletions tangelo/linq/qpu_connection/qemist_cloud_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"""

try:
import qemist_client as qclient
import qemist_client.util as qclient_util
except ModuleNotFoundError:
print("qemist_client python package not found (optional dependency for hardware experiment submission)")

Expand All @@ -45,7 +45,7 @@ def job_submit(circuit, n_shots, backend):
job_options = {'shots': n_shots, 'backend': backend}

# Submit the problem
qemist_cloud_job_id = qclient.util.solve_quantum_circuits_async(serialized_fragment=circuit_data,
qemist_cloud_job_id = qclient_util.solve_quantum_circuits_async(serialized_fragment=circuit_data,
serialized_solver=job_options)[0]
return qemist_cloud_job_id

Expand All @@ -60,7 +60,7 @@ def job_status(qemist_cloud_job_id):
Returns:
str: current status of the problem, as a string.
"""
res = qclient.util.get_problem_statuses(qemist_cloud_job_id)
res = qclient_util.get_problem_statuses(qemist_cloud_job_id)

return res

Expand All @@ -75,7 +75,7 @@ def job_cancel(qemist_cloud_job_id):
Returns:
dict: cancelled problems / subproblems.
"""
res = qclient.util.cancel_problems(qemist_cloud_job_id)
res = qclient_util.cancel_problems(qemist_cloud_job_id)
# TODO: If res is coming out as an error code, we should raise an error

return res
Expand All @@ -95,7 +95,7 @@ def job_result(qemist_cloud_job_id):
"""

try:
qclient.util.monitor_problem_status(problem_handle=qemist_cloud_job_id, verbose=False)
qclient_util.monitor_problem_status(problem_handles=[qemist_cloud_job_id], verbose=False)

except KeyboardInterrupt:
print(f"\nYour problem is still running with id {qemist_cloud_job_id}.\n")
Expand All @@ -117,7 +117,7 @@ def job_result(qemist_cloud_job_id):

# Once a result is available, retrieve it.
# If the util module is not found earlier, an error has been raised.
output = qclient.util.get_results(qemist_cloud_job_id)
output = qclient_util.get_results(qemist_cloud_job_id)

# Amazon Braket: parsing of output
freqs = output['results']['measurement_probabilities']
Expand Down Expand Up @@ -155,6 +155,6 @@ def job_estimate(circuit, n_shots, backend=None):
if backend:
job_options['backend'] = backend

price_estimate = qclient.util.check_qpu_cost(circuit_data, job_options)
price_estimate = qclient_util.check_qpu_cost(circuit_data, job_options)

return price_estimate