-
Notifications
You must be signed in to change notification settings - Fork 53
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
New programming model #849
base: dev
Are you sure you want to change the base?
Conversation
@Francisco-Gamino I think this PR is correct. The rebase was awful and doubled the amount of commits, not sure why. Lots still to do here, gotta bundle the module with the worker and figure out how to get the cmdlet available in order to write tests for the new programming model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @andystaples for sending this out! I've left a few comments. Let me know if you have any questions.
@@ -352,4 +352,10 @@ | |||
<data name="DependencySnapshotDoesNotContainAcceptableModuleVersions" xml:space="preserve"> | |||
<value>Dependency snapshot '{0}' does not contain acceptable module versions.</value> | |||
</data> | |||
<data name="GetFunctionsMetadataMultipleResultsError" xml:space="preserve"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please ping the Team channel to get feedback on the new string resources you added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor thoughts from skimming the PR. Looking good!
<!-- | ||
<!-- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nipickt: did anything change in this file? Seems like nothing changed. If so - can we instruct git to "revert this file" so that it doesn't register a change in the PR?
src/RequestProcessor.cs
Outdated
// Failure that happens during this step is terminating and we will need to return a failure response to | ||
// all subsequent 'FunctionLoadRequest'. Cache the exception so we can reuse it in future calls. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A suggestion on wording:
// Failure that happens during this step is terminating and we will need to return a failure response to | |
// all subsequent 'FunctionLoadRequest'. Cache the exception so we can reuse it in future calls. | |
// This is a terminating failure: we will need to return a failure response to | |
// all subsequent 'FunctionLoadRequest'. Cache the exception so we can reuse it in future calls. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
src/RequestProcessor.cs
Outdated
// WorkerStatusResponse type says that it is not used but this will create an empty one anyway to return to the host | ||
StreamingMessage response = NewStreamingMessageTemplate( | ||
request.RequestId, | ||
StreamingMessage.ContentOneofCase.FunctionMetadataResponse, | ||
out StatusResult status); | ||
|
||
response.FunctionMetadataResponse.FunctionMetadataResults.AddRange(WorkerIndexingHelper.IndexFunctions(request.FunctionsMetadataRequest.FunctionAppDirectory)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without knowing the specifics of the contract between the Host and worker, I can't decipher what the comment at the top of this block is trying to say. Can you please add a bit more context? What exactly "says that it is not used"?, and what is "it" in this context? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea what this comment is about either. My guess - some misguided note I made while working on my first prototype and forgot to remove. I have removed it
{ | ||
internal class WorkerIndexingHelper | ||
{ | ||
const string GetFunctionsMetadataCmdletName = "AzureFunctions.PowerShell.SDK\\Get-FunctionsMetadata"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move this string to the strings-resource file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the way that other places in the code which call cmdlets deal with it. Strings-resources are for customer-facing error/warning messages. I propose creating a separate issue on the worker to track all occurrences and move them to some global constants file.
List<RpcFunctionMetadata> indexedFunctions = new List<RpcFunctionMetadata>(); | ||
|
||
InitialSessionState initial = InitialSessionState.CreateDefault(); | ||
Runspace runspace = RunspaceFactory.CreateRunspace(initial); | ||
runspace.Open(); | ||
System.Management.Automation.PowerShell ps = System.Management.Automation.PowerShell.Create(); | ||
ps.Runspace = runspace; | ||
|
||
ps.AddCommand(GetFunctionsMetadataCmdletName).AddArgument(baseDir); | ||
string outputString = string.Empty; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this block would benefit from a small comment explaining what data your runspace is achieving, and how exactly this is helping the indexing process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. This is a much larger issue, actually, and without a better approach, will lead to the AzureFunctions.PowerShell.SDK module never being available to the worker in Azure, even if we bundle it with the worker. I have left a long comment explaining the issue and some proposed solutions.
<value>Multiple results from metadata cmdlet</value> | ||
</data> | ||
<data name="InvalidBindingInfoDirection" xml:space="preserve"> | ||
<value>The bindingInfo's Direction is not valid</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we be able to specify which binding name this corresponds to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
@@ -0,0 +1,54 @@ | |||
using Microsoft.Azure.WebJobs.Script.Grpc.Messages; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the standard copyright/license header to all the new files - just copy it from other files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
ab737ee
to
3e50a6e
Compare
3e50a6e
to
5e38ae4
Compare
Issue describing the changes in this PR
Adds support for worker indexing to the functions worker
Pull request checklist
release_notes.md