예제 #1
0
        /// <summary>
        /// Create some necessary parts and some dummy Jobs.
        /// </summary>
        public BenchmarkSystemTest()
        {
            scheduler = system.GetScheduler();

            Job1 = new Job(
                p => { return 0; },
                1,
                "Michael",
                4,
                4
            );
            Job2 = new Job(
                p => { return 0; },
                2,
                "Michael",
                4,
                0.5
            );
            Job3 = new Job(
                p => { return 0; },
                3,
                "Michael",
                1,
                0.5
            );
            Job4 = new Job(
                p => { return 0; },
                4,
                "Michael",
                6,
                1
            );
        }
예제 #2
0
 /// <summary>
 /// Remove a job from scheduler.
 /// </summary>
 /// <param name="job">Job object</param>
 public void Cancel(Job job)
 {
     scheduler.RemoveJob(job);
 }
예제 #3
0
 /// <summary>
 /// Add a job to scheduler.
 /// </summary>
 /// <param name="job"></param>
 public void Submit(Job job)
 {
     scheduler.AddJob(job, false);
 }
예제 #4
0
 /// <summary>
 /// Run each job.
 /// </summary>
 /// <param name="job"></param>
 public void RunJob(Job job)
 {
     job.state = State.Running;
     //DatabaseModule.LogAction(job, "running");
     int runtimeMs = (int) job.runtime * 1000;
     Thread.Sleep(runtimeMs);
     lock (_cpuLocker) {
         cpus += job.cpus;
     }
     runningList.Remove(job);
     job.state = State.Terminated;
     //DatabaseModule.LogAction(job, "terminated");
 }