简体   繁体   English

azure function python - Blob 触发和超时

[英]azure function python - Blob Trigger and Timeout

I am working with Azure Function 2.0 , Python 3.7 Runtime and Azure Function Tools 2.0 . I am working with Azure Function 2.0 , Python 3.7 Runtime and Azure Function Tools 2.0 .

  • I have a simple blob trigger based functions that read a file containing different urls (www.xxx.com/any,...) and scrape them using library requests and beautifulsoup4我有一个简单的基于 blob 触发器的函数,它读取包含不同 url (www.xxx.com/any,...) 的文件并使用库请求beautifulsoup4抓取它们
  • The app service plan is not "shared" is based on a specific App Service Plan .应用服务计划不是“共享”的,而是基于特定的应用服务计划
  • The overall timeout is set as 15 minutes (in hosts.json file).总超时设置为15 分钟(在 hosts.json 文件中)。

Sometime the action of scrapin an url takes long time and I have found this bad behavior.有时刮擦 url 的动作需要很长时间,我发现了这种不良行为。

  1. The function go into timeout with the blob XXXX function go 进入超时与blob XXXX
  2. The function continue is invoked again for the blob XXXX, it seems the previous run was unsuccessfull and the runtime re-execute the function.再次为 blob XXXX 调用 function continue,似乎之前的运行不成功,运行时重新执行 function。

Questions: - How can i specify that a blob con trigger only one function execution?问题: - 我如何指定一个 blob con 仅触发一次 function 执行? I would like to rewrite an external check.我想重写外部检查。 - Do you have suggestion to limit timeouts for requests in a python function? - 您是否建议限制 python function 中的请求超时? I have tried the standard timeout and eventlet.Timout without success.我已经尝试了标准超时和 eventlet.Timout 没有成功。

Thanks Ra谢谢拉

BlobTrigger will run for all blobs that dont have a reciept. BlobTrigger 将为所有没有收据的 blob 运行。 There are an issue on github regarding this topic but regarding timestamps on a blob and not quite what you are after. github 上有一个关于这个主题的问题,但是关于 blob 上的时间戳,而不是你所追求的。

https://github.com/Azure/azure-webjobs-sdk/issues/1327 https://github.com/Azure/azure-webjobs-sdk/issues/1327

Regarding timeouts in function this is by design.关于 function 中的超时,这是设计使然。 You could check out durable functions.您可以检查持久功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM