diff --git a/monitoring_weekly/__init__.py b/monitoring_weekly/__init__.py index 5b4af35..d472c5a 100644 --- a/monitoring_weekly/__init__.py +++ b/monitoring_weekly/__init__.py @@ -6,13 +6,21 @@ import importlib.util # Azure function timer. To alter timer cadence see function.json file +app = func.FunctionApp() + +@app.function_name(name="mytimer") +@app.schedule(schedule="0 5 * * MON", + arg_name="mytimer", + run_on_startup=False, + use_monitor=True) + 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) diff --git a/monitoring_weekly/function.json b/monitoring_weekly/function.json deleted file mode 100644 index 55fd7cd..0000000 --- a/monitoring_weekly/function.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "scriptFile": "__init__.py", - "bindings": [ - { - "name": "mytimer", - "type": "timerTrigger", - "useMonitor": true, - "runOnStartup": false, - "direction": "in", - "schedule": "0 5 * * MON" - } - ], - "disabled": false - } \ No newline at end of file