-
Notifications
You must be signed in to change notification settings - Fork 868
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
[BUG] Cannot connect to promptflow tracing during release deploy pipeline #3391
Comments
Hi @tyler-suard-parker , thanks for reaching out. According to your error message, seems there are two issues:
Maybe you need to ensure 1) your Azure web app has enough permission; 2) you have correctly installed pf in the compute. |
@zhengfeiwang Thank you for the response. I installed promptflow using Also I am able to log in using azure-cli, but only manually with the interactive web page. |
I have tried multiple ways around this, including exporting the binary directory holding pf to PATH, and this is still now working. Please advise on how to get this to work. |
I see line below from your error message:
So I think there is one powershell script executing The way you install prompt flow looks good to me, but not sure why your compute cannot find the binary. What |
@zhengfeiwang Thank you for your help. That is correct, I have one powershell script executing both az login and pf config set. That is good to know that I can modify the pf.yaml file directly, but that still does not help with getting promptflow tracing to run. Whenever I import promptflow tracing: from promptflow.tracing import start_trace for some reason it tries to run the "pf" command in the OS, and even though I installed PF twice already, I still get the bash error "file not found". Promptflow was installed in a virtual environment on the build computer, and then that virtual environment and working directory were zipped up and moved to the deployment computer, so that may have something to do with it. However, after deployment I can't modify the file system on that computer because it is read-only. |
Here is some more research I have done: the "pf" file has the path for an interpreter at the top:
It looks like that path was created on the build computer, but it did not change when the built package was moved to a different directory on the deployment computer. |
in that case, as I don't know how you deploy, you might need to make sure the installation happens in your deploy environment; and seems there is no action required from prompt flow for this issue, so I plan to close this issue - please let me know if you still have further questions regarding to this issue. |
No @zhengfeiwang, do not close this ticket. My issue is, why did your team write this program so that it forces users to authenticate using azure CLI, making it completely incompatible with other Azure products like WebApps? For every other Azure service, a user can connect by using environment variables. For Azure AI Search, CosmosDB, SQL, OpenAI, Blob Storage, and Cognitive Services, I can easily connect using environment variables and entering strings like API key, endpoint, etc. When your team wrote PromptFlow tracing, you decided to make the user login via azure CLI and then set the trace destination using another command line. That is impossible to do in an Azure web app, according to this post from a microsoft employee: https://learn.microsoft.com/en-us/answers/questions/430646/azure-cli-commands-from-within-the-webapp-web-api. |
@tyler-suard-parker regarding Azure Web App support, my comment in #3411 shall be enough, we'll track this as a potential feature. Concerning the "pf command not found" issue, prompt flow tracing uses a local service as OTLP collector, to invoke this service, it will internally execute command Additionally, I'd like to note that using Cosmos DB for trace persistence is associated with an Azure ML workspace or AI project. From your descriptions across various issues, it appears you're looking to store traces from a custom application hosted on an Azure Web App—a scenario we hadn't initially considered. While the Cosmos resource is currently free, future charges could pose a risk, which you should consider. At last, I think there is still a workaround for your problem: as prompt flow tracing follows Open Telemetry spec, you can absolutely write a custom exporter that logs traces to a Cosmos DB by yourself; this approach would eliminate the need to configure your deployment environment specifically for the "pf" command. In that case, how traces logged to Cosmos DB is all dependent on you, including the auth part - so I believe you can connect them easily like your prior experience. Please let me know if you need further assistance or have other questions. |
I was able to work around this issue by starting from this tutorial: https://github.com/microsoft/promptflow/tree/main/examples/tutorials/flow-deploy/azure-app-service , creating a new azure web app that uses a container for deployment instead of code, and then installing azure-cli and promptflow during the deployment process. Here is my dockerfile:
And here is how I modified the runit / run file:
|
Describe the bug
Promptflow tracing requires:
az login
pf config set trace.destination..... etc.
When I try to run this as part of my deployment automation workflow in Devops, I get this error every time:
2024-06-07T17:19:50.9316803Z ERROR: The command failed with an unexpected error. Here is the traceback:
2024-06-07T17:19:50.9352168Z ERROR: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /organizations/v2.0/.well-known/openid-configuration (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001E92283EE10>: Failed to establish a new connection: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions'))
2024-06-07T17:19:50.9353333Z Traceback (most recent call last):
2024-06-07T17:19:50.9353863Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\urllib3/connection.py", line 174, in _new_conn
2024-06-07T17:19:50.9354502Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\urllib3/util/connection.py", line 95, in create_connection
2024-06-07T17:19:50.9355180Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\urllib3/util/connection.py", line 85, in create_connection
2024-06-07T17:19:50.9355839Z PermissionError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions
2024-06-07T17:19:50.9356109Z
2024-06-07T17:19:50.9356463Z During handling of the above exception, another exception occurred:
2024-06-07T17:19:50.9357845Z
2024-06-07T17:19:50.9358145Z Traceback (most recent call last):
2024-06-07T17:19:50.9358642Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\urllib3/connectionpool.py", line 715, in urlopen
2024-06-07T17:19:50.9359316Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\urllib3/connectionpool.py", line 404, in _make_request
2024-06-07T17:19:50.9359956Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\urllib3/connectionpool.py", line 1058, in _validate_conn
2024-06-07T17:19:50.9360610Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\urllib3/connection.py", line 363, in connect
2024-06-07T17:19:50.9361281Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\urllib3/connection.py", line 186, in _new_conn
2024-06-07T17:19:50.9362096Z urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x000001E92283EE10>: Failed to establish a new connection: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions
2024-06-07T17:19:50.9362612Z
2024-06-07T17:19:50.9362938Z During handling of the above exception, another exception occurred:
2024-06-07T17:19:50.9363167Z
2024-06-07T17:19:50.9363427Z Traceback (most recent call last):
2024-06-07T17:19:50.9363909Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\requests/adapters.py", line 486, in send
2024-06-07T17:19:50.9364541Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\urllib3/connectionpool.py", line 827, in urlopen
2024-06-07T17:19:50.9365184Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\urllib3/connectionpool.py", line 799, in urlopen
2024-06-07T17:19:50.9365820Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\urllib3/util/retry.py", line 592, in increment
2024-06-07T17:19:50.9366983Z urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /organizations/v2.0/.well-known/openid-configuration (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001E92283EE10>: Failed to establish a new connection: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions'))
2024-06-07T17:19:50.9367764Z
2024-06-07T17:19:50.9368136Z During handling of the above exception, another exception occurred:
2024-06-07T17:19:50.9368337Z
2024-06-07T17:19:50.9368572Z Traceback (most recent call last):
2024-06-07T17:19:50.9368849Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
2024-06-07T17:19:50.9369231Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 664, in execute
2024-06-07T17:19:50.9369645Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 731, in _run_jobs_serially
2024-06-07T17:19:50.9370051Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 701, in _run_job
2024-06-07T17:19:50.9370453Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 334, in call
2024-06-07T17:19:50.9370864Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
2024-06-07T17:19:50.9371262Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/profile/custom.py", line 139, in login
2024-06-07T17:19:50.9371654Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/_profile.py", line 154, in login
2024-06-07T17:19:50.9372052Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/auth/identity.py", line 160, in login_with_auth_code
2024-06-07T17:19:50.9373083Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/auth/identity.py", line 119, in _msal_app
2024-06-07T17:19:50.9373474Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/application.py", line 1814, in init
2024-06-07T17:19:50.9373848Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/application.py", line 504, in init
2024-06-07T17:19:50.9374201Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/authority.py", line 115, in init
2024-06-07T17:19:50.9374582Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/authority.py", line 182, in tenant_discovery
2024-06-07T17:19:50.9374964Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/individual_cache.py", line 269, in wrapper
2024-06-07T17:19:50.9375325Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\requests/sessions.py", line 602, in get
2024-06-07T17:19:50.9375693Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\requests/sessions.py", line 589, in request
2024-06-07T17:19:50.9376061Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\requests/sessions.py", line 703, in send
2024-06-07T17:19:50.9376405Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\requests/adapters.py", line 519, in send
2024-06-07T17:19:50.9377099Z requests.exceptions.ConnectionError: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /organizations/v2.0/.well-known/openid-configuration (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001E92283EE10>: Failed to establish a new connection: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions'))
2024-06-07T17:19:50.9385986Z To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
2024-06-07T17:19:51.5542663Z pf : The term 'pf' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
2024-06-07T17:19:51.5543369Z spelling of the name, or if a path was included, verify that the path is correct and try again.
2024-06-07T17:19:51.5543918Z At D:\AzureDevOps\Agents\A2_work_temp\61376baa-b908-4c17-ad64-dc2bcd9fd926.ps1:5 char:1
2024-06-07T17:19:51.5544302Z + pf config set trace.destination="azureml://subscriptions/a06dfadd-e31 ...
2024-06-07T17:19:51.5544642Z + ~~
2024-06-07T17:19:51.5545002Z + CategoryInfo : ObjectNotFound: (pf:String) [], ParentContainsErrorRecordException
2024-06-07T17:19:51.5545404Z + FullyQualifiedErrorId : CommandNotFoundException
2024-06-07T17:19:51.5546027Z
2024-06-07T17:19:51.5757871Z ##[debug]Exit code: 1
2024-06-07T17:19:51.5797694Z ##[debug]Leaving Invoke-VstsTool.
2024-06-07T17:19:51.6194256Z ##[error]PowerShell exited with code '1'.
2024-06-07T17:19:51.6201865Z ##[debug]Processed: ##vso[task.logissue type=error;source=TaskInternal]PowerShell exited with code '1'.
2024-06-07T17:19:51.6315367Z ##[debug]Processed: ##vso[task.complete result=Failed]Error detected
2024-06-07T17:19:51.6337231Z ##[debug]Leaving D:\AzureDevOps\Agents\A2_work_tasks\PowerShell_e213ff0f-5d5c-4791-802d-52ea3e7be1f1\2.239.1\powershell.ps1.
2024-06-07T17:19:51.6615458Z ##[section]Finishing: PowerShell Script
How To Reproduce the bug
Steps to reproduce the behavior, how frequent can you experience the bug:
The text was updated successfully, but these errors were encountered: