-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
RAR as a Service: Transfer and execution #5699
Conversation
TODO: Logs are serialized in not optimal way. Find better solution
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 works, but it's a bigger change than I'd expected.
ref/Microsoft.Build.Tasks.Core/netstandard/Microsoft.Build.Tasks.Core.cs
Outdated
Show resolved
Hide resolved
src/Tasks/ResolveAssemblyReferences/Contract/ReadOnlyTaskItem.cs
Outdated
Show resolved
Hide resolved
src/Tasks/ResolveAssemblyReferences/LazyFromattedBuildEventArgsFormatter.cs
Outdated
Show resolved
Hide resolved
src/Tasks/ResolveAssemblyReferences/LazyFromattedBuildEventArgsFormatter.cs
Outdated
Show resolved
Hide resolved
src/Tasks/ResolveAssemblyReferences/Services/ResolveAssemblyReferenceBuildEngine.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Forgind <Forgind@users.noreply.github.com>
e40ebcf
to
7f7d7c3
Compare
7f7d7c3
to
40d1d51
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
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, I've done a first pass over the changes and have left comments and questions inline. Overall:
- Would it be appropriate to remove the WIP label from the PR now?
- Can you add a good description explaining the code structure, which files were generated by which tool and so on?
- Is this PR also making it possible to run tasks concurrently in the RAR service? The change introducing
getRootedPath
would suggest so. - What is the caching strategy? Do entries ever expire? What guarantees that when a dependent assembly changes, all relevant entries are invalidated?
<dependentAssembly> | ||
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /> | ||
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" /> | ||
</dependentAssembly> |
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.
Can you please explain why this change is needed? Where does the request to load Newtonsoft.Json
version <12 come from?
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 believe @ostorc mentioned in our PR reviews meeting this week that StreamJsonRPC relies on it, but he doesn't actually depend on the part of StreamJsonRPC that depends on Newtonsoft.Json, so we were wondering if we could make an exception in ngen'ing it so that we don't have 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.
In this PR microsoft/vs-streamjsonrpc#556 was the unnecessary load of Newtonsoft.Json removed, so when the version with this change is out, we will be able to remove this dangerous lines.
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.
Unfortunately, that didn't solve the issue. Issue #5752 will solve that.
src/Tasks.UnitTests/AssemblyDependency/ResolveAssemblyReferenceAsAService_Tests.cs
Outdated
Show resolved
Hide resolved
src/Tasks/ResolveAssemblyReferences/Services/ResolveAssemblyReferenceComparer.cs
Outdated
Show resolved
Hide resolved
src/Tasks/ResolveAssemblyReferences/Services/ResolveAssemblyReferenceComparer.cs
Show resolved
Hide resolved
src/Tasks/ResolveAssemblyReferences/Services/ResolveAssemblyReferenceComparer.cs
Outdated
Show resolved
Hide resolved
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 didn't really review the MessagePack code, but the rest looks reasonable to me. It would be nice to avoid some of the long repetitive sections, but I know that isn't always possible.
<dependentAssembly> | ||
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /> | ||
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" /> | ||
</dependentAssembly> |
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 believe @ostorc mentioned in our PR reviews meeting this week that StreamJsonRPC relies on it, but he doesn't actually depend on the part of StreamJsonRPC that depends on Newtonsoft.Json, so we were wondering if we could make an exception in ngen'ing it so that we don't have to.
src/Tasks/ResolveAssemblyReferences/Contract/ReadOnlyTaskItem.cs
Outdated
Show resolved
Hide resolved
src/Tasks/ResolveAssemblyReferences/Contract/ReadOnlyTaskItem.cs
Outdated
Show resolved
Hide resolved
{ | ||
switch (key) | ||
{ | ||
case 0: |
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.
Can you explain why does this structure makes sense?
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.
Fixed it little, not it should be more understandable. I was adopting format from MessagePack code generators
|
||
private BuildEventArgsFormatter() { } | ||
|
||
#region BuildWarningEventArgs |
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.
Having not used MessagePack before, I can't say that I really understand what you're doing here.
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 need this custom formatter, so I don't have to use dynamic one (which is slower on first request). The implementation follows how it is generated on runtime (with some minor tweaks).
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.
Is there no way to specify a message in some format and autogenerate the serializer code at build time? That's what I expect from protobuf.
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.
There is, but unfortunately it doesn't support delegating of version of nuget packages to other files, so it not reallly useful right now.
Co-authored-by: Forgind <Forgind@users.noreply.github.com>
catch (ConnectionLostException e) | ||
{ | ||
throw new InternalErrorException("Request failed", e); | ||
} |
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.
Do you have a test to exercise this case?
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.
No not direct one. But if we run test in RARaaS mode we can check for example that in AssemblyFoldersFromConfigFileNotFoundTest
src/Tasks/ResolveAssemblyReferences/Contract/ReadOnlyTaskItem.cs
Outdated
Show resolved
Hide resolved
|
||
private BuildEventArgsFormatter() { } | ||
|
||
#region BuildWarningEventArgs |
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.
Is there no way to specify a message in some format and autogenerate the serializer code at build time? That's what I expect from protobuf.
|
||
if (!(serverStream is NamedPipeServerStream pipeServerStream)) | ||
{ | ||
return serverStream; |
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.
Can you comment this please? I don't understand the reasoning for the early return.
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 for testing purposes. In testing scenarios I want to pass streams which I have created. And normal streams doesn't support rest of the method, so for this reason I am making early exit.
a3d2e74
to
0185da0
Compare
{ | ||
shutdownException = e; | ||
return NodeEngineShutdownReason.Error; | ||
return NodeEngineShutdownReason.BuildComplete; |
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.
Why are we assuming the build was completed when catching an OperationCanceledException
using System.Runtime.Versioning; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
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.
Nit: Empty line
We'll submit a fresh set of PRs as we reboot the RAR service effort. We'll be looking at this PR and the reverted #5613 for inspiration but it can be closed now. |
This PR closes #5556 and #5557.
When this PR is closed it will provide functionality to delegate work to RAR node (implemented by #5555).
In this PR I provide necessary functionality to delegate work of RAR task to RAR node.
I have added code mostly into
src\Tasks\ResolveAssemblyReferences\
:Client
Contains all logic for client to construct connection and to delegate work.
Contract
DTOs and interface which client expects server to have.
Formatters
Custom written formatters, so we don't wait for them to be constructed dynamically, which adds extra cost to 1st request.
Server
Server side logic for handling connection
Services
Logic used during execution of RAR task. In future, there should be added caching layer, etc.