Skip to content

Commit c756d17

Browse files
committed
Make profile path configurable
1 parent 4d06a95 commit c756d17

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

data/tpch_loader.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,15 @@ class TpchLoader(BaseWorkloadLoader):
2727
2828
Args:
2929
path (`str`): Path to a YAML file specifying the TPC-H query DAGs
30+
_flags (`absl.flags`): The flags used to initialize the app, if any
3031
"""
3132
def __init__(self, path: str, _flags: Optional["absl.flags"] = None) -> None:
3233
if _flags:
3334
self._loop_timeout = _flags.loop_timeout
35+
self._workload_profile_path = _flags.workload_profile_path
3436
else:
3537
self._loop_timeout = EventTime(time=sys.maxsize, unit=EventTime.Unit.US)
38+
self._workload_profile_path = "./profiles/workload/tpch/decima/2g"
3639

3740
with open(path, "r") as f:
3841
workload_data = yaml.safe_load(f)
@@ -41,8 +44,11 @@ def __init__(self, path: str, _flags: Optional["absl.flags"] = None) -> None:
4144
for query in workload_data["graphs"]:
4245
query_name = query["name"]
4346
graph = query["graph"]
44-
45-
job_graph = TpchLoader.parse_job_graph(query_name=query_name, graph=graph)
47+
job_graph = TpchLoader.make_job_graph(
48+
query_name=query_name,
49+
graph=graph,
50+
profile_path=self._workload_profile_path,
51+
)
4652
job_graphs[query_name] = job_graph
4753

4854
workload = Workload.from_job_graphs(job_graphs)
@@ -51,7 +57,7 @@ def __init__(self, path: str, _flags: Optional["absl.flags"] = None) -> None:
5157

5258

5359
@staticmethod
54-
def parse_job_graph(query_name: str, graph: List[Dict[str, Any]]) -> JobGraph:
60+
def make_job_graph(query_name: str, graph: List[Dict[str, Any]], profile_path: str) -> JobGraph:
5561
job_graph = JobGraph(
5662
name=query_name,
5763

@@ -66,14 +72,11 @@ def parse_job_graph(query_name: str, graph: List[Dict[str, Any]]) -> JobGraph:
6672
deadline_variance=(0,0),
6773
)
6874

69-
# TODO: make configurable
70-
profiler_path = "./profiles/workload/tpch/decima/2g"
7175
query_num = int(query_name[1:])
72-
profiler_data = TpchLoader.get_profiler_data_for_query(profiler_path, query_num)
76+
profiler_data = TpchLoader.get_profiler_data_for_query(profile_path, query_num)
7377

7478
name_to_job = {}
7579
for node in graph:
76-
# TODO: make profile_path configurable
7780
worker_profile = TpchLoader.load_query_profile(
7881
profiler_data=profiler_data,
7982
query_name=query_name,

0 commit comments

Comments
 (0)