Skip to content

Commit 948edf1

Browse files
committed
made all defaults below workload path fns
1 parent aeca240 commit 948edf1

File tree

8 files changed

+107
-91
lines changed

8 files changed

+107
-91
lines changed

dbms/postgres/cli.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
from util.workspace import (
3636
WORKSPACE_PATH_PLACEHOLDER,
3737
DBGymConfig,
38-
default_dbdata_parent_dpath,
39-
default_pgbin_path,
4038
fully_resolve_path,
4139
get_dbdata_tgz_name,
40+
get_default_dbdata_parent_dpath,
41+
get_default_pgbin_path,
4242
is_fully_resolved,
4343
is_ssd,
4444
link_result,
@@ -78,7 +78,7 @@ def postgres_build(dbgym_cfg: DBGymConfig, rebuild: bool) -> None:
7878
"--pgbin-path",
7979
type=Path,
8080
default=None,
81-
help=f"The path to the bin containing Postgres executables. The default is {default_pgbin_path(WORKSPACE_PATH_PLACEHOLDER)}.",
81+
help=f"The path to the bin containing Postgres executables. The default is {get_default_pgbin_path(WORKSPACE_PATH_PLACEHOLDER)}.",
8282
)
8383
@click.option(
8484
"--intended-dbdata-hardware",
@@ -90,7 +90,7 @@ def postgres_build(dbgym_cfg: DBGymConfig, rebuild: bool) -> None:
9090
"--dbdata-parent-dpath",
9191
default=None,
9292
type=Path,
93-
help=f"The path to the parent directory of the dbdata which will be actively tuned. The default is {default_dbdata_parent_dpath(WORKSPACE_PATH_PLACEHOLDER)}.",
93+
help=f"The path to the parent directory of the dbdata which will be actively tuned. The default is {get_default_dbdata_parent_dpath(WORKSPACE_PATH_PLACEHOLDER)}.",
9494
)
9595
def postgres_dbdata(
9696
dbgym_cfg: DBGymConfig,
@@ -102,9 +102,9 @@ def postgres_dbdata(
102102
) -> None:
103103
# Set args to defaults programmatically (do this before doing anything else in the function)
104104
if pgbin_path is None:
105-
pgbin_path = default_pgbin_path(dbgym_cfg.dbgym_workspace_path)
105+
pgbin_path = get_default_pgbin_path(dbgym_cfg.dbgym_workspace_path)
106106
if dbdata_parent_dpath is None:
107-
dbdata_parent_dpath = default_dbdata_parent_dpath(
107+
dbdata_parent_dpath = get_default_dbdata_parent_dpath(
108108
dbgym_cfg.dbgym_workspace_path
109109
)
110110

env/integtest_pg_conn.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
)
1717
from util.workspace import (
1818
DEFAULT_BOOT_CONFIG_FPATH,
19-
default_dbdata_parent_dpath,
20-
default_pgbin_path,
21-
default_pristine_dbdata_snapshot_path,
19+
get_default_dbdata_parent_dpath,
20+
get_default_pgbin_path,
21+
get_default_pristine_dbdata_snapshot_path,
2222
)
2323

2424

@@ -33,15 +33,17 @@ def setUp(self) -> None:
3333
"Make sure Postgres isn't running before starting the integration test. `pkill postgres` is one way "
3434
+ "to ensure this. Be careful about accidentally taking down other people's Postgres instances though.",
3535
)
36-
self.pristine_dbdata_snapshot_path = default_pristine_dbdata_snapshot_path(
36+
self.pristine_dbdata_snapshot_path = get_default_pristine_dbdata_snapshot_path(
3737
IntegtestWorkspace.get_workspace_path(),
3838
INTEGTEST_BENCHMARK,
3939
INTEGTEST_SCALE_FACTOR,
4040
)
41-
self.dbdata_parent_dpath = default_dbdata_parent_dpath(
41+
self.dbdata_parent_dpath = get_default_dbdata_parent_dpath(
42+
IntegtestWorkspace.get_workspace_path()
43+
)
44+
self.pgbin_dpath = get_default_pgbin_path(
4245
IntegtestWorkspace.get_workspace_path()
4346
)
44-
self.pgbin_dpath = default_pgbin_path(IntegtestWorkspace.get_workspace_path())
4547

4648
# The reason we restart Postgres every time is to ensure a "clean" starting point
4749
# so that all tests are independent of each other.

scripts/run_protox_e2e_test.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
from benchmark.tpch.constants import DEFAULT_TPCH_SEED
1212
from util.pg import get_is_postgres_running
1313
from util.workspace import (
14-
default_pristine_dbdata_snapshot_path,
15-
default_replay_data_fpath,
16-
default_repo_path,
17-
default_tuning_steps_dpath,
1814
get_default_embedder_path,
1915
get_default_hpoed_agent_params_path,
16+
get_default_pristine_dbdata_snapshot_path,
17+
get_default_replay_data_fpath,
18+
get_default_repo_path,
2019
get_default_tables_path,
2120
get_default_traindata_path,
21+
get_default_tuning_steps_dpath,
2222
get_default_workload_path,
2323
get_workload_name,
2424
)
@@ -119,13 +119,13 @@ def run_e2e_for_benchmark(benchmark_name: str, intended_dbdata_hardware: str) ->
119119
)
120120
assert workload_dpath.exists()
121121

122-
repo_dpath = default_repo_path(workspace_dpath)
122+
repo_dpath = get_default_repo_path(workspace_dpath)
123123
if Stage.DBRepo in STAGES_TO_RUN:
124124
assert not repo_dpath.exists()
125125
subprocess.run(f"python task.py dbms {DBMS} build".split(), check=True)
126126
assert repo_dpath.exists()
127127

128-
pristine_dbdata_snapshot_fpath = default_pristine_dbdata_snapshot_path(
128+
pristine_dbdata_snapshot_fpath = get_default_pristine_dbdata_snapshot_path(
129129
workspace_dpath, benchmark_name, scale_factor
130130
)
131131
if Stage.DBData in STAGES_TO_RUN:
@@ -170,7 +170,7 @@ def run_e2e_for_benchmark(benchmark_name: str, intended_dbdata_hardware: str) ->
170170
)
171171
assert hpoed_agent_params_fpath.exists()
172172

173-
tuning_steps_dpath = default_tuning_steps_dpath(
173+
tuning_steps_dpath = get_default_tuning_steps_dpath(
174174
workspace_dpath, benchmark_name, workload_name, False
175175
)
176176
if Stage.TuneTune in STAGES_TO_RUN:
@@ -182,7 +182,7 @@ def run_e2e_for_benchmark(benchmark_name: str, intended_dbdata_hardware: str) ->
182182
assert tuning_steps_dpath.exists()
183183

184184
# Post-training (replay)
185-
replay_data_fpath = default_replay_data_fpath(
185+
replay_data_fpath = get_default_replay_data_fpath(
186186
workspace_dpath, benchmark_name, workload_name, False
187187
)
188188
if Stage.Replay in STAGES_TO_RUN:

tune/demo/main.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
from util.workspace import (
66
DEFAULT_BOOT_CONFIG_FPATH,
77
DBGymConfig,
8-
default_dbdata_parent_dpath,
9-
default_pgbin_path,
10-
default_pristine_dbdata_snapshot_path,
8+
get_default_dbdata_parent_dpath,
9+
get_default_pgbin_path,
10+
get_default_pristine_dbdata_snapshot_path,
1111
make_standard_dbgym_cfg,
1212
)
1313

@@ -43,13 +43,13 @@ class Demo:
4343

4444
def __init__(self) -> None:
4545
self.dbgym_cfg = make_dbgym_cfg_cached()
46-
self.pristine_dbdata_snapshot_path = default_pristine_dbdata_snapshot_path(
46+
self.pristine_dbdata_snapshot_path = get_default_pristine_dbdata_snapshot_path(
4747
self.dbgym_cfg.dbgym_workspace_path, Demo.BENCHMARK, Demo.SCALE_FACTOR
4848
)
49-
self.dbdata_parent_dpath = default_dbdata_parent_dpath(
49+
self.dbdata_parent_dpath = get_default_dbdata_parent_dpath(
5050
self.dbgym_cfg.dbgym_workspace_path
5151
)
52-
self.pgbin_dpath = default_pgbin_path(self.dbgym_cfg.dbgym_workspace_path)
52+
self.pgbin_dpath = get_default_pgbin_path(self.dbgym_cfg.dbgym_workspace_path)
5353
self.pg_conn = PostgresConn(
5454
self.dbgym_cfg,
5555
DEFAULT_POSTGRES_PORT,

tune/protox/agent/hpo.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@
3535
WORKSPACE_PATH_PLACEHOLDER,
3636
DBGymConfig,
3737
TuningMode,
38-
default_dbdata_parent_dpath,
39-
default_pgbin_path,
40-
default_pristine_dbdata_snapshot_path,
4138
fully_resolve_path,
4239
get_default_benchbase_config_path,
4340
get_default_benchmark_config_path,
41+
get_default_dbdata_parent_dpath,
4442
get_default_embedder_path,
4543
get_default_hpoed_agent_params_fname,
44+
get_default_pgbin_path,
45+
get_default_pristine_dbdata_snapshot_path,
4646
get_default_workload_name_suffix,
4747
get_default_workload_path,
4848
get_workload_name,
@@ -144,7 +144,7 @@ def __init__(
144144
"--pristine-dbdata-snapshot-path",
145145
type=Path,
146146
default=None,
147-
help=f"The path to the .tgz snapshot of the dbdata directory to use as a starting point for tuning. The default is {default_pristine_dbdata_snapshot_path(WORKSPACE_PATH_PLACEHOLDER, BENCHMARK_NAME_PLACEHOLDER, SCALE_FACTOR_PLACEHOLDER)}.",
147+
help=f"The path to the .tgz snapshot of the dbdata directory to use as a starting point for tuning. The default is {get_default_pristine_dbdata_snapshot_path(WORKSPACE_PATH_PLACEHOLDER, BENCHMARK_NAME_PLACEHOLDER, SCALE_FACTOR_PLACEHOLDER)}.",
148148
)
149149
@click.option(
150150
"--intended-dbdata-hardware",
@@ -156,13 +156,13 @@ def __init__(
156156
"--dbdata-parent-dpath",
157157
type=Path,
158158
default=None,
159-
help=f"The path to the parent directory of the dbdata which will be actively tuned. The default is {default_dbdata_parent_dpath(WORKSPACE_PATH_PLACEHOLDER)}.",
159+
help=f"The path to the parent directory of the dbdata which will be actively tuned. The default is {get_default_dbdata_parent_dpath(WORKSPACE_PATH_PLACEHOLDER)}.",
160160
)
161161
@click.option(
162162
"--pgbin-path",
163163
type=Path,
164164
default=None,
165-
help=f"The path to the bin containing Postgres executables. The default is {default_pgbin_path(WORKSPACE_PATH_PLACEHOLDER)}.",
165+
help=f"The path to the bin containing Postgres executables. The default is {get_default_pgbin_path(WORKSPACE_PATH_PLACEHOLDER)}.",
166166
)
167167
@click.option(
168168
"--workload-path",
@@ -278,15 +278,15 @@ def hpo(
278278
if benchbase_config_path is None:
279279
benchbase_config_path = get_default_benchbase_config_path(benchmark_name)
280280
if pristine_dbdata_snapshot_path is None:
281-
pristine_dbdata_snapshot_path = default_pristine_dbdata_snapshot_path(
281+
pristine_dbdata_snapshot_path = get_default_pristine_dbdata_snapshot_path(
282282
dbgym_cfg.dbgym_workspace_path, benchmark_name, scale_factor
283283
)
284284
if dbdata_parent_dpath is None:
285-
dbdata_parent_dpath = default_dbdata_parent_dpath(
285+
dbdata_parent_dpath = get_default_dbdata_parent_dpath(
286286
dbgym_cfg.dbgym_workspace_path
287287
)
288288
if pgbin_path is None:
289-
pgbin_path = default_pgbin_path(dbgym_cfg.dbgym_workspace_path)
289+
pgbin_path = get_default_pgbin_path(dbgym_cfg.dbgym_workspace_path)
290290
if workload_path is None:
291291
workload_path = get_default_workload_path(
292292
dbgym_cfg.dbgym_workspace_path, benchmark_name, workload_name

tune/protox/agent/replay.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
from util.workspace import (
3232
DBGymConfig,
3333
TuningMode,
34-
default_tuning_steps_dpath,
3534
fully_resolve_path,
3635
get_default_replay_data_fname,
36+
get_default_tuning_steps_dpath,
3737
get_default_workload_name_suffix,
3838
get_workload_name,
3939
link_result,
@@ -143,7 +143,7 @@ def replay(
143143
workload_name = get_workload_name(scale_factor, workload_name_suffix)
144144

145145
if tuning_steps_dpath is None:
146-
tuning_steps_dpath = default_tuning_steps_dpath(
146+
tuning_steps_dpath = get_default_tuning_steps_dpath(
147147
dbgym_cfg.dbgym_workspace_path,
148148
benchmark_name,
149149
workload_name,

tune/protox/embedding/datagen.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@
3838
WORKLOAD_NAME_PLACEHOLDER,
3939
WORKSPACE_PATH_PLACEHOLDER,
4040
DBGymConfig,
41-
default_dbdata_parent_dpath,
42-
default_pgbin_path,
43-
default_pristine_dbdata_snapshot_path,
4441
fully_resolve_path,
4542
get_default_benchmark_config_path,
43+
get_default_dbdata_parent_dpath,
44+
get_default_pgbin_path,
45+
get_default_pristine_dbdata_snapshot_path,
4646
get_default_traindata_fname,
4747
get_default_workload_name_suffix,
4848
get_default_workload_path,
@@ -89,14 +89,14 @@
8989
"--pgbin-path",
9090
type=Path,
9191
default=None,
92-
help=f"The path to the bin containing Postgres executables. The default is {default_pgbin_path(WORKSPACE_PATH_PLACEHOLDER)}.",
92+
help=f"The path to the bin containing Postgres executables. The default is {get_default_pgbin_path(WORKSPACE_PATH_PLACEHOLDER)}.",
9393
)
9494
# TODO(phw2): need to run pgtune before gathering data
9595
@click.option(
9696
"--pristine-dbdata-snapshot-path",
9797
type=Path,
9898
default=None,
99-
help=f"The path to the .tgz snapshot of the dbdata directory to build an embedding space over. The default is {default_pristine_dbdata_snapshot_path(WORKSPACE_PATH_PLACEHOLDER, BENCHMARK_NAME_PLACEHOLDER, SCALE_FACTOR_PLACEHOLDER)}.",
99+
help=f"The path to the .tgz snapshot of the dbdata directory to build an embedding space over. The default is {get_default_pristine_dbdata_snapshot_path(WORKSPACE_PATH_PLACEHOLDER, BENCHMARK_NAME_PLACEHOLDER, SCALE_FACTOR_PLACEHOLDER)}.",
100100
)
101101
@click.option(
102102
"--intended-dbdata-hardware",
@@ -108,7 +108,7 @@
108108
"--dbdata-parent-dpath",
109109
type=Path,
110110
default=None,
111-
help=f"The path to the parent directory of the dbdata which will be actively tuned. The default is {default_pristine_dbdata_snapshot_path(WORKSPACE_PATH_PLACEHOLDER, BENCHMARK_NAME_PLACEHOLDER, SCALE_FACTOR_PLACEHOLDER)}.",
111+
help=f"The path to the parent directory of the dbdata which will be actively tuned. The default is {get_default_pristine_dbdata_snapshot_path(WORKSPACE_PATH_PLACEHOLDER, BENCHMARK_NAME_PLACEHOLDER, SCALE_FACTOR_PLACEHOLDER)}.",
112112
)
113113
@click.option(
114114
"--benchmark-config-path",
@@ -211,13 +211,13 @@ def datagen(
211211
if benchmark_config_path is None:
212212
benchmark_config_path = get_default_benchmark_config_path(benchmark_name)
213213
if pgbin_path is None:
214-
pgbin_path = default_pgbin_path(dbgym_cfg.dbgym_workspace_path)
214+
pgbin_path = get_default_pgbin_path(dbgym_cfg.dbgym_workspace_path)
215215
if pristine_dbdata_snapshot_path is None:
216-
pristine_dbdata_snapshot_path = default_pristine_dbdata_snapshot_path(
216+
pristine_dbdata_snapshot_path = get_default_pristine_dbdata_snapshot_path(
217217
dbgym_cfg.dbgym_workspace_path, benchmark_name, scale_factor
218218
)
219219
if dbdata_parent_dpath is None:
220-
dbdata_parent_dpath = default_dbdata_parent_dpath(
220+
dbdata_parent_dpath = get_default_dbdata_parent_dpath(
221221
dbgym_cfg.dbgym_workspace_path
222222
)
223223
if max_concurrent is None:
@@ -294,7 +294,7 @@ def datagen(
294294
generic_args.dbdata_parent_dpath,
295295
)
296296
pgbin_path = fully_resolve_path(
297-
dbgym_cfg, default_pgbin_path(dbgym_cfg.dbgym_workspace_path)
297+
dbgym_cfg, get_default_pgbin_path(dbgym_cfg.dbgym_workspace_path)
298298
)
299299
start_postgres(dbgym_cfg, pgbin_path, dbdata_dpath)
300300
_gen_traindata_dpath(dbgym_cfg, generic_args, dir_gen_args)

0 commit comments

Comments
 (0)