Beispiel #1
0
 public JobDispatcherSettingsViewModel(JobDispatcherOptions options)
 {
     m_options = options;
 }
Beispiel #2
0
        public void Badger_AssignExperiments6()
        {
            //create herd agents
            List <HerdAgentInfo> herdAgents = new List <HerdAgentInfo>
            {
                new HerdAgentInfo("Agent-1", 4, PropValues.Linux64, PropValues.None, "1.1.0"),
                new HerdAgentInfo("Agent-2", 2, PropValues.Win32, "8.1.2", "1.1.0"),
                new HerdAgentInfo("Agent-3", 2, PropValues.Win64, "8.1.2", "1.1.0")
            };

            //create app versions
            AppVersionRequirements win64Reqs      = new AppVersionRequirements(PropValues.Win64);
            AppVersionRequirements win32Reqs      = new AppVersionRequirements(PropValues.Win32);
            AppVersionRequirements linux64Reqs    = new AppVersionRequirements(PropValues.Linux64);
            AppVersion             win32Version   = new AppVersion("win-x32", "RLSimion.exe", win32Reqs);
            AppVersion             win64Version   = new AppVersion("win-x64", "RLSimion-linux-x64.exe", win64Reqs);
            AppVersion             linux64Version = new AppVersion("linux-x64", "RLSimion-x64.exe", linux64Reqs);
            List <AppVersion>      appVersions    = new List <AppVersion>()
            {
                win32Version, win64Version, linux64Version
            };

            //create run-time requirements
            RunTimeRequirements cores_2_win32   = new RunTimeRequirements(0, PropValues.Win32);
            RunTimeRequirements cores_2_linux64 = new RunTimeRequirements(2, PropValues.Linux64);
            RunTimeRequirements cores_1         = new RunTimeRequirements(1, PropValues.Linux64);
            //create experiments
            List <ExperimentalUnit> pendingExperiments = new List <ExperimentalUnit>()
            {
                new ExperimentalUnit("Experiment-1", appVersions, cores_2_win32),
                new ExperimentalUnit("Experiment-2", appVersions, cores_2_linux64),
                new ExperimentalUnit("Experiment-3", appVersions, cores_2_linux64),
            };

            //create output list to receive assigned jobs
            List <Job> assignedJobs = new List <Job>();

            //Assign experiments
            JobDispatcherOptions options = new JobDispatcherOptions();

            options.LeaveOneFreeCore = true;

            JobDispatcher.AssignExperiments(ref pendingExperiments, ref herdAgents, ref assignedJobs, options);

            //Check everything went as expected
            Assert.IsTrue(assignedJobs.Count == 2);
            //  -assigned experimental units and agents
            Assert.IsTrue(assignedJobs[0].HerdAgent.ProcessorId == "Agent-1");
            Assert.IsTrue(assignedJobs[0].ExperimentalUnits.Count == 1);
            Assert.IsTrue(assignedJobs[0].ExperimentalUnits[0].Name == "Experiment-2");
            Assert.IsTrue(assignedJobs[0].ExperimentalUnits[0].SelectedVersion.Requirements.Architecture == PropValues.Linux64);
            Assert.IsTrue(assignedJobs[1].HerdAgent.ProcessorId == "Agent-2");
            Assert.IsTrue(assignedJobs[1].ExperimentalUnits.Count == 1);
            Assert.IsTrue(assignedJobs[1].ExperimentalUnits[0].Name == "Experiment-1");
            Assert.IsTrue(assignedJobs[1].ExperimentalUnits[0].SelectedVersion.Requirements.Architecture == PropValues.Win32);

            //  -used agents are removed
            Assert.IsTrue(herdAgents.Count == 1);
            //  -assigned experiments are removed
            Assert.IsTrue(pendingExperiments.Count == 1);
        }