This is an automated email from the ASF dual-hosted git repository. tvb pushed a commit to branch tristan/one-cache-size-job-2 in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 9f95650218002cd7abfbe516c142e5be28988883 Author: Tristan Van Berkom <[email protected]> AuthorDate: Sun Jan 6 14:21:00 2019 -0500 _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. --- buildstream/_scheduler/scheduler.py | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/buildstream/_scheduler/scheduler.py b/buildstream/_scheduler/scheduler.py index b76c730..8facb08 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() #
