Use an OrderedDict for pipelines

So that status displays will show pipelines in the order defined
in the config file.

Change-Id: I2913c94dd44f4443f5bdca54241fd1af027258a8
This commit is contained in:
James E. Blair 2013-08-27 10:06:27 -07:00
parent b98fcdb499
commit 5a9918ae4b
3 changed files with 6 additions and 3 deletions

View File

@ -9,6 +9,7 @@ WebOb
paramiko paramiko
GitPython>=0.3.2.RC1 GitPython>=0.3.2.RC1
lockfile lockfile
ordereddict
python-daemon python-daemon
extras extras
statsd>=1.0.0,<3.0 statsd>=1.0.0,<3.0

View File

@ -15,6 +15,10 @@
import re import re
import time import time
from uuid import uuid4 from uuid import uuid4
import extras
OrderedDict = extras.try_imports(['collections.OrderedDict',
'ordereddict.OrderedDict'])
MERGER_MERGE = 1 # "git merge" MERGER_MERGE = 1 # "git merge"
@ -916,7 +920,7 @@ class EventFilter(object):
class Layout(object): class Layout(object):
def __init__(self): def __init__(self):
self.projects = {} self.projects = {}
self.pipelines = {} self.pipelines = OrderedDict()
self.jobs = {} self.jobs = {}
self.metajobs = [] self.metajobs = []

View File

@ -600,7 +600,6 @@ class Scheduler(threading.Thread):
ret += '</p>' ret += '</p>'
keys = self.layout.pipelines.keys() keys = self.layout.pipelines.keys()
keys.sort()
for key in keys: for key in keys:
pipeline = self.layout.pipelines[key] pipeline = self.layout.pipelines[key]
s = 'Pipeline: %s' % pipeline.name s = 'Pipeline: %s' % pipeline.name
@ -631,7 +630,6 @@ class Scheduler(threading.Thread):
pipelines = [] pipelines = []
data['pipelines'] = pipelines data['pipelines'] = pipelines
keys = self.layout.pipelines.keys() keys = self.layout.pipelines.keys()
keys.sort()
for key in keys: for key in keys:
pipeline = self.layout.pipelines[key] pipeline = self.layout.pipelines[key]
pipelines.append(pipeline.formatStatusJSON()) pipelines.append(pipeline.formatStatusJSON())