11import logging
22
33import click
4- from gymlib .symlinks_paths import (
4+ from gymlib .infra_paths import (
55 get_scale_factor_string ,
66 get_tables_dirname ,
77 get_tables_symlink_path ,
88 get_workload_suffix ,
99 get_workload_symlink_path ,
10+ )
11+ from gymlib .workspace import (
12+ DBGymWorkspace ,
13+ fully_resolve_path ,
14+ is_fully_resolved ,
1015 linkname_to_name ,
1116 name_to_linkname ,
1217)
1318
1419from benchmark .constants import DEFAULT_SCALE_FACTOR
1520from benchmark .tpch .constants import DEFAULT_TPCH_SEED , NUM_TPCH_QUERIES
16- from util .log import DBGYM_LOGGER_NAME
1721from util .shell import subprocess_run
18- from util .workspace import DBGymWorkspace , fully_resolve_path , is_fully_resolved
1922
2023TPCH_KIT_DIRNAME = "tpch-kit"
2124
@@ -102,12 +105,10 @@ def _clone_tpch_kit(dbgym_workspace: DBGymWorkspace) -> None:
102105 name_to_linkname (TPCH_KIT_DIRNAME )
103106 )
104107 if expected_symlink_path .exists ():
105- logging .getLogger (DBGYM_LOGGER_NAME ).info (
106- f"Skipping clone: { expected_symlink_path } "
107- )
108+ logging .info (f"Skipping clone: { expected_symlink_path } " )
108109 return
109110
110- logging .getLogger ( DBGYM_LOGGER_NAME ). info (f"Cloning: { expected_symlink_path } " )
111+ logging .info (f"Cloning: { expected_symlink_path } " )
111112 subprocess_run (
112113 f"./clone_tpch_kit.sh { dbgym_workspace .dbgym_this_run_path } " ,
113114 cwd = dbgym_workspace .base_dbgym_repo_path / "benchmark" / "tpch" ,
@@ -116,7 +117,7 @@ def _clone_tpch_kit(dbgym_workspace: DBGymWorkspace) -> None:
116117 dbgym_workspace .dbgym_this_run_path / TPCH_KIT_DIRNAME
117118 )
118119 assert expected_symlink_path .samefile (symlink_path )
119- logging .getLogger ( DBGYM_LOGGER_NAME ). info (f"Cloned: { expected_symlink_path } " )
120+ logging .info (f"Cloned: { expected_symlink_path } " )
120121
121122
122123def _generate_tpch_queries (
@@ -125,9 +126,7 @@ def _generate_tpch_queries(
125126 tpch_kit_path = dbgym_workspace .dbgym_cur_symlinks_path / (
126127 name_to_linkname (TPCH_KIT_DIRNAME )
127128 )
128- logging .getLogger (DBGYM_LOGGER_NAME ).info (
129- f"Generating queries: [{ seed_start } , { seed_end } ]"
130- )
129+ logging .info (f"Generating queries: [{ seed_start } , { seed_end } ]" )
131130 for seed in range (seed_start , seed_end + 1 ):
132131 expected_queries_symlink_path = dbgym_workspace .dbgym_cur_symlinks_path / (
133132 name_to_linkname (_get_queries_dirname (seed , scale_factor ))
@@ -149,9 +148,7 @@ def _generate_tpch_queries(
149148 )
150149 queries_symlink_path = dbgym_workspace .link_result (queries_parent_path )
151150 assert queries_symlink_path .samefile (expected_queries_symlink_path )
152- logging .getLogger (DBGYM_LOGGER_NAME ).info (
153- f"Generated queries: [{ seed_start } , { seed_end } ]"
154- )
151+ logging .info (f"Generated queries: [{ seed_start } , { seed_end } ]" )
155152
156153
157154def _generate_tpch_tables (dbgym_workspace : DBGymWorkspace , scale_factor : float ) -> None :
@@ -162,14 +159,10 @@ def _generate_tpch_tables(dbgym_workspace: DBGymWorkspace, scale_factor: float)
162159 dbgym_workspace .dbgym_workspace_path , "tpch" , scale_factor
163160 )
164161 if expected_tables_symlink_path .exists ():
165- logging .getLogger (DBGYM_LOGGER_NAME ).info (
166- f"Skipping generation: { expected_tables_symlink_path } "
167- )
162+ logging .info (f"Skipping generation: { expected_tables_symlink_path } " )
168163 return
169164
170- logging .getLogger (DBGYM_LOGGER_NAME ).info (
171- f"Generating: { expected_tables_symlink_path } "
172- )
165+ logging .info (f"Generating: { expected_tables_symlink_path } " )
173166 subprocess_run (f"./dbgen -vf -s { scale_factor } " , cwd = tpch_kit_path / "dbgen" )
174167 tables_parent_path = dbgym_workspace .dbgym_this_run_path / get_tables_dirname (
175168 "tpch" , scale_factor
@@ -179,9 +172,7 @@ def _generate_tpch_tables(dbgym_workspace: DBGymWorkspace, scale_factor: float)
179172
180173 tables_symlink_path = dbgym_workspace .link_result (tables_parent_path )
181174 assert tables_symlink_path .samefile (expected_tables_symlink_path )
182- logging .getLogger (DBGYM_LOGGER_NAME ).info (
183- f"Generated: { expected_tables_symlink_path } "
184- )
175+ logging .info (f"Generated: { expected_tables_symlink_path } " )
185176
186177
187178def _generate_tpch_workload (
@@ -200,14 +191,10 @@ def _generate_tpch_workload(
200191 ),
201192 )
202193 if expected_workload_symlink_path .exists ():
203- logging .getLogger (DBGYM_LOGGER_NAME ).info (
204- f"Skipping generation: { expected_workload_symlink_path } "
205- )
194+ logging .info (f"Skipping generation: { expected_workload_symlink_path } " )
206195 return
207196
208- logging .getLogger (DBGYM_LOGGER_NAME ).info (
209- f"Generating: { expected_workload_symlink_path } "
210- )
197+ logging .info (f"Generating: { expected_workload_symlink_path } " )
211198 workload_path = dbgym_workspace .dbgym_this_run_path / linkname_to_name (
212199 expected_workload_symlink_path .name
213200 )
@@ -238,6 +225,4 @@ def _generate_tpch_workload(
238225
239226 workload_symlink_path = dbgym_workspace .link_result (workload_path )
240227 assert workload_symlink_path == expected_workload_symlink_path
241- logging .getLogger (DBGYM_LOGGER_NAME ).info (
242- f"Generated: { expected_workload_symlink_path } "
243- )
228+ logging .info (f"Generated: { expected_workload_symlink_path } " )
0 commit comments