Skip to content

Commit 3dcfd54

Browse files
authored
Merge branch 'dev' into wangbill/http_v2_route_params_update
2 parents 064a1bd + 31f0e83 commit 3dcfd54

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1033
-172
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:

azure_functions_worker/bindings/datumdef.py

+13
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,19 @@ def datum_as_proto(datum: Datum) -> protos.TypedData:
201201
))
202202
elif datum.type is None:
203203
return None
204+
elif datum.type == 'dict':
205+
# TypedData doesn't support dict, so we return it as json
206+
return protos.TypedData(json=json.dumps(datum.value))
207+
elif datum.type == 'list':
208+
# TypedData doesn't support list, so we return it as json
209+
return protos.TypedData(json=json.dumps(datum.value))
210+
elif datum.type == 'int':
211+
return protos.TypedData(int=datum.value)
212+
elif datum.type == 'double':
213+
return protos.TypedData(double=datum.value)
214+
elif datum.type == 'bool':
215+
# TypedData doesn't support bool, so we return it as an int
216+
return protos.TypedData(int=int(datum.value))
204217
else:
205218
raise NotImplementedError(
206219
'unexpected Datum type: {!r}'.format(datum.type)

azure_functions_worker/bindings/generic.py

+10
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ def encode(cls, obj: Any, *,
3030
return datumdef.Datum(type='bytes', value=bytes(obj))
3131
elif obj is None:
3232
return datumdef.Datum(type=None, value=obj)
33+
elif isinstance(obj, dict):
34+
return datumdef.Datum(type='dict', value=obj)
35+
elif isinstance(obj, list):
36+
return datumdef.Datum(type='list', value=obj)
37+
elif isinstance(obj, int):
38+
return datumdef.Datum(type='int', value=obj)
39+
elif isinstance(obj, float):
40+
return datumdef.Datum(type='double', value=obj)
41+
elif isinstance(obj, bool):
42+
return datumdef.Datum(type='bool', value=obj)
3343
else:
3444
raise NotImplementedError
3545

azure_functions_worker/dispatcher.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ async def _handle__invocation_request(self, request):
527527
invoc_request = request.invocation_request
528528
invocation_id = invoc_request.invocation_id
529529
function_id = invoc_request.function_id
530+
http_v2_enabled = False
530531

531532
# Set the current `invocation_id` to the current task so
532533
# that our logging handler can find it.
@@ -557,6 +558,10 @@ async def _handle__invocation_request(self, request):
557558

558559
args = {}
559560

561+
http_v2_enabled = self._functions.get_function(function_id) \
562+
.is_http_func and \
563+
HttpV2Registry.http_v2_enabled()
564+
560565
for pb in invoc_request.input_data:
561566
pb_type_info = fi.input_types[pb.name]
562567
if bindings.is_trigger_binding(pb_type_info.binding_name):
@@ -572,10 +577,6 @@ async def _handle__invocation_request(self, request):
572577
shmem_mgr=self._shmem_mgr,
573578
is_deferred_binding=pb_type_info.deferred_bindings_enabled)
574579

575-
http_v2_enabled = self._functions.get_function(function_id) \
576-
.is_http_func and \
577-
HttpV2Registry.http_v2_enabled()
578-
579580
if http_v2_enabled:
580581
http_request = await http_coordinator.get_http_request_async(
581582
invocation_id)

0 commit comments

Comments
 (0)