From 17548fec1233d3d51d58c13c70e247f036f4d765 Mon Sep 17 00:00:00 2001 From: Pagwin Date: Wed, 5 Feb 2025 14:30:34 -0500 Subject: [PATCH] e --- src/data/azure_function_timer/.gitignore | 1 + .../azure_function_timer/.vscode/extensions.json | 5 +++++ src/data/azure_function_timer/deploy.sh | 2 ++ src/data/azure_function_timer/function_app.py | 16 ++++++++++++++++ src/data/azure_function_timer/host.json | 15 +++++++++++++++ src/data/azure_function_timer/requirements.txt | 5 +++++ 6 files changed, 44 insertions(+) create mode 100644 src/data/azure_function_timer/.vscode/extensions.json create mode 100755 src/data/azure_function_timer/deploy.sh create mode 100644 src/data/azure_function_timer/function_app.py create mode 100644 src/data/azure_function_timer/host.json create mode 100644 src/data/azure_function_timer/requirements.txt 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