def get_hashcode(self): """The GAF datasource has to adjust its key based on the internal tx mode. set_hashcode sends in an initial hashcode, which is then adjusted by tx-mode """ hasher = Hasher() hasher.update(self.hashcode) hasher.update(self.get_tx_mode()) return hasher.hexdigest()
def create_db_dir_key(self): """Create the db_dir_key for this annotation configuration. Requires the datasources.""" self.logger.info("Generating db-dir key from datasources...") hasher = Hasher() for ds in self._datasources: self.logger.info(ds.title + " " + ds.version + " md5: " + ds.get_hashcode()) hasher.update(ds.get_hashcode()) db_dir_key = Hasher.md5_hash(hasher.hexdigest()) self.logger.info("Final db-dir md5: " + db_dir_key) return db_dir_key
def get_hashcode(self): """ Since this class can change annotation values depending on certain state attributes (e.g. tx-mode), we need the hashcode to change. The super class hashcode attribute is treated like an initial hashcode here. In other words, hashcode is not a simple attribute for this datasource class. :return: hashcode including state information """ hasher = Hasher() attrs_relevant_for_caching = [self.hashcode, self.get_tx_mode(), str(self._custom_canonical_txs)] for attr in attrs_relevant_for_caching: hasher.update(attr) return Hasher.md5_hash(hasher.hexdigest())