成功使用OSError部署后,Azure功能失败:[Errno 107] [英] Azure function failing after successfull deployment with OSError: [Errno 107]
问题描述
该功能在上次部署之前有效.它用于NLC,我们正在为两种不同的语言运行两个函数.对于新部署,我们删除了一些仅用于一种语言的代码,并将其镜像为与另一种语言相同.Azure CLI告诉我们:
The function was working before the last deployment. It is used for NLC and we are running two functions for two different languages. For the new deployment we removed some code which was only used for one language and mirrored the code to be equal to the other language. Azure CLI tells us:
Upload completed successfully.
Deployment completed successfully.
但是随后尝试调用该函数时,它要么返回没有主体的500,要么返回带有以下内容的404:
But when trying to invoke the function afterwards it either returns 500 without a body or it returns 404 with:
<html>
<head>
<title>404 Not Found</title>
</head>
<body bgcolor="white">
<center>
<h1>404 Not Found</h1>
</center>
<hr>
<center>nginx</center>
</body>
</html>
The stacktrace we can see in the monitoring is the following:
Exception while executing function: Functions.classify Result: Failure
Exception: OSError: [Errno 107] Transport endpoint is not connected: '/home/site/wwwroot/.python_packages/lib/site-packages'
Stack: File "/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/dispatcher.py", line 271, in _handle__function_load_request
func = loader.load_function(
File "/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/utils/wrappers.py", line 32, in call
return func(*args, **kwargs)
File "/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/loader.py", line 76, in load_function
mod = importlib.import_module(fullmodname)
File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/site/wwwroot/classify/__init__.py", line 4, in <module>
File "/home/site/wwwroot/classify/predict.py", line 1, in <module>
File "/home/site/wwwroot/.python_packages/lib/site-packages/fastai/text/all.py", line 1, in <module>
File "/home/site/wwwroot/.python_packages/lib/site-packages/fastai/basics.py", line 1, in <module>
File "/home/site/wwwroot/.python_packages/lib/site-packages/fastai/data/all.py", line 1, in <module>
File "/home/site/wwwroot/.python_packages/lib/site-packages/fastai/torch_basics.py", line 1, in <module>
File "/home/site/wwwroot/.python_packages/lib/site-packages/torch/__init__.py", line 482, in <module>
File "/home/site/wwwroot/.python_packages/lib/site-packages/torch/serialization.py", line 8, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 971, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 914, in _find_spec
File "<frozen importlib._bootstrap_external>", line 1342, in find_spec
File "<frozen importlib._bootstrap_external>", line 1314, in _get_spec
File "<frozen importlib._bootstrap_external>", line 1443, in find_spec
File "<frozen importlib._bootstrap_external>", line 1483, in _fill_cache
用于部署的命令如下,以前曾工作过:
Commands used for deployment were the following, which worked before:
pip3 install --target="./.python_packages/lib/site-packages" -r requirements.txt
func azure functionapp publish [functionapp name] --no-build
- 删除python包并重建等.
- 我尝试从头开始创建一个新的功能应用程序,但显示出相同的错误.
- 我尝试从另一种语言的文件夹中部署,交换了一个文件(分类器语言模型),但是它显示相同的错误.我担心尝试重新部署工作语言用于测试,因为它正在工作,我不想杀死它.
推荐答案
似乎在模块导入期间发生.尽管我不确定它以前是如何工作的(如您所述),但我建议您不要手动进行 pip3安装
并删除-no-build
标志以使 func azure functionapp发布
It seems to be happening somewhere during module import. Though I am not sure how it was working before (as you mentioned), but I suggest you not to do pip3 install
manually and remove --no-build
flag to let the func azure functionapp publish
handle that. Just make sure you have the requirements.txt
in the root.
# no pip install manually
# without --no-build flag
func azure functionapp publish [functionapp name]
这篇关于成功使用OSError部署后,Azure功能失败:[Errno 107]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!