-
Notifications
You must be signed in to change notification settings - Fork 22
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
run_batch
method for IBMBackendWrapper
class
#246
Conversation
@TheGupta2012 These changes seem good so far! For next steps, we look like to make sure that the propagation of the run_batch method to the |
Hi @ryanhill1 , I have added the necessary changes to the IBMResultWrapper and the general ResultWrapper class along with the relevant unit tests. Also, the I tested these changes using the dummy job ids instead of calling the I also saw that the CI pipeline skips the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates! I looked into it, and you are correct that there is an authentication issue with the API. It seems that the init_job
route was not yet added to list of routes that accepts the api-key. So we are making that update now it should be fixed within the next day!
I ran your new device tests with the API updates and typing fixes locally and got errors on the following two tests:
FAILED qbraid/devices/tests/test_devices.py::test_cancel_completed_batch_error[ibm_q_simulator_statevector] - qiskit_ibm_provider.job.exceptions.IBMJobInvalidStateError: 'Job cannot be cancelled: \'409 Client Error: Conflict for url: https://...
FAILED qbraid/devices/tests/test_devices.py::test_result_wrapper_measurements[ibm_q_simulator_statevector] - qiskit_ibm_provider.job.exceptions.IBMJobFailureError: 'Job failed: Error preprocessing job. Try again or contact support.'
The first looks like an error where it tried to cancel a job that was already complete. We've added fixes for that, so if you pull the latest changes from main, that should be resolved. The second one, I'm not as sure about.
And to address you comment about the test_devices.py
being skipped: yes, you are correct. This is because those tests require IBM tokens, which we don't want to make visible through our GitHub actions. But eventually, we do want to be able to run IBM device tests without the need for extra tokens. One of the ways to do that is via local simulators and/or mock devices. Adding this would also speed up the runtime of these tests by a lot, because we wouldn't have to wait in the queue for jobs to finish just to run tests. If you're interested, you can take a look at #251, but it's definitely not required.
I will be back in touch with you about the api-token authentication within the next day or so, and hopefully have an answer for the init_jobs data array vs number types as well! Thanks for your patience while we make these API updates.
Hi, thanks for the reply @ryanhill1! I merged the FAILED qbraid/devices/tests/test_results.py::test_result_wrapper_measurements[ibm_q_simulator_statevector] - qbraid.api.exceptions.RequestsApiError: HTTPSConnectionPool(host='api.qbraid.com', port=443): Max retries exceeded with url: /api/init-job
FAILED qbraid/devices/tests/test_results.py::test_result_wrapper_batch_measurements[ibm_q_qasm_simulator] - qbraid.api.exceptions.RequestsApiError: HTTPSConnectionPool(host='api.qbraid.com', port=443): Max retries exceeded with url: /api/init-job
FAILED qbraid/devices/tests/test_results.py::test_result_wrapper_batch_measurements[ibm_q_simulator_statevector] - qbraid.api.exceptions.RequestsApiError: HTTPSConnectionPool(host='api.qbraid.com', port=443): Max retries exceeded with url: /api/init-job When I tried to run these tests with dummy job IDs and did not use Being not entirely sure about this error, I have added a |
@TheGupta2012 a few updates!
init_data["email"] = os.getenv("JUPYTERHUB_USER") This environment variable is present on qBraid Lab by default, but if it is not present on your local computer, that could be causing issues. You can actually replace it with this: init_data["email"] = session.user_email from the
Let me know if the update and changes I suggested fix any of the API issues! And thanks for your patience as we've made these API fixes :) |
Hi @ryanhill1 , the changes on the API side seem to be working well! I was able to successfully use the To address your question about the fields, I think one field per circuit property would be a cleaner way to implement it as we will have two fewer fields in the json to worry about :) You'll be happy to know that the failing tests have passed! Let me know if you have any problems running the tests after my latest commit. Besides that, I think the mock provider implementation would take some time so I've retained the Thanks a lot for catering to the API changes and all the helpful suggestions! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just two very minor fixes to make sure tests pass/run once merged, and then we should be good to go!
Changes:
Fixes #231
Adds a new method
run_batch
to theIBMBackendWrapper
class and updates theinit_job
method inqbraid/api/job_api.py
Details or comments:
The
run_batch
method has almost similar logic as therun
method, just extended to a list.Moreover, the
init_job
method now accepts a list of circuits. The major change is in thecircuitDepth
andcircuitNumQubits
parameters of the request body. The values are now a list instead of an int.I wanted to first confirm if this change in
init_body
is not a breaking change for posting requests to the qBraid platform.Checklist before merge
init_job
breaking? Not really, needed to add different fieldsGeneral
I have read the CONTRIBUTING doc.
ALL new features must include unit test to the test directory, codecov will check for any missing test code exist.
Ensure that all the test passes.