-
Notifications
You must be signed in to change notification settings - Fork 919
TimeoutError
but azure still connects?
#762
Comments
I repro'd in MyBinder, but I couldn't repro in local container when I pulled down the exact image and ran it locally. There seems to be something in MyBinder environment that is blocking Azure.Identity from finishing for nearly 5 mins. If you are using Azure CLI for the initial login on the terminal: Then I think bypassing all other auth methods that Azure.Identity package searches for and just setting CLI seemed to help it not get stuck for 5 mins: import qsharp.azure @ryanhill1 , can you see if setting credential="CLI" helps in your case? If it helps you as well, I can open a ticket with Azure.Identity to see if they can help get to bottom of it. As for why it appeared that TimeoutErrors were transient, it is that the Timeout errors were thrown by python interop's timeouts of 120 seconds and 240 seconds respectively, but the original auth call was still ongoing in the kernel (so underlying IQ# kernel was busy). Once auth finishes behind the scenes, then qsharp.azure.target went through on second retry. |
I can confirm that this works in less than 5 seconds on qBraid. Thank you for the workaround. @xinyi-joffre |
We discovered the issue has to do with ManagedIdentity credential time waiting for a long timeout if the ManagedIdentity endpoint doesn't exist in certain environments. This bug is tracked here for Azure.Identity: Outside of workaround above, you can also pass the same credential type argument for %azure.connect commands (which probably weren't timing out for you, but would have probably also taken a long time due to this issue: We are working on applying a fix for this in QDK, so no special credential type needs to be passed in the next version of QDK (either this month's release or next month's release)! We will close this issue once it is released. Thanks for raising this issue! |
@xinyi-joffre Thanks for your help and for your quick response! |
Describe the bug
Running the code samples from Quantum computing with Q# and Python raises multiple
TimeoutError
's, but if you ignore them and/or run commands multiple times, the program works.In my example below, the first
TimeoutError
occurs duringqsharp.azure.connect()
. If you ignore that error and then runqsharp.azure.target()
, you will get anotherTimeoutError
. But if you ignore that again and re-runqsharp.azure.target()
, it will go through, and in the end you will be able to execute your program.To Reproduce
Test.qs
test.py
in same directory$ python test.py
Expected behavior
Expect program to run smoothly without any
TimeoutError
Screenshots
Program output from Binder terminal:
System information
OS from Binder linked in README.
Additional context
TimeoutError
does not seem to occur when connecting to azure from Q# kernel, only from python.The text was updated successfully, but these errors were encountered: