def _get_all_jobs(self, repo_name, revision): """ Return a list with all jobs for that revision. If we can't query about this revision in buildapi we return an empty list. """ if (repo_name, revision) not in JOBS_CACHE: JOBS_CACHE[(repo_name, revision)] = \ buildapi.query_jobs_schedule(repo_name, revision) return JOBS_CACHE[(repo_name, revision)]
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) all_jobs = buildapi.query_jobs_schedule(repo_name, revision) jobs = _matching_jobs(buildername, all_jobs) # 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
def query_jobs(repo_name, revision): """Return list of jobs scheduling information for a revision.""" return buildapi.query_jobs_schedule(repo_name, revision)
dest="debug", help="set debug for logging.") options = parser.parse_args() if options.debug: LOG.setLevel(logging.DEBUG) LOG.info("Setting DEBUG level") else: 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({