Esempio n. 1
0
        bool CanStartJob(Job job, bool pausedJob)
        {
            if (!job.IsScheduled && !(pausedJob && job.IsPaused))
            {
                return(false);
            }

            if (job.Has(PriorityHints.SpeedSensitive))
            {
                return(true);
            }

            // Run only one non-SpeedSensitive job that uses a given Resource
            if (job.Has(PriorityHints.LongRunning))
            {
                return(jobs.Where(IsRunning)
                       .SharingResourceWith(job)
                       .Any() == false);
            }

            // With the exception that non-LongRunning jobs will preempt LongRunning ones
            return(jobs.Where(IsRunning)
                   .Without(PriorityHints.LongRunning)
                   .SharingResourceWith(job)
                   .Any() == false);
        }
Esempio n. 2
0
        IEnumerable <Job> ConflictingJobs(Job job)
        {
            if (job.Has(PriorityHints.SpeedSensitive))
            {
                // Preempt non-SpeedSensitive jobs that use the same Resource(s)
                return(jobs.Where(IsRunning)
                       .Without(PriorityHints.SpeedSensitive)
                       .SharingResourceWith(job));
            }
            else if (!job.Has(PriorityHints.LongRunning))
            {
                // Preempt any LongRunning jobs that use the same Resource(s)
                return(jobs.Where(IsRunning)
                       .With(PriorityHints.LongRunning)
                       .SharingResourceWith(job));
            }

            return(Enumerable.Empty <Job> ());
        }
 private void AddJob(Job job)
 {
     if (job.Has (PriorityHints.DataLossIfStopped)) {
         ThreadAssist.ProxyToMain (delegate {
             TreeIter iter = (ListView.Model as ListStore).Prepend ();
             (ListView.Model as ListStore).SetValue (iter, 0, job.Title);
             (ListView.Model as ListStore).SetValue (iter, 1, job);
         });
     }
 }
Esempio n. 4
0
        private IEnumerable<Job> ConflictingJobs (Job job)
        {
            if (job.Has (PriorityHints.SpeedSensitive)) {
                // Preempt non-SpeedSensitive jobs that use the same Resource(s)
                return jobs.Where (IsRunning)
                           .Without (PriorityHints.SpeedSensitive)
                           .SharingResourceWith (job);
            } else if (!job.Has (PriorityHints.LongRunning)) {
                // Preempt any LongRunning jobs that use the same Resource(s)
                return jobs.Where (IsRunning)
                           .With (PriorityHints.LongRunning)
                           .SharingResourceWith (job);
            }

            return Enumerable.Empty<Job> ();
        }
Esempio n. 5
0
        private bool CanStartJob (Job job, bool pausedJob)
        {
            if (!job.IsScheduled && !(pausedJob && job.IsPaused))
                return false;

            if (job.Has (PriorityHints.SpeedSensitive))
                return true;

            // Run only one non-SpeedSensitive job that uses a given Resource
            if (job.Has (PriorityHints.LongRunning))
                return jobs.Where (IsRunning)
                           .SharingResourceWith (job)
                           .Any () == false;

            // With the exception that non-LongRunning jobs will preempt LongRunning ones
            return jobs.Where (IsRunning)
                       .Without (PriorityHints.LongRunning)
                       .SharingResourceWith (job)
                       .Any () == false;
        }