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

build: recognize collection_model_binding_data for batch inputs #1655

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
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
2 changes: 2 additions & 0 deletions azure_functions_worker/bindings/datumdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ def from_typed_data(cls, td: protos.TypedData):
val = td.collection_sint64
elif tt == 'model_binding_data':
val = td.model_binding_data
elif tt == 'collection_model_binding_data':
val = td.collection_model_binding_data
elif tt is None:
return None
else:
Expand Down
12 changes: 9 additions & 3 deletions azure_functions_worker/bindings/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,19 @@ def deferred_bindings_decode(binding: typing.Any,
"""
global deferred_bindings_cache

if datum.type == "collection_model_binding_data":
# Accumulates each model_binding_data content in collection_model_binding_data
content = b"".join(mbd.content for mbd in datum.value.model_binding_data)
else:
content = datum.value.content

if deferred_bindings_cache.get((pb.name,
pytype,
datum.value.content,
content,
function_name), None) is not None:
return deferred_bindings_cache.get((pb.name,
pytype,
datum.value.content,
content,
function_name))
else:
deferred_binding_type = binding.decode(datum,
Expand All @@ -315,7 +321,7 @@ def deferred_bindings_decode(binding: typing.Any,

deferred_bindings_cache[(pb.name,
pytype,
datum.value.content,
content,
function_name)] = deferred_binding_type
return deferred_binding_type

Expand Down
2 changes: 1 addition & 1 deletion python/test/worker.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"description":{
"language":"python",
"extensions":[".py"],
"defaultExecutablePath":"python",
"defaultExecutablePath":"C:\\Users\\evanroman\\source\\repos\\azure-functions-python-worker\\.env\\Scripts\\python.exe",
"defaultWorkerPath":"worker.py",
"workerIndexing": "true"
},
Expand Down
Loading