This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch phil/712
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 9e60c9ba226a7e7bc52c64f8155bc5105db7126e
Author: Phil Dawson <[email protected]>
AuthorDate: Tue Nov 27 15:20:28 2018 +0000

    Revert "WIP: use priority queue in schedular"
    
    This reverts commit 34395d069f1fe78c0d50af6255d2a62c68fbde95.
---
 buildstream/_scheduler/jobs/cachesizejob.py |  3 ---
 buildstream/_scheduler/jobs/cleanupjob.py   |  3 ---
 buildstream/_scheduler/jobs/elementjob.py   | 10 ----------
 buildstream/_scheduler/jobs/job.py          |  4 ----
 buildstream/_scheduler/scheduler.py         |  5 ++---
 setup.py                                    |  1 -
 6 files changed, 2 insertions(+), 24 deletions(-)

diff --git a/buildstream/_scheduler/jobs/cachesizejob.py 
b/buildstream/_scheduler/jobs/cachesizejob.py
index 17ccb0a..d46fd4c 100644
--- a/buildstream/_scheduler/jobs/cachesizejob.py
+++ b/buildstream/_scheduler/jobs/cachesizejob.py
@@ -39,6 +39,3 @@ class CacheSizeJob(Job):
 
     def child_process_data(self):
         return {}
-
-    def key(self):
-        return (100, 'cache-size')
diff --git a/buildstream/_scheduler/jobs/cleanupjob.py 
b/buildstream/_scheduler/jobs/cleanupjob.py
index 3e860e2..8bdbba0 100644
--- a/buildstream/_scheduler/jobs/cleanupjob.py
+++ b/buildstream/_scheduler/jobs/cleanupjob.py
@@ -32,6 +32,3 @@ class CleanupJob(Job):
     def parent_complete(self, success, result):
         if success:
             self._artifacts.set_cache_size(result)
-
-    def key(self):
-        return (0, 'cleanup')
diff --git a/buildstream/_scheduler/jobs/elementjob.py 
b/buildstream/_scheduler/jobs/elementjob.py
index 1d6305c..8ce5c06 100644
--- a/buildstream/_scheduler/jobs/elementjob.py
+++ b/buildstream/_scheduler/jobs/elementjob.py
@@ -22,13 +22,6 @@ from ..._message import Message, MessageType
 
 from .job import Job
 
-_ACTIONS = {
-    "Build": 10,
-    "Fetch": 20,
-    "Pull": 30,
-    "Push": 40,
-    "Track": 50,
-}
 
 # ElementJob()
 #
@@ -120,6 +113,3 @@ class ElementJob(Job):
             data['workspace'] = workspace.to_dict()
 
         return data
-
-    def key(self):
-        return (_ACTIONS.get(self.action_name, 100), self._element.name)
diff --git a/buildstream/_scheduler/jobs/job.py 
b/buildstream/_scheduler/jobs/job.py
index ff0ea83..60ae0d0 100644
--- a/buildstream/_scheduler/jobs/job.py
+++ b/buildstream/_scheduler/jobs/job.py
@@ -353,10 +353,6 @@ class Job():
     def child_process_data(self):
         return {}
 
-    def key(self):
-        raise ImplError("Job '{kind}' does not implement key()"
-                        .format(kind=type(self).__name__))
-
     #######################################################
     #                  Local Private Methods              #
     #######################################################
diff --git a/buildstream/_scheduler/scheduler.py 
b/buildstream/_scheduler/scheduler.py
index 6b849f3..b76c730 100644
--- a/buildstream/_scheduler/scheduler.py
+++ b/buildstream/_scheduler/scheduler.py
@@ -25,7 +25,6 @@ from itertools import chain
 import signal
 import datetime
 from contextlib import contextmanager
-from sortedcontainers import SortedList
 
 # Local imports
 from .resources import Resources, ResourceType
@@ -73,7 +72,7 @@ class Scheduler():
         # Public members
         #
         self.active_jobs = []       # Jobs currently being run in the scheduler
-        self.waiting_jobs = SortedList([], key=lambda job: job.key())  # Jobs 
waiting for resources
+        self.waiting_jobs = []      # Jobs waiting for resources
         self.queues = None          # Exposed for the frontend to print 
summaries
         self.context = context      # The Context object shared with Queues
         self.terminated = False     # Whether the scheduler was asked to 
terminate or has terminated
@@ -223,7 +222,7 @@ class Scheduler():
     #
     def schedule_jobs(self, jobs):
         for job in jobs:
-            self.waiting_jobs.add(job)
+            self.waiting_jobs.append(job)
 
     # job_completed():
     #
diff --git a/setup.py b/setup.py
index 95d9204..76610f0 100755
--- a/setup.py
+++ b/setup.py
@@ -343,7 +343,6 @@ setup(name='BuildStream',
           'jinja2 >= 2.10',
           'protobuf >= 3.5',
           'grpcio >= 1.10',
-          'sortedcontainers >= 1.5.7',
       ],
       entry_points=bst_install_entry_points,
       tests_require=dev_requires,

Reply via email to