Пример #1
0
 public static bool JobExists(Job job, Job.JobState State)
 {
     lock (BenchmarkSystem.db) {
         var query = from j in BenchmarkSystem.db.Jobs
                     where j.name == job.name && j.DbState == (int)State
                     select j;
         return(query.Count() > 0);
     }
 }
Пример #2
0
 public static IList <Job> GetJobs(Scheduler.JobType type, Job.JobState State)
 {
     lock (BenchmarkSystem.db) {
         var query = from j in BenchmarkSystem.db.Jobs
                     where j.ExpectedRuntime >= type.MinRuntime && j.ExpectedRuntime <= type.MaxRuntime && j.DbState == (int)State
                     orderby j.timestamp ascending
                     select j;
         return(query.ToList());
     }
 }
Пример #3
0
 public static IList <Job> GetJobs(Job.JobState State)
 {
     lock (BenchmarkSystem.db) {
         var query = from j in BenchmarkSystem.db.Jobs
                     where j.DbState == (int)State
                     orderby j.timestamp ascending
                     select j;
         return(query.ToList());
     }
 }
Пример #4
0
        public void StateTest3()
        {
            Owner owner           = null;
            byte  CPU             = 1;
            uint  ExpectedRuntime = 0;
            Job   target          = new Job("State test 3", owner, CPU, ExpectedRuntime);

            Job.JobState expected = Job.JobState.Queued;
            Job.JobState shouldfail;
            target.State = expected;
            shouldfail   = Job.JobState.Running;
            Assert.AreNotEqual(expected, shouldfail);
        }
Пример #5
0
        public void StateTest2()
        {
            Owner owner           = null;
            byte  CPU             = 1;
            uint  ExpectedRuntime = 0;
            Job   target          = new Job("State test 2", owner, CPU, ExpectedRuntime);

            Job.JobState expected = Job.JobState.Queued;
            Job.JobState actual;
            target.State = expected;
            actual       = target.State;
            Assert.AreEqual(expected, actual);
        }
Пример #6
0
        public void ActivityConstructorTest()
        {
            Owner owner = new Owner("Activity Testowner");
            Job   job   = new Job("Activity Testjob", owner, 5, 3);

            Job.JobState state     = Job.JobState.Queued;
            long         timestamp = System.DateTime.Now.Ticks;
            Activity     ac        = new Activity(job, state, timestamp);

            Assert.AreEqual(job, ac.Job);
            Assert.AreEqual(state, ac.State);
            Assert.AreEqual((int)state, ac.DbState);
            Assert.AreEqual(timestamp, ac.Timestamp);
        }
Пример #7
0
 public Activity(Job Job, Job.JobState State, long Timestamp)
 {
     this.Job       = Job;
     this.State     = State;
     this.Timestamp = Timestamp;
 }