Azure函数Timetrigger在门户中不存在
我有一个在Linux系统中运行的Azure函数应用程序。在其中,我创建了两个函数,一个功能是由斑点触发器触发的,另一个由Timetrigger触发。
两个功能都使用Azure DevOps部署,但是当我进入Portal时,Timetrigger函数不存在。
要部署函数,我将代码在git存储库中,并将其复制到.zip文件夹以构建工件。一旦构建了工件,就可以将其部署到使用Azure CLI功能应用程序。
:
函数
{
"schedule": "0 30 14 * * *",
"name": "myTimer",
"type": "timerTrigger",
"direction": "in",
"runOnStartup": false
}
。
{
"version": "2.0",
"logging": {
"fileLoggingMode": "always",
"applicationInsights": {
"samplingSettings": {
"isEnabled": true
}
}
},
"extensions": {
"queues": {
"maxPollingInterval": "00:00:02",
"visibilityTimeout" : "00:00:30",
"batchSize": 8,
"maxDequeueCount": 5,
"newBatchThreshold": 4,
"messageEncoding": "base64"
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.3.0, 4.0.0)"
},
"functionTimeout": "-1",
"retry": {
"strategy": "fixedDelay",
"maxRetryCount": 0,
"delayInterval": "00:00:05"
}
}
import datetime
import logging
import azure.functions as func
def main(mytimer: func.TimerRequest) -> None:
utc_timestamp = datetime.datetime.utcnow().replace(
tzinfo=datetime.timezone.utc).isoformat()
if mytimer.past_due:
logging.info('The timer is past due!')
logging.info('Python timer trigger function ran at %s', utc_timestamp)
代码 我配置了错误的函数。正确的内容是:
{
"bindings": [
{
"schedule": "0 30 14 * * *",
"name": "myTimer",
"type": "timerTrigger",
"direction": "in",
"runOnStartup": false
}
],
"disabled": false,
"scriptFile": "__init__.py"
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
感谢您确认 @vll1990,
将解决方案发布为答案,这将对其他成员的类似问题有益,以便他们可以找到并解决其问题。
我们尝试使用计时器触发器创建Python Azure函数,并将其弄清楚为您需要以下面的格式使用
function.json
文件。您正在使用的
function.json
是:我们需要在我们的
.json
文件中添加值之前,需要指定bindings
。例如: -
,然后在部署后,我们将能够在门户网站本身的函数应用中查看计时器函数。
有关更多信息,请参阅此 Microsoft文档 | azure函数的计时器触发 。
Thanks for confirming @vll1990,
Posting the solution as an answer This will be beneficial for other members for the similar issue so that they can find and fix their issue.
We have tried to create a python azure function using timer trigger and figured out as you that we need to have our
function.json
file in below format.The
function.json
that you are using is:Instead of that We need to specify the
bindings
before adding the value in our.json
file .For example:-
And then after deploy we will be able to see the timer function in our function app on Portal itself.
For more information please refer this MICROSOFT DOCUMENT| Timer trigger for Azure Functions.