diff --git a/src/data/azure_function_timer/.gitignore b/src/data/azure_function_timer/.gitignore index 074596c..d7a8ad9 100644 --- a/src/data/azure_function_timer/.gitignore +++ b/src/data/azure_function_timer/.gitignore @@ -3,3 +3,4 @@ bin include lib lib64 +local.settings.json diff --git a/src/data/azure_function_timer/.vscode/extensions.json b/src/data/azure_function_timer/.vscode/extensions.json new file mode 100644 index 0000000..dde673d --- /dev/null +++ b/src/data/azure_function_timer/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "ms-azuretools.vscode-azurefunctions" + ] +} \ No newline at end of file diff --git a/src/data/azure_function_timer/deploy.sh b/src/data/azure_function_timer/deploy.sh new file mode 100755 index 0000000..321a78c --- /dev/null +++ b/src/data/azure_function_timer/deploy.sh @@ -0,0 +1,2 @@ +#!/bin/sh +func azure functionapp publish cron-map-scrape diff --git a/src/data/azure_function_timer/function_app.py b/src/data/azure_function_timer/function_app.py new file mode 100644 index 0000000..8d37854 --- /dev/null +++ b/src/data/azure_function_timer/function_app.py @@ -0,0 +1,16 @@ +import azure.functions as func +import datetime +import json +import logging + +app = func.FunctionApp() + + +@app.timer_trigger( + schedule="* * * * * *", arg_name="myTimer", run_on_startup=False, use_monitor=False +) +def Timer(myTimer: func.TimerRequest) -> None: + if myTimer.past_due: + logging.info("The timer is past due!") + + logging.info("Python timer trigger function executed.") diff --git a/src/data/azure_function_timer/host.json b/src/data/azure_function_timer/host.json new file mode 100644 index 0000000..9df9136 --- /dev/null +++ b/src/data/azure_function_timer/host.json @@ -0,0 +1,15 @@ +{ + "version": "2.0", + "logging": { + "applicationInsights": { + "samplingSettings": { + "isEnabled": true, + "excludedTypes": "Request" + } + } + }, + "extensionBundle": { + "id": "Microsoft.Azure.Functions.ExtensionBundle", + "version": "[4.*, 5.0.0)" + } +} \ No newline at end of file diff --git a/src/data/azure_function_timer/requirements.txt b/src/data/azure_function_timer/requirements.txt new file mode 100644 index 0000000..c403baf --- /dev/null +++ b/src/data/azure_function_timer/requirements.txt @@ -0,0 +1,5 @@ +# Do not include azure-functions-worker in this file +# The Python Worker is managed by the Azure Functions platform +# Manually managing azure-functions-worker may cause unexpected issues + +azure-functions \ No newline at end of file