Exemplo n.º 1
0
        /// <summary>
        /// Find all the nodes in the graph which are already completed
        /// </summary>
        /// <param name="Graph">The graph instance</param>
        /// <param name="Storage">The temp storage backend which stores the shared state</param>
        HashSet <Node> FindCompletedNodes(Graph Graph, TempStorage Storage)
        {
            HashSet <Node> CompletedNodes = new HashSet <Node>();

            foreach (Node Node in Graph.Agents.SelectMany(x => x.Nodes))
            {
                if (Storage.IsComplete(Node.Name))
                {
                    CompletedNodes.Add(Node);
                }
            }
            return(CompletedNodes);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Builds all the nodes in the graph
        /// </summary>
        /// <param name="Job">Information about the current job</param>
        /// <param name="Graph">The graph instance</param>
        /// <param name="Storage">The temp storage backend which stores the shared state</param>
        /// <returns>True if everything built successfully</returns>
        bool BuildAllNodes(JobContext Job, Graph Graph, TempStorage Storage)
        {
            // Build a flat list of nodes to execute, in order
            Node[] NodesToExecute = Graph.Agents.SelectMany(x => x.Nodes).ToArray();

            // Check the integrity of any local nodes that have been completed. It's common to run formal builds locally between regular development builds, so we may have
            // stale local state. Rather than failing later, detect and clean them up now.
            HashSet <Node> CleanedNodes = new HashSet <Node>();

            foreach (Node NodeToExecute in NodesToExecute)
            {
                if (NodeToExecute.InputDependencies.Any(x => CleanedNodes.Contains(x)) || !Storage.CheckLocalIntegrity(NodeToExecute.Name, NodeToExecute.Outputs.Select(x => x.TagName)))
                {
                    Storage.CleanLocalNode(NodeToExecute.Name);
                    CleanedNodes.Add(NodeToExecute);
                }
            }

            // Execute them in order
            int NodeIdx = 0;

            foreach (Node NodeToExecute in NodesToExecute)
            {
                LogInformation("****** [{0}/{1}] {2}", ++NodeIdx, NodesToExecute.Length, NodeToExecute.Name);
                if (!Storage.IsComplete(NodeToExecute.Name))
                {
                    LogInformation("");
                    if (!BuildNode(Job, Graph, NodeToExecute, Storage, false))
                    {
                        return(false);
                    }
                    LogInformation("");
                }
            }
            return(true);
        }
Exemplo n.º 3
0
		/// <summary>
		/// Builds all the nodes in the graph
		/// </summary>
		/// <param name="Job">Information about the current job</param>
		/// <param name="Graph">The graph instance</param>
		/// <param name="Storage">The temp storage backend which stores the shared state</param>
		/// <returns>True if everything built successfully</returns>
		bool BuildAllNodes(JobContext Job, Graph Graph, TempStorage Storage)
		{
			// Build a flat list of nodes to execute, in order
			Node[] NodesToExecute = Graph.Agents.SelectMany(x => x.Nodes).ToArray();

			// Check the integrity of any local nodes that have been completed. It's common to run formal builds locally between regular development builds, so we may have 
			// stale local state. Rather than failing later, detect and clean them up now.
			HashSet<Node> CleanedNodes = new HashSet<Node>();
			foreach(Node NodeToExecute in NodesToExecute)
			{
				if(NodeToExecute.InputDependencies.Any(x => CleanedNodes.Contains(x)) || !Storage.CheckLocalIntegrity(NodeToExecute.Name, NodeToExecute.Outputs.Select(x => x.TagName)))
				{
					Storage.CleanLocalNode(NodeToExecute.Name);
					CleanedNodes.Add(NodeToExecute);
				}
			}

			// Execute them in order
			int NodeIdx = 0;
			foreach(Node NodeToExecute in NodesToExecute)
			{
				Log("****** [{0}/{1}] {2}", ++NodeIdx, NodesToExecute.Length, NodeToExecute.Name);
				if(!Storage.IsComplete(NodeToExecute.Name))
				{
					Log("");
					if(!BuildNode(Job, Graph, NodeToExecute, Storage, false))
					{
						return false;
					} 
					Log("");
				}
			}
			return true;
		}
Exemplo n.º 4
0
		/// <summary>
		/// Find all the nodes in the graph which are already completed
		/// </summary>
		/// <param name="Graph">The graph instance</param>
		/// <param name="Storage">The temp storage backend which stores the shared state</param>
		HashSet<Node> FindCompletedNodes(Graph Graph, TempStorage Storage)
		{
			HashSet<Node> CompletedNodes = new HashSet<Node>();
			foreach(Node Node in Graph.Agents.SelectMany(x => x.Nodes))
			{
				if(Storage.IsComplete(Node.Name))
				{
					CompletedNodes.Add(Node);
				}
			}
			return CompletedNodes;
		}