Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: Tools/TestResultServer/handlers/buildershandler.py

Issue 26601003: Fix get_latest_build to return actual latest build (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: remove redundant test. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Tools/TestResultServer/handlers/buildershandler_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 def get_latest_build(build_data): 84 def get_latest_build(build_data):
85 cached_builds = [] 85 cached_builds = []
86 if 'cachedBuilds' in build_data: 86 if 'cachedBuilds' in build_data:
87 cached_builds = build_data['cachedBuilds'] 87 cached_builds = build_data['cachedBuilds']
88 88
89 current_builds = build_data['currentBuilds'] 89 current_builds = build_data['currentBuilds']
90 90
91 latest_cached_builds = set(cached_builds) - set(current_builds) 91 latest_cached_builds = set(cached_builds) - set(current_builds)
92 if len(latest_cached_builds) != 0: 92 if len(latest_cached_builds) != 0:
93 latest_build = list(latest_cached_builds)[-1] 93 latest_cached_builds = sorted(list(latest_cached_builds))
94 latest_build = latest_cached_builds[-1]
94 elif len(current_builds) != 0: 95 elif len(current_builds) != 0:
95 latest_build = current_builds[0] 96 latest_build = current_builds[0]
96 else: 97 else:
97 basedir = build_data['basedir'] if 'basedir' in build_data else 'current builder' 98 basedir = build_data['basedir'] if 'basedir' in build_data else 'current builder'
98 logging.info('No cached or current builds for %s', basedir) 99 logging.info('No cached or current builds for %s', basedir)
99 return None 100 return None
100 101
101 return latest_build 102 return latest_build
102 103
103 104
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 buildbot_data = fetch_buildbot_data(MASTERS) 166 buildbot_data = fetch_buildbot_data(MASTERS)
166 try: 167 try:
167 memcache.set('buildbot_data', buildbot_data) 168 memcache.set('buildbot_data', buildbot_data)
168 except ValueError, err: 169 except ValueError, err:
169 logging.error(str(err)) 170 logging.error(str(err))
170 171
171 if callback: 172 if callback:
172 buildbot_data = callback + '(' + buildbot_data + ');' 173 buildbot_data = callback + '(' + buildbot_data + ');'
173 174
174 self.response.out.write(buildbot_data) 175 self.response.out.write(buildbot_data)
OLDNEW
« no previous file with comments | « no previous file | Tools/TestResultServer/handlers/buildershandler_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698