| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -375,7 +375,7 @@ def _parse_bucket(raw_bucket):
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return project, bucket
 | 
					 | 
					 | 
					 | 
					  return project, bucket
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					def _trigger_try_jobs(changelist, jobs, options, patchset):
 | 
					 | 
					 | 
					 | 
					def _trigger_tryjobs(changelist, jobs, options, patchset):
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  """Sends a request to Buildbucket to trigger tryjobs for a changelist.
 | 
					 | 
					 | 
					 | 
					  """Sends a request to Buildbucket to trigger tryjobs for a changelist.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  Args:
 | 
					 | 
					 | 
					 | 
					  Args:
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -389,8 +389,7 @@ def _trigger_try_jobs(changelist, jobs, options, patchset):
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  print('To see results here, run:        git cl try-results')
 | 
					 | 
					 | 
					 | 
					  print('To see results here, run:        git cl try-results')
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  print('To see results in browser, run:  git cl web')
 | 
					 | 
					 | 
					 | 
					  print('To see results in browser, run:  git cl web')
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  requests = _make_try_job_schedule_requests(
 | 
					 | 
					 | 
					 | 
					  requests = _make_tryjob_schedule_requests(changelist, jobs, options, patchset)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      changelist, jobs, options, patchset)
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if not requests:
 | 
					 | 
					 | 
					 | 
					  if not requests:
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return
 | 
					 | 
					 | 
					 | 
					    return
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -411,7 +410,7 @@ def _trigger_try_jobs(changelist, jobs, options, patchset):
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        'Failed to schedule builds for some bots:\n%s' % '\n'.join(errors))
 | 
					 | 
					 | 
					 | 
					        'Failed to schedule builds for some bots:\n%s' % '\n'.join(errors))
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					def _make_try_job_schedule_requests(changelist, jobs, options, patchset):
 | 
					 | 
					 | 
					 | 
					def _make_tryjob_schedule_requests(changelist, jobs, options, patchset):
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  gerrit_changes = [changelist.GetGerritChange(patchset)]
 | 
					 | 
					 | 
					 | 
					  gerrit_changes = [changelist.GetGerritChange(patchset)]
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  shared_properties = {'category': getattr(options, 'category', 'git_cl_try')}
 | 
					 | 
					 | 
					 | 
					  shared_properties = {'category': getattr(options, 'category', 'git_cl_try')}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if getattr(options, 'clobber', False):
 | 
					 | 
					 | 
					 | 
					  if getattr(options, 'clobber', False):
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -455,7 +454,7 @@ def _make_try_job_schedule_requests(changelist, jobs, options, patchset):
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return requests
 | 
					 | 
					 | 
					 | 
					  return requests
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					def fetch_try_jobs(changelist, buildbucket_host, patchset=None):
 | 
					 | 
					 | 
					 | 
					def _fetch_tryjobs(changelist, buildbucket_host, patchset=None):
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  """Fetches tryjobs from buildbucket.
 | 
					 | 
					 | 
					 | 
					  """Fetches tryjobs from buildbucket.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  Returns list of buildbucket.v2.Build with the try jobs for the changelist.
 | 
					 | 
					 | 
					 | 
					  Returns list of buildbucket.v2.Build with the try jobs for the changelist.
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -507,7 +506,7 @@ def _fetch_latest_builds(changelist, buildbucket_host, latest_patchset=None):
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  min_ps = max(1, ps - 5)
 | 
					 | 
					 | 
					 | 
					  min_ps = max(1, ps - 5)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  while ps >= min_ps:
 | 
					 | 
					 | 
					 | 
					  while ps >= min_ps:
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    builds = fetch_try_jobs(changelist, buildbucket_host, patchset=ps)
 | 
					 | 
					 | 
					 | 
					    builds = _fetch_tryjobs(changelist, buildbucket_host, patchset=ps)
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if len(builds):
 | 
					 | 
					 | 
					 | 
					    if len(builds):
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      return builds, ps
 | 
					 | 
					 | 
					 | 
					      return builds, ps
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    ps -= 1
 | 
					 | 
					 | 
					 | 
					    ps -= 1
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -518,13 +517,13 @@ def _filter_failed_for_retry(all_builds):
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  """Returns a list of buckets/builders that are worth retrying.
 | 
					 | 
					 | 
					 | 
					  """Returns a list of buckets/builders that are worth retrying.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  Args:
 | 
					 | 
					 | 
					 | 
					  Args:
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    all_builds (list): Builds, in the format returned by fetch_try_jobs,
 | 
					 | 
					 | 
					 | 
					    all_builds (list): Builds, in the format returned by _fetch_tryjobs,
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      i.e. a list of buildbucket.v2.Builds which includes status and builder
 | 
					 | 
					 | 
					 | 
					      i.e. a list of buildbucket.v2.Builds which includes status and builder
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      info.
 | 
					 | 
					 | 
					 | 
					      info.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  Returns:
 | 
					 | 
					 | 
					 | 
					  Returns:
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    A dict {(proj, bucket): [builders]}. This is the same format accepted by
 | 
					 | 
					 | 
					 | 
					    A dict {(proj, bucket): [builders]}. This is the same format accepted by
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    _trigger_try_jobs.
 | 
					 | 
					 | 
					 | 
					    _trigger_tryjobs.
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  """
 | 
					 | 
					 | 
					 | 
					  """
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  grouped = {}
 | 
					 | 
					 | 
					 | 
					  grouped = {}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  for build in all_builds:
 | 
					 | 
					 | 
					 | 
					  for build in all_builds:
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -559,8 +558,8 @@ def _filter_failed_for_retry(all_builds):
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return sorted(jobs)
 | 
					 | 
					 | 
					 | 
					  return sorted(jobs)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					def print_try_jobs(options, builds):
 | 
					 | 
					 | 
					 | 
					def _print_tryjobs(options, builds):
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  """Prints nicely result of fetch_try_jobs."""
 | 
					 | 
					 | 
					 | 
					  """Prints nicely result of _fetch_tryjobs."""
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if not builds:
 | 
					 | 
					 | 
					 | 
					  if not builds:
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    print('No tryjobs scheduled.')
 | 
					 | 
					 | 
					 | 
					    print('No tryjobs scheduled.')
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return
 | 
					 | 
					 | 
					 | 
					    return
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -4400,7 +4399,7 @@ def CMDupload(parser, args):
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if len(jobs) == 0:
 | 
					 | 
					 | 
					 | 
					    if len(jobs) == 0:
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      print('No failed tryjobs, so --retry-failed has no effect.')
 | 
					 | 
					 | 
					 | 
					      print('No failed tryjobs, so --retry-failed has no effect.')
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      return ret
 | 
					 | 
					 | 
					 | 
					      return ret
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    _trigger_try_jobs(cl, jobs, options, patchset + 1)
 | 
					 | 
					 | 
					 | 
					    _trigger_tryjobs(cl, jobs, options, patchset + 1)
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return ret
 | 
					 | 
					 | 
					 | 
					  return ret
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -4716,7 +4715,7 @@ def CMDtry(parser, args):
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  patchset = cl.GetMostRecentPatchset()
 | 
					 | 
					 | 
					 | 
					  patchset = cl.GetMostRecentPatchset()
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  try:
 | 
					 | 
					 | 
					 | 
					  try:
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    _trigger_try_jobs(cl, jobs, options, patchset)
 | 
					 | 
					 | 
					 | 
					    _trigger_tryjobs(cl, jobs, options, patchset)
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  except BuildbucketResponseException as ex:
 | 
					 | 
					 | 
					 | 
					  except BuildbucketResponseException as ex:
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    print('ERROR: %s' % ex)
 | 
					 | 
					 | 
					 | 
					    print('ERROR: %s' % ex)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return 1
 | 
					 | 
					 | 
					 | 
					    return 1
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -4763,14 +4762,14 @@ def CMDtry_results(parser, args):
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                   cl.GetIssue())
 | 
					 | 
					 | 
					 | 
					                   cl.GetIssue())
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  try:
 | 
					 | 
					 | 
					 | 
					  try:
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    jobs = fetch_try_jobs(cl, options.buildbucket_host, patchset)
 | 
					 | 
					 | 
					 | 
					    jobs = _fetch_tryjobs(cl, options.buildbucket_host, patchset)
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  except BuildbucketResponseException as ex:
 | 
					 | 
					 | 
					 | 
					  except BuildbucketResponseException as ex:
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    print('Buildbucket error: %s' % ex)
 | 
					 | 
					 | 
					 | 
					    print('Buildbucket error: %s' % ex)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return 1
 | 
					 | 
					 | 
					 | 
					    return 1
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if options.json:
 | 
					 | 
					 | 
					 | 
					  if options.json:
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    write_json(options.json, jobs)
 | 
					 | 
					 | 
					 | 
					    write_json(options.json, jobs)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  else:
 | 
					 | 
					 | 
					 | 
					  else:
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    print_try_jobs(options, jobs)
 | 
					 | 
					 | 
					 | 
					    _print_tryjobs(options, jobs)
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return 0
 | 
					 | 
					 | 
					 | 
					  return 0
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |