-
Notifications
You must be signed in to change notification settings - Fork 27
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Implement IBMBackendWrapper.run_batch
method
#231
Comments
@ryanhill1 can I work on this issue too? |
@TheGupta2012 yep! |
Hi @ryanhill1, could you provide an example of how I can test this method? I am trying to use the following script to test but getting the below-mentioned error. Script :
Error :
|
@TheGupta2012 yes, it seems like you need to add your API credentials to populate your See instructions in README local account setup |
Hi @ryanhill1 , I am still experiencing the same error after setting up the API token. This was the script I was using -
I also tried running this after using |
@TheGupta2012 That's so weird! So just to confirm, it's failing on the Here are a couple tests to help debug and some troubleshooting tips:
>>> from qbraid.api.session import DEFAULT_CONFIG_PATH
>>> f = open(DEFAULT_CONFIG_PATH, 'r')
>>> print(f.read()) and let me know if that file is found, and if entries for both your user email and API key are listed. If your email is not contained in the file, try doing ...
>>> session = QbraidSession(user_email=YOUR_EMAIL, api_key=YOUR_KEY)
>>> session.save_config() and run the above again, and let me know if that output differs.
>>> import os
>>> os.getenv("JUPYTERHUB_USER")
>>> os.getenv("QBRAID_API_KEY") and make sure that you are getting values back for both. Usually, only the API key is necessary because the If you are not getting values back for both, (re)set both environment variables with the correct values, restart your terminal, and make sure that the commands above return the expected ouput. Once that's working, please run >>> from qbraid.api import QbraidSession
>>> session = QbraidSession() # no args
>>> session.user_email
>>> session.api_key
>>> session.get('/identity') If the environment variables were set correctly, you should get values back for both the
|
Hey @ryanhill1 , this is the output of the following code - >>> from qbraid.api import QbraidSession
>>> session = QbraidSession() # no args
>>> session.user_email
>>> session.api_key
>>> session.get('/identity') In [2]: session.user_email
Out[2]: 'harshit.11235@gmail.com'
In [3]: session.api_key
Out[3]: 'py5vkypsvd'
In [4]: session.get('/identity')
Out[4]: <Response [200]> It seems that the configuration files are set up correctly. I still continue to get the error that I mentioned. I even tried with the from qbraid.api import QbraidSession
from qbraid import device_wrapper
from qbraid.interface import random_circuit
circuit = random_circuit("qiskit", num_qubits=1, measure=True)
# circ_batch = [circuit]
session = QbraidSession()
qdevice = device_wrapper("ibm_q_qasm_simulator")
qjob = qdevice.run(run_input=circuit)
status = qjob.status() which resulted in the following exception -
Maybe there is some way I could test the changes you mentioned in the PR locally without hitting the API? |
Hi @TheGupta2012. If you push your changes and let me know which branch of your fork to test on, I can try to recreate the error. I'm guessing the request is being rejected by our API based on type mismatches e.g. getting lists when it expects objects. If you get me that info and I can test from your branch, then I can confirm if it is a compatibility issue with the API, and fix if necessary. In the meantime, yes, you can feel free to bypass the This hacky fix should work for creating the When you can, send me a link to your updated fork branch and I can try to make any necessary updates on the API side! |
Hi @ryanhill1 , I am using this branch to test my code. The script I am using is the following - Scriptfrom qbraid.api import QbraidSession
from qbraid import device_wrapper
from qbraid.interface import random_circuit
circuit = random_circuit("qiskit", num_qubits=1, measure=True)
circ_batch = [circuit, circuit, circuit]
qdevice = device_wrapper("ibm_q_qasm_simulator")
qjob = qdevice.run_batch(circ_batch)
status = qjob.status()
print(status) Errorqbraid.api.exceptions.RequestsApiError: 400 Client Error: Bad Request for url: https://api.qbraid.com/api/init-job. "If you don't specify an idToken, you must specify both an email and refreshToken" I also tried using the |
Sub-issue to #228: implement
IBMBackend
componentThe text was updated successfully, but these errors were encountered: