示例#1
0
        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);
        }
示例#2
0
        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);
        }