Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up messy duplicated functions with single cron expression #3

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion commands.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# Azure Function Core Tools

```bash
npm i -g azure-functions-core-tools@4 --unsafe-perm true
```

# Deploy

```bash
func azure functionapp publish daily-traffic-function
func azure functionapp publish daily-traffic-function --python
```

# Init function
Expand Down
35 changes: 4 additions & 31 deletions function_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,11 @@ def manual_run(req: func.HttpRequest) -> func.HttpResponse:
traffic_report(2532, debug=True)
return func.HttpResponse("Finished checking traffic")

@app.function_name(name="timertrigger730")
@app.schedule(schedule="30 14 * * 1-5",
arg_name="timertrigger730",
@app.function_name(name="timertrigger")
@app.schedule(schedule="0 30,45 14,23 * * 1-5",
arg_name="timertrigger",
run_on_startup=False)
def timer_trigger_730(timertrigger730: func.TimerRequest) -> None:
traffic_report(2530)
traffic_report(2532)


@app.function_name(name="timertrigger745")
@app.schedule(schedule="45 14 * * 1-5",
arg_name="timertrigger745",
run_on_startup=False)
def timer_trigger_745(timertrigger745: func.TimerRequest) -> None:
traffic_report(2530)
traffic_report(2532)


@app.function_name(name="timertrigger430")
@app.schedule(schedule="30 23 * * 1-5",
arg_name="timertrigger430",
run_on_startup=False)
def timer_trigger_430(timertrigger430: func.TimerRequest) -> None:
traffic_report(2530)
traffic_report(2532)


@app.function_name(name="timertrigger445")
@app.schedule(schedule="45 23 * * 1-5",
arg_name="timertrigger445",
run_on_startup=False)
def timer_trigger_445(timertrigger445: func.TimerRequest) -> None:
def timer_trigger(timertrigger: func.TimerRequest) -> None:
traffic_report(2530)
traffic_report(2532)

Expand Down