/// <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); } }
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; }
//Remove a job from a specified queue public void RemoveJob(Job job) { queue.Remove(job); }
//Adds a specific job to the correct queue public void AddJob(Job job) { queue.Add(job); job.TimeStamp = DateTime.Now; job.State = JobState.Queued; }
public void OnJobTerminated(Job job) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(string.Format("Job terminated: {0}", job)); ResetConsole(); }
public void OnJobSubmitted(Job job) { //Console.WriteLine(string.Format("Job submitted: {0}", job)); }
public void OnJobRunning(Job job) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(string.Format("Job running: {0}", job)); ResetConsole(); }
public void OnJobFailed(Job job) { Console.WriteLine(string.Format("Job failed: {0}", job)); }
public void OnJobCancelled(Job job) { Console.WriteLine(string.Format("Job cancelled: {0}", job)); }
/// <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); } }