You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

已禁用的Azure Function仍持续执行且多次触发问题求助

问题:禁用后的Azure Timer函数仍持续执行且无监控记录

我有一个名为weekly_monitoring的Azure Function,配置为每周执行多个Python脚本。但该函数已通过Azure UI及trigger的function.json文件禁用后,仍持续执行且连续多次触发。此外,Azure Function Monitor显示无任何执行活动记录。

相关代码

init.py

import azure.functions as func
import os
import datetime
import logging
import sys
import importlib.util

# Azure function timer. To alter timer cadence see function.json file
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)


def run_script(script_name):
    script_path = os.path.join(os.path.dirname(__file__), f'{script_name}')

    s = importlib.util.spec_from_file_location(script_name, script_path)
    m = importlib.util.module_from_spec(s)
    sys.modules[s.name] = m
    s.loader.exec_module(m)

    
def batch_execution(file_list):

     exceptions = [] #store errors

     for file in file_list:
         try:
             run_script(file)
         except Exception as e:
             exceptions.append(e)
         else: 
             print('Success')

     return exceptions

# list of scripts running in function, if adding new script add to list.
 file_list = ['file_one.py',
         'file_two.py',
         'file_three.py',
         'file_four.py',
         'file_five.py']

batch_execution(file_list)

function.json

{
    "scriptFile": "__init__.py",
    "bindings": [
      {
        "name": "mytimer",
        "type": "timerTrigger",
        "useMonitor": true,
        "runOnStartup": false,
        "direction": "in",
        "schedule": "0 5 * * MON"
      }
    ],
    "disabled": true
  }

相关截图说明

  • 截图1:Azure UI界面显示该weekly_monitoring函数已被禁用
  • 截图2:Azure Monitor记录显示今日该函数已执行5次

内容的提问来源于stack exchange,提问作者Mitchell.Laferla

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.12 19:40:30