示例#1
0
 /// <summary>
 /// Cancel a job in the benchmarksystem
 /// </summary>
 /// <param name="job">The job to cancel</param>
 public void Cancel(Job job)
 {
     scheduler.RemoveJob(job);
     //Notify subscribers
     if (JobCancelled != null)
     {
         JobCancelled(job);
     }
 }
示例#2
0
 private static Job CreateRandomJob()
 {
     Func<String[], int> process = (x) =>
     {
         int i = (int)double.Parse(x[0]);
         Thread.Sleep(i*1000);
         return i;
     };
     Random rnd = new Random();
     //Sets cpus to a number between 1-10 both inclusive
     int cpus = rnd.Next(1, 11);
     //Sets the expectedRuntime to a number between 0.0 and 5.0 both inclusive
     double expectedRuntime = rnd.NextDouble() * 5.0;
     Owner jobOwner = new Owner("Christian", 4);
     Job job = new Job(jobOwner, cpus, expectedRuntime, process);
     return job;
 }
示例#3
0
 //Remove a job from a specified queue
 public void RemoveJob(Job job)
 {
     queue.Remove(job);
 }
示例#4
0
 //Adds a specific job to the correct queue
 public void AddJob(Job job)
 {
     queue.Add(job);
     job.TimeStamp = DateTime.Now;
     job.State = JobState.Queued;
 }
示例#5
0
 public void OnJobTerminated(Job job)
 {
     Console.ForegroundColor = ConsoleColor.Red;
     Console.WriteLine(string.Format("Job terminated: {0}", job));
     ResetConsole();
 }
示例#6
0
 public void OnJobSubmitted(Job job)
 {
     //Console.WriteLine(string.Format("Job submitted: {0}", job));
 }
示例#7
0
 public void OnJobRunning(Job job)
 {
     Console.ForegroundColor = ConsoleColor.Green;
     Console.WriteLine(string.Format("Job running: {0}", job));
     ResetConsole();
 }
示例#8
0
 public void OnJobFailed(Job job)
 {
     Console.WriteLine(string.Format("Job failed: {0}", job));
 }
示例#9
0
 public void OnJobCancelled(Job job)
 {
     Console.WriteLine(string.Format("Job cancelled: {0}", job));
 }
示例#10
0
 /// <summary>
 /// Submit a job to the benchmarksystem
 /// </summary>
 /// <param name="job">The job to submit</param>
 public void Submit(Job job)
 {
     scheduler.AddJob(job);
     //Notify subscribers
     if (JobSubmitted != null)
     {
         JobSubmitted(job);
     }
 }