def filenames(self, *, bnum, group_name=None): coverage = self._get_coverage_data(bnum=bnum) if not coverage: return None rawnames = [] do_sort = False if group_name is not None and group_name != "All Files": rawnames = self.file_groups.expand(name=group_name) else: # Load all file names available in coverage do_sort = True rawnames = coverage.keys() # Reduce to just final two path components filenames = [] have_total = False for key in rawnames: name = MongoDB.decode_key(key) if name == 'totals': have_total = True continue fields = name.split('/') if len(fields) < 2: raise Exception("Incomprehensible: {}".format(name)) filename = "{}/{}".format(fields[-2], fields[-1]) if filename in filenames: raise Exception("Duplicate: {}".format(filename)) filenames.append(filename) if do_sort: filenames.sort() if have_total: filenames.insert(0, "Total") return filenames
def filenames(self, *, bnum, group_name=None): coverage = self._get_coverage_data(bnum=bnum) if not coverage: return None rawnames = [] do_sort = False if group_name is not None and group_name != "All Files": rawnames = self.file_groups.expand(name=group_name) else: do_sort = True rawnames = sorted(coverage.keys()) have_total = False # Reduce a URL to just a filename filenames = [] for key in rawnames: url = MongoDB.decode_key(key) if url == 'Total': have_total = True continue fields = url.split('/') if len(fields) < 2: raise Exception("Incomprehensible: {}".format(url)) filename = "{}/{}".format(fields[-2], fields[-1]) if filename in filenames: raise Exception("Duplicate: {}".format(filename)) filenames.append(filename) if do_sort: filenames.sort() if have_total: filenames.insert(0, "Total") return filenames
def coverage(self, *, bnum, filename): coverage = self._get_coverage_data(bnum=bnum) if not coverage: return None for key,data in coverage.items(): url = MongoDB.decode_key(key) if filename.lower() in url.lower(): return coverage[key].get('covered_pct', None) return None
def coverage(self, *, bnum, filename): """ XXXrs - FUTURE - extend to return other than "lines" percentage. """ if filename == "Total": filename = "totals" coverage = self._get_coverage_data(bnum=bnum) if not coverage: return None for key, data in coverage.items(): name = MongoDB.decode_key(key) if filename in name: return coverage[key].get('lines', {}).get('percent', None) return None
if args.daily: cur_day = day cur_data = {} flush = False job_name = binfo.pop('job_name') jdc = get_job_data_collection(job_name=job_name) build_number = binfo.pop('build_number') build_data = jdc.get_data(bnum=build_number) for sub in sub_blocks: if sub in build_data: if sub == 'analyzed_cores': fixed = {} for key, item in build_data[sub].items(): key = MongoDB.decode_key(key) fixed[key] = item build_data[sub] = fixed cur_data.setdefault(sub, {}).setdefault( job_name, {})[build_number] = build_data.pop(sub) cur_data.setdefault('builds', {}).setdefault(job_name, {})[build_number] = build_data if cur_data: write_data(outdir=args.outdir, year=cur_year, month=cur_month, day=cur_day, data=cur_data)