python - 多个 Azure Web 作业

标签 python azure azure-webjobs azure-webjobs-triggered

我有一个 Azure 应用程序,我在其中托管 Web 作业。

每当我启动应用程序时,它只需 1 个 Webjob 就可以正常运行,并且一切正常。但随着时间的推移,突然出现了另一个 webjob,它是所需 webjob 的精确副本。

所以问题是,当未编码此功能时,会生成另一个 Webjob(不需要的)。

请参见图 1(必需/如开始时所示):

Please see Pic 1 (Required/ As is on Start)

请参见图 2(不需要/一段时间后发生):

Please see Pic 2 (Unwanted/ Happens After some time)

这是一个触发的网络作业,其 cron 计划为 * * * * * *

最佳答案

So the problem is that another webjob (unwanted) is spawned when this functionality is not coded in.

我认为您的情况是由于执行时间段造成的。请检查doc中的以下声明:

In Azure environment, the scheduled webjob will only run on one instance (or worker). This is achieved by using file lock mechanism while the webjob is running. If the webjob happens to run for a very short time, there could be a race condition (such as clock sku) to cause another instance to later start up on the same schedule (since it detects no lock). The workaround is to make sure the webjob run for a certain period of time (say at least 5 seconds assuming schedule interval is greater).

另外,还有一个类似的案例供大家引用:Does Azure start up another instance of a scheduled web job if it is already running?

关于python - 多个 Azure Web 作业,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52373092/

相关文章:

python - 表示 pandas Dataframe 列中的比率

python - Python:响应命令行提示符

python - 无法使用 Python 将数据追加到 Azure 存储中

azure - 我是 Azure ARM 模板的初学者。我需要学习 ARM

azure - 部署 Azure Web 作业

python - 为什么这个数据集实现会耗尽内存?

javascript - 将数据从 Jinja 传回 Flask

c# - Azure数据湖授权

azure - 如何通过 VSTS 将 Azure WebJob 和应用程序部署到同一应用程序服务?

Azure Function App无法将表绑定(bind)到类型 'Microsoft.WindowsAzure.Storage.Table.CloudTable'