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

Support model-type bindings for out-of-proc workers #8815

Merged
merged 10 commits into from
Nov 3, 2022

Conversation

liliankasem
Copy link
Member

@liliankasem liliankasem commented Oct 4, 2022

Add support for model-type bindings for out-of-proc workers

Part of the work to support SDK-type bindings for out-of-proc workers is for the host to bind to ParameterBindingData if a function supports deferred binding. Deferred binding means that instead of resolving binding payloads host-side, it will be deferred so that the worker resolves binding when it gets the invocation request. For example, if a function binds to a BlobClient, instead of creating and passing around a BlobClient, we will use ParameterBindingData to gather all the relevant information the worker would need to create the BlobClient itself (worker-side).

Things happening in this PR:

  • Support binding to ParameterBindingData. If a function indicates that it supports deferred binding, we can use ParameterBindingData to get the relevant information from the extension. By setting this as a functions defaultType, we can check extension converters to see if they can provide ParameterBindingData which enables us to bind functions to SDK-types on the worker side.

  • A limitation here is that we only support ParameterBindingData and deferred binding for trigger bindings if none of the function's input or output bindings contain an expression (you can read more about why this limitation exists in this issue). Because of this, we first check if the trigger binding "SupportsDeferredBinding". If it does, we check all the attributes for the input and output bindings to see if there are any expressions being used. If an expressions is being used, we set the "SkipDeferredBinding" flag in the function's metadata Properties. We use SkipDeferredBinding later down the line to skip deferred binding for the trigger, meaning we set SupportsDeferredBinding to false. So instead of using ParameterBindingData, we use the defaultType that is evaluated by the WebJobs sdk.

  • Update ScriptBindingContext to include Properties prop and a SupportsDeferredBinding prop. In the protobuf, the Binding info was updated to include a Properties map. This map is used by workers to add additional information about a function binding. For this specific feature, the worker will add a SupportsDeferredBinding prop to the Properties map to indicate to the host that a given function supports deferred binding.

  • Convert ParameterBindingData to ModelBindingData so that we can send this information of gRPC to workers. ModelBindingData is the gRPC message representation of the WebJobs ParameterBindingData; you can find the protobuf definition for this here

The Azure/azure-functions-dotnet-worker#1081 (comment) has a list of all the PRs related to this feature

@liliankasem liliankasem changed the title Support new ParameterBindingData reference type for SDK-type bindings Support model-type bindings for out-of-proc workers Oct 26, 2022
@liliankasem liliankasem force-pushed the sdk-bindings/support-reference-type branch from e895b70 to d41f91f Compare October 28, 2022 00:40
@liliankasem liliankasem force-pushed the sdk-bindings/support-reference-type branch 2 times, most recently from be3c9a7 to 0c8ae90 Compare October 28, 2022 01:24
@liliankasem liliankasem force-pushed the sdk-bindings/support-reference-type branch 2 times, most recently from 5770e16 to 84e56c7 Compare November 1, 2022 22:04
@liliankasem liliankasem marked this pull request as ready for review November 1, 2022 22:05
@liliankasem liliankasem requested a review from a team as a code owner November 1, 2022 22:05
@liliankasem liliankasem force-pushed the sdk-bindings/support-reference-type branch from 893b125 to 79c9baa Compare November 2, 2022 18:57
@liliankasem liliankasem force-pushed the sdk-bindings/support-reference-type branch from a9a940b to 73be007 Compare November 2, 2022 19:03
@liliankasem liliankasem force-pushed the sdk-bindings/support-reference-type branch from f299e76 to 95988ca Compare November 2, 2022 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants