diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-01-06 14:21:00 -0500 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-01-07 13:02:00 -0500 |
commit | 059035b90a8fe6d0fdb861f1f3987d9c2773a137 (patch) | |
tree | 3c8fc186b7d531f55e61ac575c88bf6a2659db9b /buildstream | |
parent | 5de42d43061160ddcd62e8bb6ea3dc3ea151ab07 (diff) | |
download | buildstream-059035b90a8fe6d0fdb861f1f3987d9c2773a137.tar.gz |
_scheduler/scheduler.py: Make _schedule_jobs() private
This is not used anywhere outside of the Scheduler, currently
only the Scheduler itself is allowed to queue a job at this level.
If the highlevel business logic for automatic queueing of auxiliary
jobs moves to another location, we can make this public again.
Diffstat (limited to 'buildstream')
-rw-r--r-- | buildstream/_scheduler/scheduler.py | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/buildstream/_scheduler/scheduler.py b/buildstream/_scheduler/scheduler.py index b76c7308e..8facb085a 100644 --- a/buildstream/_scheduler/scheduler.py +++ b/buildstream/_scheduler/scheduler.py @@ -211,19 +211,6 @@ class Scheduler(): starttime = timenow return timenow - starttime - # schedule_jobs() - # - # Args: - # jobs ([Job]): A list of jobs to schedule - # - # Schedule 'Job's for the scheduler to run. Jobs scheduled will be - # run as soon any other queueing jobs finish, provided sufficient - # resources are available for them to run - # - def schedule_jobs(self, jobs): - for job in jobs: - self.waiting_jobs.append(job) - # job_completed(): # # Called when a Job completes @@ -257,7 +244,7 @@ class Scheduler(): resources=[ResourceType.CACHE, ResourceType.PROCESS], complete_cb=self._run_cleanup) - self.schedule_jobs([job]) + self._schedule_jobs([job]) ####################################################### # Local Private Methods # @@ -287,6 +274,21 @@ class Scheduler(): if not self.active_jobs and not self.waiting_jobs: self.loop.stop() + # _schedule_jobs() + # + # The main entry point for jobs to be scheduled. + # + # This is called either as a result of scanning the queues + # in _schedule_queue_jobs(), or directly by the Scheduler + # to insert special jobs like cleanups. + # + # Args: + # jobs ([Job]): A list of jobs to schedule + # + def _schedule_jobs(self, jobs): + for job in jobs: + self.waiting_jobs.append(job) + # _schedule_queue_jobs() # # Ask the queues what jobs they want to schedule and schedule @@ -331,7 +333,7 @@ class Scheduler(): # the next queue and process them. process_queues = any(q.dequeue_ready() for q in self.queues) - self.schedule_jobs(ready) + self._schedule_jobs(ready) self._sched() # _run_cleanup() @@ -357,7 +359,7 @@ class Scheduler(): resources=[ResourceType.CACHE, ResourceType.PROCESS], exclusive_resources=[ResourceType.CACHE]) - self.schedule_jobs([job]) + self._schedule_jobs([job]) # _suspend_jobs() # |