Skip to content

Do not setup input buffers for function invocation as part of function registration #4193

New issue

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

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

Already on GitHub? # to your account

Closed
pragnagopa opened this issue Mar 13, 2019 · 0 comments · Fixed by #4210
Closed

Comments

@pragnagopa
Copy link
Member

Here is the flow from function load to invocation:

InputBuffer for function invocation on each function is created here:

protected override IFunctionInvoker CreateFunctionInvoker(string scriptFilePath, BindingMetadata triggerMetadata, FunctionMetadata functionMetadata, Collection<FunctionBinding> inputBindings, Collection<FunctionBinding> outputBindings)
{
var inputBuffer = new BufferBlock<ScriptInvocationContext>();
_dispatcher.Register(new FunctionRegistrationContext
{
Metadata = functionMetadata,
InputBuffer = inputBuffer
});
return new WorkerLanguageInvoker(Host, triggerMetadata, functionMetadata, _loggerFactory, inputBindings, outputBindings, inputBuffer);
}

On Function Load response from a language worker, inputBuffer is linked to action block which is later used for invocation here:

var inputBuffer = _functionInputBuffers[loadResponse.FunctionId];
// link the invocation inputs to the invoke call
var invokeBlock = new ActionBlock<ScriptInvocationContext>(ctx => SendInvocationRequest(ctx));
var disposableLink = inputBuffer.LinkTo(invokeBlock);

On function invocation, invocationContext is posted here:

This triggers sending invocation request to language worker here:

internal void SendInvocationRequest(ScriptInvocationContext context)

If there is more than one language worker to handle an invocation, we need to be able to control where to post an invocation request. This would require setting up inputBuffers on each function load for every language worker that gets initialized.

Need to decouple setting up function invocation inputBuffers from WorkerFunctionDescriptorProvider.cs

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants