in scheduler.py [0:0]
def __init__(self, dir_path, table_size_path, weight_lookup=None,
yugong=False, ownership=None):
assert os.path.exists(dir_path), f"dir_path={dir_path} not found"
self.dir_path = dir_path
logging.info(f"dir_path: {dir_path}, yugong mode: {yugong}")
self.yugong = yugong
if self.yugong:
assert ownership is not None, "ownership is None"
self.ownership = ownership
# load template and dataset placements
# query_kv = self._load_query_placement()
# self.query_map = Cache(maxsize=len(query_kv) // 100, kv_store=query_kv)
# logging.info(f"# of query placements: {len(query_kv)}")
self.query_map = self._load_query_placement()
logging.info(f"# of query placements: {len(self.query_map)}")
self.dataset_map = self._load_dataset_placement()
logging.info(f"# of dataset placements: {len(self.dataset_map)}")
# load table sizes
logging.info(f"Loaded table size: {table_size_path}")
self.table_size_map = self._load_table_sizes(table_size_path)
self.size_lookup = None
self.db_table_size = None
self.weight_lookup = weight_lookup
# historical workload
self.stat_cloud_query = Stat("cloud queries")
self.stat_on_prem_query = Stat("on-prem queries")
self.stat_categories = {
"both_sides": Stat("Old queries with tables on both sides"), # all_table_local & all_table_cloud == True
"only_cloud": Stat("Old queries with all tables on cloud"), # all_table_local == False and all_table_cloud == True
"only_onprem": Stat("Old queries with all tables on-prem"), # all_table_local == True and all_table_cloud == False
"needs_transfer": Stat("Old queries requiring ingress/egress"), # all_table_local == False and all_table_cloud == False
}
self.stat_categories_new = {
"both_sides": Stat("New queries with tables on both sides"), # all_table_local & all_table_cloud == True
"only_cloud": Stat("New queries with all tables on cloud"),
# all_table_local == False and all_table_cloud == True
"only_onprem": Stat("New queries with all tables on-prem"),
# all_table_local == True and all_table_cloud == False
"needs_transfer": Stat("New queries requiring ingress/egress"),
# all_table_local == False and all_table_cloud == False
}