145 references to NodeAffinity
Microsoft.Build (51)
BackEnd\Components\Communications\INodeManager.cs (2)
23/// <param name="affinity">The <see cref="NodeAffinity"/> to use.</param> 29IList<NodeInfo> CreateNodes(NodeConfiguration configuration, NodeAffinity affinity, int numberOfNodesToCreate);
BackEnd\Components\Communications\NodeInfo.cs (4)
87internal bool CanServiceRequestWithAffinity(NodeAffinity nodeAffinity) 91NodeAffinity.Any => true, 92NodeAffinity.InProc => _providerType == NodeProviderType.InProc, 93NodeAffinity.OutOfProc => _providerType != NodeProviderType.InProc,
BackEnd\Components\Communications\NodeManager.cs (6)
89/// <param name="nodeAffinity">The <see cref="NodeAffinity"/> to use.</param> 92public IList<NodeInfo> CreateNodes(NodeConfiguration configuration, NodeAffinity nodeAffinity, int numberOfNodesToCreate) 98if ((nodeAffinity == NodeAffinity.Any || nodeAffinity == NodeAffinity.InProc) && !_componentHost!.BuildParameters.DisableInProcNode) 103if (nodes.Count < numberOfNodesToCreate && (nodeAffinity == NodeAffinity.Any || nodeAffinity == NodeAffinity.OutOfProc))
BackEnd\Components\Communications\TaskHostNodeManager.cs (1)
49public IList<NodeInfo> CreateNodes(NodeConfiguration configuration, NodeAffinity affinity, int numberOfNodesToCreate)
BackEnd\Components\Scheduler\Scheduler.cs (24)
1160NodeAffinity nodeAffinity = GetNodeAffinityForRequest(currentRequest); 1450NodeAffinity affinity = GetNodeAffinityForRequest(request.BuildRequest); 1492NodeAffinity affinityRequired = GetNodeAffinityForRequest(request.BuildRequest); 1496case NodeAffinity.InProc: 1509case NodeAffinity.OutOfProc: 1513case NodeAffinity.Any: 1555TraceScheduler("Requesting creation of new node satisfying affinity {0}", NodeAffinity.InProc); 1556responses.Add(ScheduleResponse.CreateNewNodeResponse(NodeAffinity.InProc, 1)); 1586TraceScheduler("Requesting creation of {0} new node(s) satisfying affinity {1}", outOfProcNodesToCreate, NodeAffinity.OutOfProc); 1587responses.Add(ScheduleResponse.CreateNewNodeResponse(NodeAffinity.OutOfProc, outOfProcNodesToCreate)); 1719NodeAffinity requestAffinity = GetNodeAffinityForRequest(request); 1720NodeAffinity existingRequestAffinity = NodeAffinity.Any; 1721if (requestAffinity != NodeAffinity.Any) 1737existingRequestAffinity = (_availableNodes[assignedNodeId].ProviderType == NodeProviderType.InProc) ? NodeAffinity.InProc : NodeAffinity.OutOfProc; 1748if (existingRequestAffinity != NodeAffinity.Any && existingRequestAffinity != requestAffinity) 2161private NodeAffinity GetNodeAffinityForRequest(BuildRequest request) 2165return NodeAffinity.OutOfProc; 2170return NodeAffinity.InProc; 2179return NodeAffinity.InProc; 2185NodeAffinity affinity = NodeAffinity.Any; 2194if (affinity == NodeAffinity.Any)
BackEnd\Components\Scheduler\ScheduleResponse.cs (3)
91internal readonly NodeAffinity RequiredNodeType; 109private ScheduleResponse(NodeAffinity affinity, int count) 224public static ScheduleResponse CreateNewNodeResponse(NodeAffinity typeOfNodeToCreate, int count)
Instance\HostServices.cs (11)
58private Dictionary<string, NodeAffinity> _projectAffinities; 141bool hasExplicitOutOfProcAffinity = (GetNodeAffinity(projectFile, out isExplicit) == NodeAffinity.OutOfProc) && isExplicit; 194public NodeAffinity GetNodeAffinity(string projectFile) 206/// <param name="nodeAffinity">The <see cref="NodeAffinity"/> to set.</param> 207public void SetNodeAffinity(string projectFile, NodeAffinity nodeAffinity) 217ErrorUtilities.VerifyThrowInvalidOperation(nodeAffinity == NodeAffinity.InProc, "InvalidAffinityForProjectWithHostObject"); 222_projectAffinities = new Dictionary<string, NodeAffinity>(StringComparer.OrdinalIgnoreCase); 266private NodeAffinity GetNodeAffinity(string projectFile, out bool isExplicit) 273return NodeAffinity.InProc; 279NodeAffinity affinity; 293return NodeAffinity.Any;
Microsoft.Build.Engine.UnitTests (94)
BackEnd\BuildManager_Tests.cs (3)
2226data.HostServices.SetNodeAffinity(data.ProjectFullPath, NodeAffinity.InProc); 3373services.SetNodeAffinity(fileName, NodeAffinity.OutOfProc); 3381services.SetNodeAffinity(fileName, NodeAffinity.InProc);
BackEnd\Scheduler_Tests.cs (31)
273BuildRequest request1 = CreateBuildRequest(1, 1, new string[] { "foo" }, NodeAffinity.OutOfProc, _defaultParentRequest); 274BuildRequest request2 = CreateBuildRequest(2, 1, new string[] { "bar" }, NodeAffinity.OutOfProc, _defaultParentRequest); 283Assert.Equal(NodeAffinity.OutOfProc, response[0].RequiredNodeType); 297BuildRequest request1 = CreateBuildRequest(1, 1, new string[] { "foo" }, NodeAffinity.OutOfProc, _defaultParentRequest); 298BuildRequest request2 = CreateBuildRequest(2, 1, new string[] { "bar" }, NodeAffinity.OutOfProc, _defaultParentRequest); 307Assert.Equal(NodeAffinity.OutOfProc, response[0].RequiredNodeType); 360Assert.Equal(NodeAffinity.OutOfProc, response[1].RequiredNodeType); 393BuildRequest request1 = CreateBuildRequest(1, 1, new string[] { "foo" }, NodeAffinity.Any, _defaultParentRequest); 394BuildRequest request2 = CreateBuildRequest(2, 1, new string[] { "bar" }, NodeAffinity.InProc, _defaultParentRequest); 395BuildRequest request3 = CreateBuildRequest(3, 1, new string[] { "bar" }, NodeAffinity.InProc, _defaultParentRequest); 400Assert.Equal(NodeAffinity.InProc, response[0].RequiredNodeType); 409Assert.Equal(NodeAffinity.OutOfProc, moreResponses[1].RequiredNodeType); 426BuildRequest request1 = CreateBuildRequest(1, 1, new string[] { "foo" }, NodeAffinity.OutOfProc, _defaultParentRequest); 427BuildRequest request2 = CreateBuildRequest(2, 2, new string[] { "bar" }, NodeAffinity.OutOfProc, _defaultParentRequest); 428BuildRequest request3 = CreateBuildRequest(3, 3, new string[] { "baz" }, NodeAffinity.OutOfProc, _defaultParentRequest); 429BuildRequest request4 = CreateBuildRequest(4, 4, new string[] { "qux" }, NodeAffinity.OutOfProc, _defaultParentRequest); 438Assert.Equal(NodeAffinity.OutOfProc, response[0].RequiredNodeType); 456BuildRequest request1 = CreateBuildRequest(1, 1, new string[] { "foo" }, NodeAffinity.OutOfProc, _defaultParentRequest); 468Assert.Equal(NodeAffinity.OutOfProc, response[1].RequiredNodeType); 486BuildRequest request1 = CreateBuildRequest(1, 1, new string[] { "foo" }, NodeAffinity.OutOfProc, _defaultParentRequest); 487BuildRequest request2 = CreateBuildRequest(2, 2, new string[] { "bar" }, NodeAffinity.OutOfProc, _defaultParentRequest); 498Assert.Equal(NodeAffinity.OutOfProc, response[1].RequiredNodeType); 585BuildRequest request1 = CreateBuildRequest(1, 1, new string[] { "foo" }, NodeAffinity.OutOfProc, _defaultParentRequest); 587BuildRequest request2 = CreateBuildRequest(2, 2, new string[] { "bar" }, NodeAffinity.OutOfProc, _defaultParentRequest); 589BuildRequest request3 = CreateBuildRequest(3, 3, new string[] { "bar" }, NodeAffinity.InProc, _defaultParentRequest); 801return CreateBuildRequest(nodeRequestId, configId, targets, NodeAffinity.Any, parentRequest); 807private BuildRequest CreateBuildRequest(int nodeRequestId, int configId, string[] targets, NodeAffinity nodeAffinity, BuildRequest parentRequest, ProxyTargets proxyTargets = null) 813if (nodeAffinity != NodeAffinity.Any) 846NodeAffinity.Any, 862if (response.RequiredNodeType == NodeAffinity.InProc || (response.RequiredNodeType == NodeAffinity.Any && !inProcNodeExists))
Instance\HostServices_Tests.cs (60)
114Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project")); 126Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); 136hostServices.SetNodeAffinity("project", NodeAffinity.InProc); 137Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); 138hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc); 139Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project")); 140hostServices.SetNodeAffinity("project", NodeAffinity.Any); 141Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project")); 152hostServices.SetNodeAffinity("project1", NodeAffinity.InProc); 153Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project2")); 164hostServices.SetNodeAffinity(String.Empty, NodeAffinity.InProc); 165Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); 166Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project2")); 168hostServices.SetNodeAffinity(String.Empty, NodeAffinity.OutOfProc); 169Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project")); 170Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project2")); 172hostServices.SetNodeAffinity(String.Empty, NodeAffinity.Any); 173Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project")); 174Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project2")); 185hostServices.SetNodeAffinity(String.Empty, NodeAffinity.InProc); 186hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc); 187Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project")); 188Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project2")); 199hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc); 200Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project")); 201hostServices.SetNodeAffinity(null, NodeAffinity.OutOfProc); 202Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project")); 204hostServices.SetNodeAffinity(String.Empty, NodeAffinity.OutOfProc); 205Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project")); 206hostServices.SetNodeAffinity(null, NodeAffinity.OutOfProc); 207Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project")); 221Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); 222hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc); 236Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); 237hostServices.SetNodeAffinity("project", NodeAffinity.Any); 250hostServices.SetNodeAffinity("project", NodeAffinity.Any); 262Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); 263hostServices.SetNodeAffinity("project", NodeAffinity.InProc); 264Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); 277hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc); 289hostServices.SetNodeAffinity("project", NodeAffinity.Any); 291Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); 302hostServices.SetNodeAffinity("project", NodeAffinity.Any); 304hostServices.GetNodeAffinity("project").ShouldBe(NodeAffinity.Any); 316hostServices.SetNodeAffinity(String.Empty, NodeAffinity.InProc); 328hostServices.SetNodeAffinity("project", NodeAffinity.InProc); 341hostServices.GetNodeAffinity("project").ShouldBe(NodeAffinity.Any); 344hostServices.GetNodeAffinity("project").ShouldBe(NodeAffinity.InProc); 356Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); 358Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project")); 359hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc); 360Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project")); 371hostServices.SetNodeAffinity(String.Empty, NodeAffinity.OutOfProc); 372hostServices.SetNodeAffinity("project", NodeAffinity.Any); 373Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project2")); 374Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project")); 377Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); 379Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project")); 380Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project2")); 394hostServices.SetNodeAffinity(project.FullPath, NodeAffinity.InProc);