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

Side by Side Diff: appengine/chromium_rietveld/codereview/views_chromium.py

Issue 1344253002: Rietveld: schedule builds on buildbucket (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 5 years, 3 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
OLDNEW
1 # Copyright 2008 Google Inc. 1 # Copyright 2008 Google Inc.
2 # 2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); 3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License. 4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at 5 # You may obtain a copy of the License at
6 # 6 #
7 # http://www.apache.org/licenses/LICENSE-2.0 7 # http://www.apache.org/licenses/LICENSE-2.0
8 # 8 #
9 # Unless required by applicable law or agreed to in writing, software 9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, 10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and 12 # See the License for the specific language governing permissions and
13 # limitations under the License. 13 # limitations under the License.
14 14
15 """Views for Chromium port of Rietveld.""" 15 """Views for Chromium port of Rietveld."""
16 16
17 import datetime 17 import datetime
18 import logging 18 import logging
19 import random
19 import re 20 import re
20 21
21 from google.appengine.api import app_identity 22 from google.appengine.api import app_identity
22 from google.appengine.api import datastore_errors 23 from google.appengine.api import datastore_errors
23 from google.appengine.api import taskqueue 24 from google.appengine.api import taskqueue
24 from google.appengine.api import urlfetch 25 from google.appengine.api import urlfetch
25 from google.appengine.api import users 26 from google.appengine.api import users
26 from google.appengine.datastore import datastore_query 27 from google.appengine.datastore import datastore_query
27 from google.appengine.ext import ndb 28 from google.appengine.ext import ndb
28 from google.appengine.runtime import DeadlineExceededError 29 from google.appengine.runtime import DeadlineExceededError
29 30
30 from django import forms 31 from django import forms
31 from django.core.urlresolvers import reverse 32 from django.core.urlresolvers import reverse
32 from django.http import HttpResponse, HttpResponseRedirect 33 from django.http import HttpResponse, HttpResponseRedirect
33 from django.http import HttpResponseBadRequest, HttpResponseForbidden 34 from django.http import HttpResponseBadRequest, HttpResponseForbidden
34 from django.http import HttpResponseServerError 35 from django.http import HttpResponseServerError
35 from django.utils import simplejson as json 36 from django.utils import simplejson as json
36 37
38 from codereview import buildbucket
37 from codereview import decorators as deco 39 from codereview import decorators as deco
38 from codereview import decorators_chromium as deco_cr 40 from codereview import decorators_chromium as deco_cr
39 from codereview import models 41 from codereview import models
40 from codereview import models_chromium 42 from codereview import models_chromium
41 from codereview import responses 43 from codereview import responses
42 from codereview import views 44 from codereview import views
43 45
44 46
45 ### Forms ### 47 ### Forms ###
46 48
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 reason='', 418 reason='',
417 result=models.TryJobResult.TRYPENDING, 419 result=models.TryJobResult.TRYPENDING,
418 master=mastername, 420 master=mastername,
419 builder=buildername, 421 builder=buildername,
420 revision='', 422 revision='',
421 clobber=False) 423 clobber=False)
422 jobs_to_save.append(try_job) 424 jobs_to_save.append(try_job)
423 425
424 # Commit everything. 426 # Commit everything.
425 ndb.put_multi(jobs_to_save) 427 ndb.put_multi(jobs_to_save)
426 ndb.transaction(txn) 428
429 buildbucket_roll_out_percentage = 0.1
430 if random.random() <= buildbucket_roll_out_percentage:
nodir 2015/09/17 04:23:42 Jason: should we use this or gae version splitting
jrobbins 2015/09/17 06:03:13 Yes. I think I would favor GAE version splitting
nodir 2015/09/17 17:44:17 Done.
431 buildbucket.schedule(
432 request.issue,
433 last_patchset.key.id(),
434 [b.split(':', 1) for b in new_builders])
435 else:
436 ndb.transaction(txn)
427 437
428 return HttpResponse('OK', content_type='text/plain') 438 return HttpResponse('OK', content_type='text/plain')
429 439
430 440
431 @deco.login_required 441 @deco.login_required
432 @deco.xsrf_required 442 @deco.xsrf_required
433 def conversions(request): 443 def conversions(request):
434 """/conversions - Show and edit the list of base=>source code URL maps.""" 444 """/conversions - Show and edit the list of base=>source code URL maps."""
435 rules = models_chromium.UrlMap.query().order( 445 rules = models_chromium.UrlMap.query().order(
436 models_chromium.UrlMap.base_url_template).fetch() 446 models_chromium.UrlMap.base_url_template).fetch()
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 next_cursor = query_iter.cursor_after() 800 next_cursor = query_iter.cursor_after()
791 else: 801 else:
792 next_cursor = cursor 802 next_cursor = cursor
793 803
794 logging.info('Found %d entries, returned %d' % (total, len(jobs))) 804 logging.info('Found %d entries, returned %d' % (total, len(jobs)))
795 return { 805 return {
796 'has_more': has_more, 806 'has_more': has_more,
797 'cursor': next_cursor.urlsafe() if next_cursor else '', 807 'cursor': next_cursor.urlsafe() if next_cursor else '',
798 'jobs': jobs 808 'jobs': jobs
799 } 809 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698