Users that are involved in multiple projects may have different tokens available for use. For users with a local install of the Ocean™ SDK, we can update the configuration file to save multiple tokens.
Adding a new token to your configuration file
- On your command line type “dwave config create”.
- You will be told that an existing configuration file was found and shown the path. Hit “Enter” to accept this default configuration file.
- Next you will be stepped through the following prompts.
- Profile: create a new profile or choose an existing one. Type a new name for your new token’s profile and hit enter.
- API endpoint URL: This will be the same URL you have used previously, and can be found on your Leap™ dashboard.
- Authentication token: Copy and paste your new API token into the next prompt and hit enter.
- Default client class: hit enter to skip.
- Default solver: hit enter to skip.
- Once you’ve completed all of the prompts you will see “Configuration saved.”
Testing your new configuration profile and token.
To test your new profile’s connection to the solvers you have access to, type “dwave ping -p” followed by the name of your new profile.
Example:
If I named my new profile my_new_profile in step 2a above, I would type “dwave ping -p my_new_profile” and hit enter.
Using your new configuration profile and token.
When you define a sampler in your Ocean program, you have the option to specify profile.
Example for the D-Wave™ QPU:
sampler = EmbeddingComposite(DWaveSampler({profile='my_new_profile'}))
Example for the Hybrid Solver Service:
sampler = LeapHybridSampler(profile='my_new_profile')
Comments
I followed the instructions described above, but I still can't use the new token/profile. The simulations use the default token even if in my python script I write:
qpu = DWaveSampler(profile='my_new_profile')
sampler = EmbeddingComposite(qpu)
Hi Cosmin - did you try using curly brackets as shown in the QPU example?
qpu = DWaveSampler({profile='my_new_profile'})
Please sign in to leave a comment.