Example #1
0
        private static void ComputeRootsAndSuccessors(AstTask.AstContainerTaskNode container, IEnumerable <AstTaskNode> unsortedTransformations, HashSet <AstTaskNode> roots, Dictionary <AstTaskNode, ICollection <AstTaskNode> > successors)
        {
            AstTaskNode previousTransformation = null;

            foreach (var transformation in unsortedTransformations)
            {
                HashSet <AstTaskNode> predecessors = FindPredecessors(container, transformation, previousTransformation, successors);

                if (predecessors.Count == 0)
                {
                    roots.Add(transformation);
                }

                foreach (var predecessor in predecessors)
                {
                    if (!successors.ContainsKey(predecessor))
                    {
                        successors.Add(predecessor, new HashSet <AstTaskNode>());
                    }

                    successors[predecessor].Add(transformation);
                }

                previousTransformation = transformation;
            }
        }
Example #2
0
        protected Task(AstTaskNode astNode)
            : base(astNode)
        {
            DelayValidation = astNode.DelayValidation;
            switch (astNode.IsolationLevel)
            {
            case IsolationLevel.Chaos:
                TaskIsolationLevel = System.Data.IsolationLevel.Chaos;
                break;

            case IsolationLevel.ReadCommitted:
                TaskIsolationLevel = System.Data.IsolationLevel.ReadCommitted;
                break;

            case IsolationLevel.ReadUncommitted:
                TaskIsolationLevel = System.Data.IsolationLevel.ReadUncommitted;
                break;

            case IsolationLevel.RepeatableRead:
                TaskIsolationLevel = System.Data.IsolationLevel.RepeatableRead;
                break;

            case IsolationLevel.Serializable:
                TaskIsolationLevel = System.Data.IsolationLevel.Serializable;
                break;

            case IsolationLevel.Snapshot:
                TaskIsolationLevel = System.Data.IsolationLevel.Snapshot;
                break;

            case IsolationLevel.Unspecified:
                TaskIsolationLevel = System.Data.IsolationLevel.Unspecified;
                break;

            default:
                TaskIsolationLevel = System.Data.IsolationLevel.Serializable;
                break;
            }
        }
Example #3
0
        private static HashSet <AstTaskNode> FindPredecessors(AstTask.AstContainerTaskNode container, AstTaskNode task, AstTaskNode previousTask, Dictionary <AstTaskNode, ICollection <AstTaskNode> > successors)
        {
            var predecessors = new HashSet <AstTaskNode>();

            if (task.PrecedenceConstraints != null)
            {
                foreach (var input in task.PrecedenceConstraints.Inputs)
                {
                    if (input.OutputPath != null)
                    {
                        var predecessorNode = input.OutputPath.ParentItem as AstTaskNode;
                        predecessors.Add(predecessorNode);
                    }
                }
            }

            //if (containerTask != null && containerTask.ConstraintMode == ContainerConstraintMode.Linear && predecessors.Count == 0 && previousTask != null)
            if (container.ConstraintMode == ContainerConstraintMode.Linear && predecessors.Count == 0 && previousTask != null)
            {
                predecessors.Add(previousTask);
            }

            return(predecessors);
        }