private IEnumerable <WorkloadInstanceDFSNode> GetDependedNodes(WorkloadInstanceDFSNode node) { List <WorkloadInstanceDFSNode> dependedNodes = new List <WorkloadInstanceDFSNode>(); foreach (string workloadName in node.workloadInstance.VersionedWorkload.Workload.DependsOn) { dependedNodes = dependedNodes.Concat(nameToDFSNodesMap[workloadName]).ToList(); } return(dependedNodes); }
private void ProcessNode(WorkloadInstanceDFSNode node) { if (!nonProcessedNodes.Contains(node)) { return; } if (node.inProgress) { throw new Exception("Cyclic dependency detected between workloads."); } node.inProgress = true; foreach (WorkloadInstanceDFSNode dependedNode in GetDependedNodes(node)) { ProcessNode(dependedNode); } node.inProgress = false; nonProcessedNodes.Remove(node); sortedWorkloadInstanceList.Add(node.workloadInstance); }