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

            Job1 = new Job(
                p => { Console.WriteLine("Job1 is running"); return 0; },
                "job1",
                "Michael",
                4,
                40
            );
            Job2 = new Job(
                p => { Console.WriteLine("Job2 is running"); return 0; },
                "job2",
                "Michael",
                4,
                5
            );
            Job3 = new Job(
                p => { Console.WriteLine("Job3 is running"); return 0; },
                "job3",
                "Michael",
                1,
                5
            );
            Job4 = new Job(
                p => { Console.WriteLine("Job4 is running"); return 0; },
                "job4",
                "Michael",
                6,
                10
            );
        }
        /// <summary>
        /// Create some necessary parts and some dummy jobs.
        /// </summary>
        public BenchmarkSystemTest()
        {
            scheduler = system.GetScheduler();
            Logger logger = new Logger(system);

            job1 = new Job(
                p => { Console.WriteLine("Job1 is running"); return 0; },
                4,
                40,
                new Owner { name = "Michael" }
            );
            job2 = new Job(
                p => { Console.WriteLine("Job2 is running"); return 0; },
                4,
                5,
                new Owner { name = "Michael" }
            );
            job3 = new Job(
                p => { Console.WriteLine("Job3 is running"); return 0; },
                1,
                5,
                new Owner { name = "Michael" }
            );
            job4 = new Job(
                p => { Console.WriteLine("Job4 is running"); return 0; },
                6,
                10,
                new Owner { name = "Michael" }
            );
        }
Example #3
0
        public static void LogAction(Job job, String action)
        {
            using (var dbContext = new Model1Container()) {
                Log log = new Log();
                log.Action = action;
                log.JobName = job.Name;
                log.OwnerName = job.Owner;
                log.Time = DateTime.Now;

                dbContext.Logs.AddObject(log);
                dbContext.SaveChanges();
            }
        }
Example #4
0
 /// <summary>
 /// Create some dummy Jobs.
 /// </summary>
 public SchedulerTest()
 {
     Job1 = new Job(
         p => { Console.WriteLine("Job1 is running"); return 0; },
         "job1",
         "Michael",
         4,
         40
     );
     Job2 = new Job(
         p => { Console.WriteLine("Job2 is running"); return 0; },
         "job2",
         "Michael",
         3,
         20
     );
     Job3 = new Job(
         p => { Console.WriteLine("Job2 is running"); return 0; },
         "job3",
         "Michael",
         1,
         60
     );
 }
Example #5
0
 /// <summary>
 /// Add a job to scheduler, change state of job and trigger event.
 /// </summary>
 /// <param name="job"></param>
 public void Submit(Job job)
 {
     scheduler.AddJob(job);
     job.State = State.Submitted;
     JobSubmitted(EventArgs.Empty);
 }
Example #6
0
 /// <summary>
 /// Remove a job from scheduler, change state of job and trigger event.
 /// </summary>
 /// <param name="job">Job object</param>
 public void Cancel(Job job)
 {
     scheduler.RemoveJob(job);
     job.State = State.Cancelled;
     JobCancelled(EventArgs.Empty);
 }
Example #7
0
        static void Main(string[] args)
        {
            BenchmarkSystem system = new BenchmarkSystem();
            Logger logger = new Logger(system);

            Job job1 = new Job(
                p => { Console.WriteLine("Job1 is running"); return 0; },
                4,
                40,
                new Owner { name = "Michael" }
            );
            Job job2 = new Job(
                p => { Console.WriteLine("Job2 is running"); return 0; },
                4,
                5,
                new Owner { name = "Michael" }
            );
            Job job3 = new Job(
                p => { Console.WriteLine("Job3 is running"); return 0; },
                4,
                5,
                new Owner { name = "Michael" }
            );
            Job job4 = new Job(
                p => { Console.WriteLine("Job4 is running"); return 0; },
                6,
                10,
                new Owner { name = "Michael" }
            );

            system.Submit(job1);
            system.Submit(job2);
            system.Submit(job3);
            system.Submit(job4);

            system.Status();

            system.ExecuteAll();

            Console.ReadKey();
        }
Example #8
0
        static void Main(string[] args)
        {
            BenchmarkSystem system = new BenchmarkSystem();

            Job job1 = new Job(
                p => { Console.WriteLine("Job1 is running"); return 0; },
                "job1",
                "Michael",
                4,
                40
            );

            Job job2 = new Job(
                p => { Console.WriteLine("Job2 is running"); return 0; },
                "job2",
                "Michael",
                4,
                5
            );

            Job job3 = new Job(
                p => { Console.WriteLine("Job3 is running"); return 0; },
                "job3",
                "Michael",
                4,
                5
            );

            Job job4 = new Job(
                p => { Console.WriteLine("Job4 is running"); return 0; },
                "job4",
                "Michael",
                6,
                10
            );

            system.Submit(job1);
            system.Submit(job2);
            system.Submit(job3);
            system.Submit(job4);

            system.Status();

            system.ExecuteAll();

            Console.ReadKey();
        }
Example #9
0
 /// <summary>
 /// Add a job to scheduler, change state of job and trigger event.
 /// </summary>
 /// <param name="job"></param>
 public void Submit(Job job)
 {
     scheduler.AddJob(job);
     job.State = State.Submitted;
     DatabaseModule.LogAction(job, "submitted");
 }
Example #10
0
 /// <summary>
 /// Remove a job from scheduler, change state of job and trigger event.
 /// </summary>
 /// <param name="job">Job object</param>
 public void Cancel(Job job)
 {
     scheduler.RemoveJob(job);
     job.State = State.Cancelled;
     DatabaseModule.LogAction(job, "cancelled");
 }