/// <summary>
 /// Sets the execution options.
 /// </summary>
 /// <param name="_options">The options.</param>
 public void SetExecutionOptions(ProceduralStackOptions _options)
 {
     foreach (TP p in this)
     {
         p.executionOptions = _options;
     }
 }
Beispiel #2
0
        /// <summary>
        /// Runs current procedural stack
        /// </summary>
        /// <param name="options">The options.</param>
        /// <param name="threads">The threads.</param>
        /// <remarks>
        /// It will execute prepared procedural stacks
        /// </remarks>
        /// <seealso cref="aceOperationSetExecutorBase" />
        public void aceOperation_runExecute(
            [Description("Execution options")] ProceduralStackOptions options = ProceduralStackOptions.none,
            [Description("Allowed number of threads")] Int32 threads          = -1)
        {
            String prefix = "";
            Int32  i      = 0;
            Int32  c      = proceduralStack.Count;

            Dictionary <string, OperationContext> currentContextSet = contextSet;


            if (options.HasFlag(ProceduralStackOptions.skipExistingExperiment))
            {
                String path = mainContext.notes.folder.path;

                DirectoryInfo di = mainContext.notes.folder;
                // List<DirectoryInfo> enumDirs = di.EnumerateDirectories(mainContext.runName).ToList();

                if (di.Exists)
                {
                    var fi = di.GetFiles(XMLEXPORT_ClassificationResults).FirstOrDefault();

                    if (fi != null)
                    {
                        output.log("SKIP EXISTING _" + mainContext.runName + "_ experiment. Dumping [" + proceduralStack.Count + "] stacked procedures");

                        proceduralStack.Clear();
                    }
                    else
                    {
                    }
                }
                else
                {
                }
            }

            while (proceduralStack.Count > 0)
            {
                prefix = "[" + i + "/" + c + "]"; //  proceduralStack.Count

                imbSCI.Core.screenOutputControl.logToConsoleControl.setAsOutput(output, prefix, ConsoleColor.Cyan);

                var procedures = proceduralStack.Pop();
                if (threads == -1)
                {
                    threads = mainContext.ParallelThreads;
                }

                procedures.SetExecutionOptions(options);

                currentContextSet = procedures.Execute <OperationContext, ExperimentModelExecutionContext>(threads, mainContext.notes, currentContextSet, mainContext);
            }

            contextSet = currentContextSet;
        }