-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Allow NodeProviderOutOfProcTaskHost to manage multiple nodes instead of one per arch
#12521
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
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3321023
change NodeProviderOutOfProcTaskHost to manage pools of nodes:
surayya-MS 9bae89a
remove unused prop
surayya-MS 46cfde5
Merge branch 'main' into out-of-proc-task-host-pools
surayya-MS d3b705b
return int.MaxValue for AvailableNodes, fix error message, cleanup co…
surayya-MS 34e5365
remove lock since _odeContexts is now ConcurrentDictionary
surayya-MS 4912cf7
remove lock on _nodeContexts
surayya-MS 8a43dcc
use LockType
surayya-MS 2a2140f
Merge branch 'main' into out-of-proc-task-host-pools
surayya-MS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,7 +91,9 @@ internal class TaskHostTask : IGeneratedTask, ICancelableTask, INodePacketFactor | |
| /// The task host context of the task host we're launching -- used to | ||
| /// communicate with the task host. | ||
| /// </summary> | ||
| private HandshakeOptions _requiredContext = HandshakeOptions.None; | ||
| private HandshakeOptions _requiredHandshakeOptions = HandshakeOptions.None; | ||
|
|
||
| private int _requiredNodeId = -1; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this naming is confusing, if you want to express that a specific taskhosttask has a mapping to a nodeId, then I'd just say something like |
||
|
|
||
| /// <summary> | ||
| /// True if currently connected to the task host; false otherwise. | ||
|
|
@@ -251,7 +253,7 @@ public void Cancel() | |
| { | ||
| if (_taskHostProvider != null && _connectedToTaskHost) | ||
| { | ||
| _taskHostProvider.SendData(_requiredContext, new TaskHostTaskCancelled()); | ||
| _taskHostProvider.SendData(_requiredNodeId, new TaskHostTaskCancelled()); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -304,14 +306,14 @@ public bool Execute() | |
| { | ||
| lock (_taskHostLock) | ||
| { | ||
| _requiredContext = CommunicationsUtilities.GetHandshakeOptions( | ||
| _requiredHandshakeOptions = CommunicationsUtilities.GetHandshakeOptions( | ||
| taskHost: true, | ||
|
|
||
| // Determine if we should use node reuse based on build parameters or user preferences (comes from UsingTask element). | ||
| // If the user explicitly requested the task host factory, then we always disable node reuse due to the transient nature of task host factory hosts. | ||
| nodeReuse: _buildComponentHost.BuildParameters.EnableNodeReuse && !_taskHostFactoryExplicitlyRequested, | ||
| taskHostParameters: _taskHostParameters); | ||
| _connectedToTaskHost = _taskHostProvider.AcquireAndSetUpHost(_requiredContext, this, this, hostConfiguration, _taskHostParameters); | ||
| _connectedToTaskHost = _taskHostProvider.AcquireAndSetUpHost(_requiredHandshakeOptions, this, this, hostConfiguration, _taskHostParameters, out _requiredNodeId); | ||
| } | ||
|
|
||
| if (_connectedToTaskHost) | ||
|
|
@@ -340,23 +342,23 @@ public bool Execute() | |
| { | ||
| lock (_taskHostLock) | ||
| { | ||
| _taskHostProvider.DisconnectFromHost(_requiredContext); | ||
| _taskHostProvider.DisconnectFromHost(_requiredNodeId); | ||
| _connectedToTaskHost = false; | ||
| } | ||
| } | ||
| } | ||
| else | ||
| { | ||
| LogErrorUnableToCreateTaskHost(_requiredContext, runtime, architecture, null); | ||
| LogErrorUnableToCreateTaskHost(_requiredHandshakeOptions, runtime, architecture, null); | ||
| } | ||
| } | ||
| catch (BuildAbortedException) | ||
| { | ||
| LogErrorUnableToCreateTaskHost(_requiredContext, runtime, architecture, null); | ||
| LogErrorUnableToCreateTaskHost(_requiredHandshakeOptions, runtime, architecture, null); | ||
| } | ||
| catch (NodeFailedToLaunchException e) | ||
| { | ||
| LogErrorUnableToCreateTaskHost(_requiredContext, runtime, architecture, e); | ||
| LogErrorUnableToCreateTaskHost(_requiredHandshakeOptions, runtime, architecture, e); | ||
| } | ||
|
|
||
| return _taskExecutionSucceeded; | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
consider https://learn.microsoft.com/en-us/dotnet/api/system.threading.interlocked.increment?view=net-9.0 instead of the lock