/// <summary>
 /// Initializes a new instance of the <see cref="RunnableLoopNode"/> class.
 /// </summary>
 /// <param name="id">The id.</param>
 /// <param name="loopDecisionModule">The loop decision module.</param>
 /// <param name="compositeComponentMetadata">The composite component metadata.</param>
 /// <param name="templateGraph">The template graph.</param>
 /// <param name="workspaceWrapper">The composite component workspace wrapper.</param>
 /// <param name="library">The library.</param>
 /// <param name="waitForAllPredecessors">if set to <c>true</c> [wait for all predecessors].</param>
 public RunnableLoopNode(String id,
     TraceLab.Core.Decisions.ILoopDecisionModule loopDecisionModule,
     CompositeComponentBaseMetadata compositeComponentMetadata,
     RunnableExperimentBase templateGraph,
     NestedWorkspaceWrapper workspaceWrapper,
     TraceLab.Core.Components.ComponentsLibrary library,
     bool waitForAllPredecessors)
     : base(id, compositeComponentMetadata, templateGraph, workspaceWrapper, library, waitForAllPredecessors) 
 {
     m_loopDecisionModule = loopDecisionModule;
 }
 /// <summary>
 /// Initializes a new s_instance of the <see cref="RunnableCompositeComponentNode"/> class.
 /// </summary>
 /// <param name="id">The id.</param>
 /// <param name="compositeComponentMetadata">The composite component metadata.</param>
 /// <param name="templateGraph">The template graph.</param>
 /// <param name="workspaceWrapper">The composite component workspace wrapper.</param>
 public RunnableCompositeComponentNode(String id,
             CompositeComponentBaseMetadata compositeComponentMetadata, 
             RunnableExperimentBase templateGraph, 
             NestedWorkspaceWrapper workspaceWrapper, 
             TraceLab.Core.Components.ComponentsLibrary library, 
             bool waitForAllPredecessors)
             : base(id, compositeComponentMetadata.Label, new RunnableNodeCollection(), new RunnableNodeCollection(), library, waitForAllPredecessors)
 {
     m_compositeComponentMetadata = compositeComponentMetadata;
     m_subLevelExperiment = templateGraph;
     m_workspace = workspaceWrapper;
 }
        /// <summary>
        /// Creates the new instance of logger name root for composite graph, based on this LoggerName with addition of owner id and owner node label
        /// </summary>
        /// <param name="compositeComponentMetadata">The composite component metadata.</param>
        /// <returns></returns>
        public LoggerNameRoot CreateLoggerNameRootForCompositeNode(CompositeComponentBaseMetadata compositeComponentMetadata)
        {
            string ownerNodeId = compositeComponentMetadata.ComponentGraph.OwnerNode.ID;
            string ownerNodeLabel = compositeComponentMetadata.Label;

            string experimentPathRoot = String.Format("{0}:{1}", m_experimentPathRoot, ownerNodeId);
            string userFriendlyRoot;
            if (String.IsNullOrEmpty(m_userFriendlyRoot))
            {
                //it is first sub level
                userFriendlyRoot = ownerNodeLabel;
            }
            else
            {
                userFriendlyRoot = String.Format("{0} : {1}", m_userFriendlyRoot, ownerNodeLabel);
            }

            return new LoggerNameRoot(experimentPathRoot, userFriendlyRoot);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates the new instance of logger name root for composite graph, based on this LoggerName with addition of owner id and owner node label
        /// </summary>
        /// <param name="compositeComponentMetadata">The composite component metadata.</param>
        /// <returns></returns>
        public LoggerNameRoot CreateLoggerNameRootForCompositeNode(CompositeComponentBaseMetadata compositeComponentMetadata)
        {
            string ownerNodeId    = compositeComponentMetadata.ComponentGraph.OwnerNode.ID;
            string ownerNodeLabel = compositeComponentMetadata.Label;

            string experimentPathRoot = String.Format("{0}:{1}", m_experimentPathRoot, ownerNodeId);
            string userFriendlyRoot;

            if (String.IsNullOrEmpty(m_userFriendlyRoot))
            {
                //it is first sub level
                userFriendlyRoot = ownerNodeLabel;
            }
            else
            {
                userFriendlyRoot = String.Format("{0} : {1}", m_userFriendlyRoot, ownerNodeLabel);
            }

            return(new LoggerNameRoot(experimentPathRoot, userFriendlyRoot));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Constructs the sub experiment.
        /// </summary>
        /// <param name="compositeComponentMetadata">The composite component metadata.</param>
        /// <param name="loggerNameRoot">The logger name root.</param>
        /// <param name="library">The library.</param>
        /// <param name="componentsAppDomain">The components app domain.</param>
        /// <param name="terminateExperimentExecutionResetEvent">The terminate experiment execution reset event - must be the same as top level experiment termination event.</param>
        /// <param name="nodesFactoryOfSubGraph">The nodes factory of sub graph.</param>
        /// <returns></returns>
        private RunnableExperimentBase ConstructSubExperiment(CompositeComponentBaseMetadata compositeComponentMetadata, LoggerNameRoot loggerNameRoot, 
                                                ComponentsLibrary library, AppDomain componentsAppDomain, 
                                                System.Threading.ManualResetEvent terminateExperimentExecutionResetEvent, IRunnableNodeFactory nodesFactoryOfSubGraph)
        {
            //add to experiment id the owner node id to make it unique
            LoggerNameRoot compositeComponentNodeLoggerNameRoot = loggerNameRoot.CreateLoggerNameRootForCompositeNode(compositeComponentMetadata);

            RunnableExperimentBase subExperiment = GraphAdapter.Adapt(compositeComponentMetadata.ComponentGraph, compositeComponentNodeLoggerNameRoot,
                                                                        nodesFactoryOfSubGraph, library, Workspace.TypeDirectories,
                                                                        componentsAppDomain, terminateExperimentExecutionResetEvent, false);

            if (subExperiment.IsEmpty)
            {
                throw new TraceLab.Core.Exceptions.IncorrectSubTemplateException("Unable to execute subexperiment due to errors.");
            }
            return subExperiment;
        }