Skip to content

Commit 85635a4

Browse files
authored
Merge branch 'dev' into hallvictoria/exception-bug
2 parents bd949d3 + cd13c6a commit 85635a4

22 files changed

+398
-161
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

-100
This file was deleted.

.github/ISSUE_TEMPLATE/bug_report.yml

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Python Worker Bug Report
2+
description: File a bug report
3+
title: "[Bug] Bug Title Here"
4+
labels: ["python", "bug"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
This form will help you to fill in a bug report for the Azure Functions Python Worker.
10+
11+
- type: textarea
12+
id: expected-behavior
13+
attributes:
14+
label: Expected Behavior
15+
description: A clear and concise description of what you expected to happen.
16+
placeholder: What should have occurred?
17+
18+
- type: textarea
19+
id: actual-behavior
20+
attributes:
21+
label: Actual Behavior
22+
description: A clear and concise description of what actually happened.
23+
placeholder: What went wrong?
24+
25+
- type: textarea
26+
id: reproduction-steps
27+
attributes:
28+
label: Steps to Reproduce
29+
description: Please provide detailed step-by-step instructions on how to reproduce the bug.
30+
placeholder: |
31+
1. Go to the [specific page or section] in the application.
32+
2. Click on [specific button or link].
33+
3. Scroll down to [specific location].
34+
4. Observe [describe what you see, e.g., an error message or unexpected behavior].
35+
5. Include any additional steps or details that may be relevant.
36+
37+
- type: textarea
38+
id: code-snippet
39+
attributes:
40+
label: Relevant code being tried
41+
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
42+
render: shell
43+
44+
- type: textarea
45+
id: logs
46+
attributes:
47+
label: Relevant log output
48+
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
49+
render: shell
50+
51+
- type: textarea
52+
id: requirements
53+
attributes:
54+
label: requirements.txt file
55+
description: Please copy and paste your requirements.txt file. This will be automatically formatted into code, so no need for backticks.
56+
render: shell
57+
58+
- type: dropdown
59+
id: environment
60+
attributes:
61+
label: Where are you facing this problem?
62+
default: 0
63+
options:
64+
- Local - Core Tools
65+
- Production Environment (explain below)
66+
67+
- type: textarea
68+
id: function-app-name
69+
attributes:
70+
label: Function app name
71+
placeholder: https://github.com/Azure/azure-functions-host/wiki/Sharing-Your-Function-App-name-privately
72+
description: Optionally share your function app name.
73+
74+
- type: textarea
75+
id: additional-info
76+
attributes:
77+
label: Additional Information
78+
description: Add any other information about the problem here.

.github/ISSUE_TEMPLATE/deferred_bindings_bug_report.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Python Worker Deferred Bindings Feature Request
1+
name: Python Worker Deferred Bindings Bug Report
22
description: File a Deferred Bindings bug report
33
title: "[Bug] Bug Title Here"
44
labels: ["python", "bug", "deferred-bindings"]

.github/ISSUE_TEMPLATE/feature_request.md

-8
This file was deleted.
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Python Worker Feature Request
2+
description: File a feature report
3+
title: "Request a feature"
4+
labels: ["python", "feature"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
This form will help you to fill in a feature request for the Azure Functions Python Worker.
10+
11+
- type: textarea
12+
id: binding-type
13+
attributes:
14+
label: Binding Type
15+
description: Add information about the binding type.
16+
placeholder: Is this on an existing binding or new binding?
17+
18+
- type: textarea
19+
id: expected-behavior
20+
attributes:
21+
label: Expected Behavior
22+
description: A clear and concise description of what you expected to happen.
23+
placeholder: What should have occurred?
24+
25+
- type: textarea
26+
id: code-snippet
27+
attributes:
28+
label: Relevant sample code snipped
29+
description: Please copy and paste any relevant code snippet of how you want the feature to be used. (This will be automatically formatted into code, so no need for backticks)
30+
render: shell
31+
32+
- type: textarea
33+
id: additional-info
34+
attributes:
35+
label: Additional Information
36+
description: Add any other information about the problem here.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
python -m pytest -q -n auto --dist loadfile --reruns 4 --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/extension_tests/deferred_bindings_tests

.github/Scripts/e2e-tests.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
#!/usr/bin/env bash
2-
python -m pytest -q -n auto --dist loadfile --reruns 4 --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend/test_worker_process_count_functions.py tests/endtoend/test_threadpool_thread_count_functions.py
3-
python -m pytest -q -n auto --dist loadfile --reruns 4 --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append --ignore=tests/endtoend/test_worker_process_count_functions.py --ignore=tests/endtoend/test_threadpool_thread_count_functions.py tests/endtoend
4-
python -m pytest -q -n auto --dist loadfile --reruns 4 --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/extension_tests/deferred_bindings_tests
2+
python -m pytest -q -n auto --dist loadfile --reruns 4 --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append --ignore=tests/endtoend/test_worker_process_count_functions.py --ignore=tests/endtoend/test_threadpool_thread_count_functions.py tests/endtoend

.github/Scripts/fwpc-e2e-tests.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
python -m pytest -q -n 1 --dist loadfile --reruns 4 --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend/test_worker_process_count_functions.py tests/endtoend/test_threadpool_thread_count_functions.py

.github/workflows/ci_e2e_workflow.yml

+20-11
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
fail-fast: false
2828
matrix:
2929
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
30+
# Currently runs FWPC E2E tests, classic E2E tests, and DefBindings E2E tests.
31+
# To run tests from another script, add the script name to this matrix
32+
test-type: [fwpc-e2e-tests, e2e-tests, deferred-bindings-e2e-tests]
3033
permissions: read-all
3134
steps:
3235
- name: Checkout code.
@@ -75,8 +78,9 @@ jobs:
7578
retry 5 python setup.py extension
7679
mkdir logs
7780
- name: Grant execute permission
78-
run: chmod +x .github/Scripts/e2e-tests.sh
79-
- name: Running 3.7 Tests
81+
run: |
82+
chmod +x .github/Scripts/${{ matrix.test-type }}.sh
83+
- name: Running 3.7 ${{ matrix.test-type }}
8084
if: matrix.python-version == 3.7
8185
env:
8286
AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString37 }}
@@ -87,8 +91,9 @@ jobs:
8791
AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString37 }}
8892
AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString37 }}
8993
ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }}
90-
run: .github/Scripts/e2e-tests.sh
91-
- name: Running 3.8 Tests
94+
run: |
95+
.github/Scripts/${{ matrix.test-type }}.sh
96+
- name: Running 3.8 ${{ matrix.test-type }}
9297
if: matrix.python-version == 3.8
9398
env:
9499
AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString38 }}
@@ -99,8 +104,9 @@ jobs:
99104
AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString38 }}
100105
AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString38 }}
101106
ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }}
102-
run: .github/Scripts/e2e-tests.sh
103-
- name: Running 3.9 Tests
107+
run: |
108+
.github/Scripts/${{ matrix.test-type }}.sh
109+
- name: Running 3.9 ${{ matrix.test-type }}
104110
if: matrix.python-version == 3.9
105111
env:
106112
AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString39 }}
@@ -111,8 +117,9 @@ jobs:
111117
AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString39 }}
112118
AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString39 }}
113119
ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }}
114-
run: .github/Scripts/e2e-tests.sh
115-
- name: Running 3.10 Tests
120+
run: |
121+
.github/Scripts/${{ matrix.test-type }}.sh
122+
- name: Running 3.10 ${{ matrix.test-type }}
116123
if: matrix.python-version == 3.10
117124
env:
118125
AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString310 }}
@@ -123,8 +130,9 @@ jobs:
123130
AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString310 }}
124131
AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }}
125132
ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }}
126-
run: .github/Scripts/e2e-tests.sh
127-
- name: Running 3.11 Tests
133+
run: |
134+
.github/Scripts/${{ matrix.test-type }}.sh
135+
- name: Running 3.11 ${{ matrix.test-type }}
128136
if: matrix.python-version == 3.11
129137
env:
130138
AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString311 }}
@@ -135,7 +143,8 @@ jobs:
135143
AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString311 }}
136144
AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString311 }}
137145
ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }}
138-
run: .github/Scripts/e2e-tests.sh
146+
run: |
147+
.github/Scripts/${{ matrix.test-type }}.sh
139148
- name: Codecov
140149
uses: codecov/codecov-action@v3
141150
with:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import logging
2+
import time
3+
from datetime import datetime
4+
5+
import azure.functions as func
6+
7+
bp = func.Blueprint()
8+
9+
10+
@bp.route(route="default_template")
11+
def default_template(req: func.HttpRequest) -> func.HttpResponse:
12+
logging.info('Python HTTP trigger function processed a request.')
13+
14+
name = req.params.get('name')
15+
if not name:
16+
try:
17+
req_body = req.get_json()
18+
except ValueError:
19+
pass
20+
else:
21+
name = req_body.get('name')
22+
23+
if name:
24+
return func.HttpResponse(
25+
f"Hello, {name}. This HTTP triggered function "
26+
f"executed successfully.")
27+
else:
28+
return func.HttpResponse(
29+
"This HTTP triggered function executed successfully. "
30+
"Pass a name in the query string or in the request body for a"
31+
" personalized response.",
32+
status_code=200
33+
)
34+
35+
36+
@bp.route(route="http_func")
37+
def http_func(req: func.HttpRequest) -> func.HttpResponse:
38+
time.sleep(1)
39+
40+
current_time = datetime.now().strftime("%H:%M:%S")
41+
return func.HttpResponse(f"{current_time}")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import azure.functions as func
2+
from blueprint_directory.blueprint import bp
3+
4+
app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS)
5+
6+
app.register_functions(bp)

tests/endtoend/generic_functions/generic_functions_stein/function_app.py

+13
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,16 @@ def return_not_processed_last(req: func.HttpRequest, testEntities):
4343
table_name="EventHubBatchTest")
4444
def mytimer(mytimer: func.TimerRequest, testEntity) -> None:
4545
logging.info("This timer trigger function executed successfully")
46+
47+
48+
@app.function_name(name="mytimer2")
49+
@app.schedule(schedule="*/1 * * * * *", arg_name="mytimer",
50+
run_on_startup=False,
51+
use_monitor=False)
52+
@app.generic_input_binding(
53+
arg_name="testEntity",
54+
type="table",
55+
connection="AzureWebJobsStorage",
56+
table_name="EventHubBatchTest")
57+
def mytimer2(mytimer: func.TimerRequest, testEntity):
58+
logging.info("Timer trigger with none return and no type hint")

0 commit comments

Comments
 (0)