Ejemplo n.º 1
0
        /// <summary>Constructor</summary>
        /// <param name="pathAndFileSpec">Path and file specification for finding files.</param>
        /// <param name="ignorePaths">Ignore these paths when looking for files to run.</param>
        /// <param name="recurse">Recurse into child folder?</param>
        /// <param name="runTests">Run tests?</param>
        /// <param name="runType">How should the simulations be run?</param>
        /// <param name="wait">Wait until all simulations are complete?</param>
        /// <param name="numberOfProcessors">Number of CPU processes to use. -1 indicates all processes.</param>
        public Runner(string pathAndFileSpec,
                      List <string> ignorePaths = null,
                      bool recurse           = true,
                      bool runTests          = true,
                      RunTypeEnum runType    = RunTypeEnum.MultiThreaded,
                      bool wait              = true,
                      int numberOfProcessors = -1)
        {
            this.runType            = runType;
            this.wait               = wait;
            this.numberOfProcessors = numberOfProcessors;

            List <string> files = new List <string>();

            DirectoryUtilities.FindFiles(Path.GetDirectoryName(pathAndFileSpec),
                                         Path.GetFileName(pathAndFileSpec),
                                         ref files, recurse);
            foreach (string fileName in files)
            {
                if (!DoIgnoreFile(fileName, ignorePaths))
                {
                    var simulationGroup = new SimulationGroup(fileName, runTests);
                    jobs.Add(simulationGroup);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>Constructor</summary>
        /// <param name="files">Files to be run.</param>
        /// <param name="runTests">Run tests?</param>
        /// <param name="runType">How should the simulations be run?</param>
        /// <param name="wait">Wait until all simulations are complete?</param>
        /// <param name="numberOfProcessors">Number of CPU processes to use. -1 indicates all processes.</param>
        /// <param name="simulationNamePatternMatch">A regular expression used to match simulation names to run.</param>
        public Runner(string[] files,
                      bool runTests                     = true,
                      RunTypeEnum runType               = RunTypeEnum.MultiThreaded,
                      bool wait                         = true,
                      int numberOfProcessors            = -1,
                      string simulationNamePatternMatch = null)
        {
            this.runType            = runType;
            this.wait               = wait;
            this.numberOfProcessors = numberOfProcessors;

            foreach (string fileName in files)
            {
                var simulationGroup = new SimulationGroup(fileName, runTests, simulationNamePatternMatch);
                simulationGroup.Completed += OnSimulationGroupCompleted;
                jobs.Add(simulationGroup);
            }
        }
Ejemplo n.º 3
0
        /// <summary>Constructor</summary>
        /// <param name="relativeTo">The model to use to search for simulations to run.</param>
        /// <param name="runSimulations">Run simulations?</param>
        /// <param name="runPostSimulationTools">Run post simulation tools?</param>
        /// <param name="runTests">Run tests?</param>
        /// <param name="simulationNamesToRun">Only run these simulations.</param>
        /// <param name="runType">How should the simulations be run?</param>
        /// <param name="wait">Wait until all simulations are complete?</param>
        /// <param name="numberOfProcessors">Number of CPU processes to use. -1 indicates all processes.</param>
        public Runner(IModel relativeTo,
                      bool runSimulations         = true,
                      bool runPostSimulationTools = true,
                      bool runTests = true,
                      IEnumerable <string> simulationNamesToRun = null,
                      RunTypeEnum runType    = RunTypeEnum.MultiThreaded,
                      bool wait              = true,
                      int numberOfProcessors = -1)
        {
            this.runType            = runType;
            this.wait               = wait;
            this.numberOfProcessors = numberOfProcessors;

            var simulationGroup = new SimulationGroup(relativeTo, runSimulations, runPostSimulationTools, runTests, simulationNamesToRun);

            simulationGroup.Completed += OnSimulationGroupCompleted;
            jobs.Add(simulationGroup);
        }
Ejemplo n.º 4
0
        /// <summary>Constructor</summary>
        /// <param name="relativeTo">The model to use to search for simulations to run.</param>
        /// <param name="runSimulations">Run simulations?</param>
        /// <param name="runPostSimulationTools">Run post simulation tools?</param>
        /// <param name="runTests">Run tests?</param>
        /// <param name="simulationNamesToRun">Only run these simulations.</param>
        /// <param name="runType">How should the simulations be run?</param>
        /// <param name="wait">Wait until all simulations are complete?</param>
        /// <param name="numberOfProcessors">Number of CPU processes to use. -1 indicates all processes.</param>
        /// <param name="simulationNamePatternMatch">A regular expression used to match simulation names to run.</param>
        public Runner(IEnumerable <IModel> relativeTo,
                      bool runSimulations         = true,
                      bool runPostSimulationTools = true,
                      bool runTests = true,
                      IEnumerable <string> simulationNamesToRun = null,
                      RunTypeEnum runType               = RunTypeEnum.MultiThreaded,
                      bool wait                         = true,
                      int numberOfProcessors            = -1,
                      string simulationNamePatternMatch = null)
        {
            this.runType            = runType;
            this.wait               = wait;
            this.numberOfProcessors = numberOfProcessors;

            foreach (IModel model in relativeTo)
            {
                var simulationGroup = new SimulationGroup(model, runSimulations, runPostSimulationTools, runTests, simulationNamesToRun, simulationNamePatternMatch);
                simulationGroup.Completed += OnSimulationGroupCompleted;
                jobs.Add(simulationGroup);
            }
        }
Ejemplo n.º 5
0
        /// <summary>Constructor</summary>
        /// <param name="pathAndFileSpec">Path and file specification for finding files.</param>
        /// <param name="ignorePaths">Ignore these paths when looking for files to run.</param>
        /// <param name="recurse">Recurse into child folder?</param>
        /// <param name="runTests">Run tests?</param>
        /// <param name="runType">How should the simulations be run?</param>
        /// <param name="wait">Wait until all simulations are complete?</param>
        /// <param name="numberOfProcessors">Number of CPU processes to use. -1 indicates all processes.</param>
        /// <param name="simulationNamePatternMatch">A regular expression used to match simulation names to run.</param>
        public Runner(string pathAndFileSpec,
                      List <string> ignorePaths = null,
                      bool recurse                      = true,
                      bool runTests                     = true,
                      RunTypeEnum runType               = RunTypeEnum.MultiThreaded,
                      bool wait                         = true,
                      int numberOfProcessors            = -1,
                      string simulationNamePatternMatch = null)
        {
            this.runType            = runType;
            this.wait               = wait;
            this.numberOfProcessors = numberOfProcessors;

            string[] files = DirectoryUtilities.FindFiles(pathAndFileSpec, recurse);
            foreach (string fileName in files)
            {
                if (!DoIgnoreFile(fileName, ignorePaths))
                {
                    var simulationGroup = new SimulationGroup(fileName, runTests, simulationNamePatternMatch);
                    simulationGroup.Completed += OnSimulationGroupCompleted;
                    jobs.Add(simulationGroup);
                }
            }
        }