def get_touched_together_db(): global touched_together if touched_together is None: touched_together = LMDBDict( os.path.join("data", TOUCHED_TOGETHER_DB[: -len(".tar.zst")]) ) return touched_together
def get_failing_together_db(): global failing_together if failing_together is None: failing_together = LMDBDict( os.path.join("data", FAILING_TOGETHER_LABEL_DB[: -len(".tar.zst")]) ) return failing_together
def get_touched_together_db(readonly: bool) -> LMDBDict: global touched_together if touched_together is None: touched_together = LMDBDict( os.path.join("data", TOUCHED_TOGETHER_DB[:-len(".tar.zst")]), readonly=readonly, ) return touched_together
def __init__(self, save): self.save = save self.db_experiences = shelve.Shelf( LMDBDict("data/commit_experiences.lmdb"), protocol=pickle.DEFAULT_PROTOCOL, writeback=save, ) if not save: self.mem_experiences = {}
def get_touched_together_db(): global touched_together if touched_together is None: touched_together = shelve.Shelf( LMDBDict(os.path.join("data", TOUCHED_TOGETHER_DB[: -len(".tar.zst")])), protocol=pickle.DEFAULT_PROTOCOL, writeback=True, ) return touched_together
def get_past_failures(granularity): if granularity == "label": past_failures_db = os.path.join("data", PAST_FAILURES_LABEL_DB) elif granularity == "group": past_failures_db = os.path.join("data", PAST_FAILURES_GROUP_DB) else: raise Exception(f"{granularity} granularity unsupported") return shelve.Shelf( LMDBDict(past_failures_db[:-len(".tar.zst")]), protocol=pickle.DEFAULT_PROTOCOL, writeback=True, )
def __init__(self, save): self.save = save try: self.db_experiences = shelve.Shelf( LMDBDict("data/commit_experiences.lmdb", readonly=not save), protocol=pickle.DEFAULT_PROTOCOL, writeback=save, ) except lmdb.Error as e: if not save and "No such file or directory" in str(e): self.db_experiences = {} else: raise if not save: self.mem_experiences = {}
def get_component_mapping(readonly=True): global path_to_component path_to_component = LMDBDict("data/component_mapping.lmdb", readonly=readonly) return path_to_component
def get_past_failures(): return shelve.Shelf( LMDBDict("data/past_failures.lmdb"), protocol=pickle.HIGHEST_PROTOCOL, writeback=True, )
def get_coverage_mapping(readonly: bool = True) -> LMDBDict: global commit_to_coverage commit_to_coverage = LMDBDict("data/coverage_mapping.lmdb", readonly=readonly) return commit_to_coverage
def get_failing_together_db(granularity: str, readonly: bool) -> LMDBDict: global failing_together if granularity not in failing_together: failing_together[granularity] = LMDBDict( get_failing_together_db_path(granularity), readonly=readonly) return failing_together[granularity]
def get_failing_together_db(granularity: str) -> LMDBDict: return LMDBDict(get_failing_together_db_path(granularity))