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)
1164NodeAffinity nodeAffinity = GetNodeAffinityForRequest(currentRequest); 1454NodeAffinity affinity = GetNodeAffinityForRequest(request.BuildRequest); 1496NodeAffinity affinityRequired = GetNodeAffinityForRequest(request.BuildRequest); 1500case NodeAffinity.InProc: 1513case NodeAffinity.OutOfProc: 1517case NodeAffinity.Any: 1559TraceScheduler("Requesting creation of new node satisfying affinity {0}", NodeAffinity.InProc); 1560responses.Add(ScheduleResponse.CreateNewNodeResponse(NodeAffinity.InProc, 1)); 1590TraceScheduler("Requesting creation of {0} new node(s) satisfying affinity {1}", outOfProcNodesToCreate, NodeAffinity.OutOfProc); 1591responses.Add(ScheduleResponse.CreateNewNodeResponse(NodeAffinity.OutOfProc, outOfProcNodesToCreate)); 1723NodeAffinity requestAffinity = GetNodeAffinityForRequest(request); 1724NodeAffinity existingRequestAffinity = NodeAffinity.Any; 1725if (requestAffinity != NodeAffinity.Any) 1741existingRequestAffinity = (_availableNodes[assignedNodeId].ProviderType == NodeProviderType.InProc) ? NodeAffinity.InProc : NodeAffinity.OutOfProc; 1752if (existingRequestAffinity != NodeAffinity.Any && existingRequestAffinity != requestAffinity) 2165private NodeAffinity GetNodeAffinityForRequest(BuildRequest request) 2169return NodeAffinity.OutOfProc; 2174return NodeAffinity.InProc; 2183return NodeAffinity.InProc; 2189NodeAffinity affinity = NodeAffinity.Any; 2198if (affinity == NodeAffinity.Any)
BackEnd\Components\Scheduler\ScheduleResponse.cs (3)
93internal readonly NodeAffinity RequiredNodeType; 111private ScheduleResponse(NodeAffinity affinity, int count) 226public 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)
2162data.HostServices.SetNodeAffinity(data.ProjectFullPath, NodeAffinity.InProc); 3309services.SetNodeAffinity(fileName, NodeAffinity.OutOfProc); 3317services.SetNodeAffinity(fileName, NodeAffinity.InProc);
BackEnd\Scheduler_Tests.cs (31)
274BuildRequest request1 = CreateBuildRequest(1, 1, new string[] { "foo" }, NodeAffinity.OutOfProc, _defaultParentRequest); 275BuildRequest request2 = CreateBuildRequest(2, 1, new string[] { "bar" }, NodeAffinity.OutOfProc, _defaultParentRequest); 284Assert.Equal(NodeAffinity.OutOfProc, response[0].RequiredNodeType); 298BuildRequest request1 = CreateBuildRequest(1, 1, new string[] { "foo" }, NodeAffinity.OutOfProc, _defaultParentRequest); 299BuildRequest request2 = CreateBuildRequest(2, 1, new string[] { "bar" }, NodeAffinity.OutOfProc, _defaultParentRequest); 308Assert.Equal(NodeAffinity.OutOfProc, response[0].RequiredNodeType); 361Assert.Equal(NodeAffinity.OutOfProc, response[1].RequiredNodeType); 394BuildRequest request1 = CreateBuildRequest(1, 1, new string[] { "foo" }, NodeAffinity.Any, _defaultParentRequest); 395BuildRequest request2 = CreateBuildRequest(2, 1, new string[] { "bar" }, NodeAffinity.InProc, _defaultParentRequest); 396BuildRequest request3 = CreateBuildRequest(3, 1, new string[] { "bar" }, NodeAffinity.InProc, _defaultParentRequest); 401Assert.Equal(NodeAffinity.InProc, response[0].RequiredNodeType); 410Assert.Equal(NodeAffinity.OutOfProc, moreResponses[1].RequiredNodeType); 427BuildRequest request1 = CreateBuildRequest(1, 1, new string[] { "foo" }, NodeAffinity.OutOfProc, _defaultParentRequest); 428BuildRequest request2 = CreateBuildRequest(2, 2, new string[] { "bar" }, NodeAffinity.OutOfProc, _defaultParentRequest); 429BuildRequest request3 = CreateBuildRequest(3, 3, new string[] { "baz" }, NodeAffinity.OutOfProc, _defaultParentRequest); 430BuildRequest request4 = CreateBuildRequest(4, 4, new string[] { "qux" }, NodeAffinity.OutOfProc, _defaultParentRequest); 439Assert.Equal(NodeAffinity.OutOfProc, response[0].RequiredNodeType); 457BuildRequest request1 = CreateBuildRequest(1, 1, new string[] { "foo" }, NodeAffinity.OutOfProc, _defaultParentRequest); 469Assert.Equal(NodeAffinity.OutOfProc, response[1].RequiredNodeType); 487BuildRequest request1 = CreateBuildRequest(1, 1, new string[] { "foo" }, NodeAffinity.OutOfProc, _defaultParentRequest); 488BuildRequest request2 = CreateBuildRequest(2, 2, new string[] { "bar" }, NodeAffinity.OutOfProc, _defaultParentRequest); 499Assert.Equal(NodeAffinity.OutOfProc, response[1].RequiredNodeType); 586BuildRequest request1 = CreateBuildRequest(1, 1, new string[] { "foo" }, NodeAffinity.OutOfProc, _defaultParentRequest); 588BuildRequest request2 = CreateBuildRequest(2, 2, new string[] { "bar" }, NodeAffinity.OutOfProc, _defaultParentRequest); 590BuildRequest 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)
115Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project")); 127Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); 137hostServices.SetNodeAffinity("project", NodeAffinity.InProc); 138Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); 139hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc); 140Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project")); 141hostServices.SetNodeAffinity("project", NodeAffinity.Any); 142Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project")); 153hostServices.SetNodeAffinity("project1", NodeAffinity.InProc); 154Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project2")); 165hostServices.SetNodeAffinity(String.Empty, NodeAffinity.InProc); 166Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); 167Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project2")); 169hostServices.SetNodeAffinity(String.Empty, NodeAffinity.OutOfProc); 170Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project")); 171Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project2")); 173hostServices.SetNodeAffinity(String.Empty, NodeAffinity.Any); 174Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project")); 175Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project2")); 186hostServices.SetNodeAffinity(String.Empty, NodeAffinity.InProc); 187hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc); 188Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project")); 189Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project2")); 200hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc); 201Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project")); 202hostServices.SetNodeAffinity(null, NodeAffinity.OutOfProc); 203Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project")); 205hostServices.SetNodeAffinity(String.Empty, NodeAffinity.OutOfProc); 206Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project")); 207hostServices.SetNodeAffinity(null, NodeAffinity.OutOfProc); 208Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project")); 222Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); 223hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc); 237Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); 238hostServices.SetNodeAffinity("project", NodeAffinity.Any); 251hostServices.SetNodeAffinity("project", NodeAffinity.Any); 263Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); 264hostServices.SetNodeAffinity("project", NodeAffinity.InProc); 265Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); 278hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc); 290hostServices.SetNodeAffinity("project", NodeAffinity.Any); 292Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); 303hostServices.SetNodeAffinity("project", NodeAffinity.Any); 305hostServices.GetNodeAffinity("project").ShouldBe(NodeAffinity.Any); 317hostServices.SetNodeAffinity(String.Empty, NodeAffinity.InProc); 329hostServices.SetNodeAffinity("project", NodeAffinity.InProc); 342hostServices.GetNodeAffinity("project").ShouldBe(NodeAffinity.Any); 345hostServices.GetNodeAffinity("project").ShouldBe(NodeAffinity.InProc); 357Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); 359Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project")); 360hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc); 361Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project")); 372hostServices.SetNodeAffinity(String.Empty, NodeAffinity.OutOfProc); 373hostServices.SetNodeAffinity("project", NodeAffinity.Any); 374Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project2")); 375Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project")); 378Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); 380Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project")); 381Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project2")); 395hostServices.SetNodeAffinity(project.FullPath, NodeAffinity.InProc);