def query_jobs_buildername(buildername, revision): """Return **status** information for a buildername on a given revision.""" # NOTE: It's unfortunate that there is scheduling and status data. # I think we might need to remove this distinction for the user's # sake. status_info = [] repo_name = query_repo_name_from_buildername(buildername) query_api = BuildApi() jobs = query_api.get_matching_jobs(repo_name, revision, buildername) # The user wants the status data rather than the scheduling data for job_schedule_info in jobs: status_info.append(_status_info(job_schedule_info)) return status_info
LOG.setLevel(logging.INFO) # requests is too noisy and adds no value logging.getLogger("requests").setLevel(logging.WARNING) repo_name = query_repo_name_from_buildername(options.buildername) all_jobs = query_jobs_schedule(repo_name, options.rev) jobs = _matching_jobs(options.buildername, all_jobs) import pprint for schedule_info in jobs: status = query_job_status(schedule_info) if status == COALESCED: print "%d %s %s/%s/build/%s" % \ (schedule_info["requests"][0]["request_id"], RESULTS[status], HOST_ROOT, repo_name, schedule_info["build_id"]) status_info = _status_info(schedule_info) pprint.pprint(status_info) revision = status_info["properties"]["revision"] # Print the job that was coalesced with print 'https://treeherder.mozilla.org/#/jobs?%s' % \ (urllib.urlencode({ 'repo': repo_name, 'fromchange': schedule_info["revision"][0:12], 'tochange': revision[0:12], 'filter-searchStr': options.buildername, 'filter-resultStatus': ['success', 'testfailed', 'busted', 'exception', 'retry', 'usercancel', 'running', 'pending', 'coalesced']}, True)) print "Status of all jobs (success, pending, running, coalesced)" print _status_summary(jobs)