Skip to content

Commit 2c44f47

Browse files
committed
dpath -> path
1 parent c961f9f commit 2c44f47

19 files changed

+234
-234
lines changed

benchmark/job/load_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class JobLoadInfo(LoadInfoBaseClass):
3737

3838
def __init__(self, dbgym_workspace: DBGymWorkspace):
3939
# Schema (directly in the codebase).
40-
job_codebase_path = dbgym_workspace.base_dbgym_repo_dpath / "benchmark" / "job"
40+
job_codebase_path = dbgym_workspace.base_dbgym_repo_path / "benchmark" / "job"
4141
self._schema_path = job_codebase_path / JOB_SCHEMA_FNAME
4242
assert (
4343
self._schema_path.exists()

benchmark/tpch/cli.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -101,41 +101,41 @@ def _get_queries_dirname(seed: int, scale_factor: float) -> str:
101101

102102

103103
def _clone_tpch_kit(dbgym_workspace: DBGymWorkspace) -> None:
104-
expected_symlink_dpath = dbgym_workspace.dbgym_cur_symlinks_path / (
104+
expected_symlink_path = dbgym_workspace.dbgym_cur_symlinks_path / (
105105
TPCH_KIT_DIRNAME + ".link"
106106
)
107-
if expected_symlink_dpath.exists():
107+
if expected_symlink_path.exists():
108108
logging.getLogger(DBGYM_LOGGER_NAME).info(
109-
f"Skipping clone: {expected_symlink_dpath}"
109+
f"Skipping clone: {expected_symlink_path}"
110110
)
111111
return
112112

113-
logging.getLogger(DBGYM_LOGGER_NAME).info(f"Cloning: {expected_symlink_dpath}")
113+
logging.getLogger(DBGYM_LOGGER_NAME).info(f"Cloning: {expected_symlink_path}")
114114
subprocess_run(
115115
f"./clone_tpch_kit.sh {dbgym_workspace.dbgym_this_run_path}",
116-
cwd=dbgym_workspace.base_dbgym_repo_dpath / "benchmark" / "tpch",
116+
cwd=dbgym_workspace.base_dbgym_repo_path / "benchmark" / "tpch",
117117
)
118-
symlink_dpath = dbgym_workspace.link_result(
118+
symlink_path = dbgym_workspace.link_result(
119119
dbgym_workspace.dbgym_this_run_path / TPCH_KIT_DIRNAME
120120
)
121-
assert expected_symlink_dpath.samefile(symlink_dpath)
122-
logging.getLogger(DBGYM_LOGGER_NAME).info(f"Cloned: {expected_symlink_dpath}")
121+
assert expected_symlink_path.samefile(symlink_path)
122+
logging.getLogger(DBGYM_LOGGER_NAME).info(f"Cloned: {expected_symlink_path}")
123123

124124

125125
def _generate_tpch_queries(
126126
dbgym_workspace: DBGymWorkspace, seed_start: int, seed_end: int, scale_factor: float
127127
) -> None:
128-
tpch_kit_dpath = dbgym_workspace.dbgym_cur_symlinks_path / (
128+
tpch_kit_path = dbgym_workspace.dbgym_cur_symlinks_path / (
129129
TPCH_KIT_DIRNAME + ".link"
130130
)
131131
logging.getLogger(DBGYM_LOGGER_NAME).info(
132132
f"Generating queries: [{seed_start}, {seed_end}]"
133133
)
134134
for seed in range(seed_start, seed_end + 1):
135-
expected_queries_symlink_dpath = dbgym_workspace.dbgym_cur_symlinks_path / (
135+
expected_queries_symlink_path = dbgym_workspace.dbgym_cur_symlinks_path / (
136136
_get_queries_dirname(seed, scale_factor) + ".link"
137137
)
138-
if expected_queries_symlink_dpath.exists():
138+
if expected_queries_symlink_path.exists():
139139
continue
140140

141141
queries_parent_path = (
@@ -147,43 +147,43 @@ def _generate_tpch_queries(
147147
target_sql = (queries_parent_path / f"{i}.sql").resolve()
148148
subprocess_run(
149149
f"DSS_QUERY=./queries ./qgen {i} -r {seed} -s {scale_factor} > {target_sql}",
150-
cwd=tpch_kit_dpath / "dbgen",
150+
cwd=tpch_kit_path / "dbgen",
151151
verbose=False,
152152
)
153-
queries_symlink_dpath = dbgym_workspace.link_result(queries_parent_path)
154-
assert queries_symlink_dpath.samefile(expected_queries_symlink_dpath)
153+
queries_symlink_path = dbgym_workspace.link_result(queries_parent_path)
154+
assert queries_symlink_path.samefile(expected_queries_symlink_path)
155155
logging.getLogger(DBGYM_LOGGER_NAME).info(
156156
f"Generated queries: [{seed_start}, {seed_end}]"
157157
)
158158

159159

160160
def _generate_tpch_tables(dbgym_workspace: DBGymWorkspace, scale_factor: float) -> None:
161-
tpch_kit_dpath = dbgym_workspace.dbgym_cur_symlinks_path / (
161+
tpch_kit_path = dbgym_workspace.dbgym_cur_symlinks_path / (
162162
TPCH_KIT_DIRNAME + ".link"
163163
)
164-
expected_tables_symlink_dpath = get_tables_symlink_path(
164+
expected_tables_symlink_path = get_tables_symlink_path(
165165
dbgym_workspace.dbgym_workspace_path, "tpch", scale_factor
166166
)
167-
if expected_tables_symlink_dpath.exists():
167+
if expected_tables_symlink_path.exists():
168168
logging.getLogger(DBGYM_LOGGER_NAME).info(
169-
f"Skipping generation: {expected_tables_symlink_dpath}"
169+
f"Skipping generation: {expected_tables_symlink_path}"
170170
)
171171
return
172172

173173
logging.getLogger(DBGYM_LOGGER_NAME).info(
174-
f"Generating: {expected_tables_symlink_dpath}"
174+
f"Generating: {expected_tables_symlink_path}"
175175
)
176-
subprocess_run(f"./dbgen -vf -s {scale_factor}", cwd=tpch_kit_dpath / "dbgen")
176+
subprocess_run(f"./dbgen -vf -s {scale_factor}", cwd=tpch_kit_path / "dbgen")
177177
tables_parent_path = dbgym_workspace.dbgym_this_run_path / get_tables_dirname(
178178
"tpch", scale_factor
179179
)
180180
tables_parent_path.mkdir(parents=False, exist_ok=False)
181-
subprocess_run(f"mv ./*.tbl {tables_parent_path}", cwd=tpch_kit_dpath / "dbgen")
181+
subprocess_run(f"mv ./*.tbl {tables_parent_path}", cwd=tpch_kit_path / "dbgen")
182182

183-
tables_symlink_dpath = dbgym_workspace.link_result(tables_parent_path)
184-
assert tables_symlink_dpath.samefile(expected_tables_symlink_dpath)
183+
tables_symlink_path = dbgym_workspace.link_result(tables_parent_path)
184+
assert tables_symlink_path.samefile(expected_tables_symlink_path)
185185
logging.getLogger(DBGYM_LOGGER_NAME).info(
186-
f"Generated: {expected_tables_symlink_dpath}"
186+
f"Generated: {expected_tables_symlink_path}"
187187
)
188188

189189

benchmark/tpch/load_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class TpchLoadInfo(LoadInfoBaseClass):
2525
def __init__(self, dbgym_workspace: DBGymWorkspace, scale_factor: float):
2626
# Schema and constraints (directly in the codebase).
2727
tpch_codebase_path = (
28-
dbgym_workspace.base_dbgym_repo_dpath / "benchmark" / "tpch"
28+
dbgym_workspace.base_dbgym_repo_path / "benchmark" / "tpch"
2929
)
3030
self._schema_path = tpch_codebase_path / TPCH_SCHEMA_FNAME
3131
assert (

dbms/postgres/_build_repo.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,40 @@
22

33
set -euxo pipefail
44

5-
REPO_REAL_PARENT_DPATH="$1"
5+
REPO_REAL_PARENT_path="$1"
66

77
# Download and make postgres from the boot repository.
8-
mkdir -p "${REPO_REAL_PARENT_DPATH}"
9-
cd "${REPO_REAL_PARENT_DPATH}"
8+
mkdir -p "${REPO_REAL_PARENT_path}"
9+
cd "${REPO_REAL_PARENT_path}"
1010
git clone https://github.com/lmwnshn/boot.git --single-branch --branch vldb_2024 --depth 1
1111
cd ./boot
12-
./cmudb/build/configure.sh release "${REPO_REAL_PARENT_DPATH}/boot/build/postgres"
12+
./cmudb/build/configure.sh release "${REPO_REAL_PARENT_path}/boot/build/postgres"
1313
make clean
1414
make install-world-bin -j4
1515

1616
# Download and make boot.
1717
cd ./cmudb/extension/boot_rs/
1818
cargo build --release
1919
cbindgen . -o target/boot_rs.h --lang c
20-
cd "${REPO_REAL_PARENT_DPATH}/boot"
20+
cd "${REPO_REAL_PARENT_path}/boot"
2121

2222
cd ./cmudb/extension/boot/
2323
make clean
2424
make install -j
25-
cd "${REPO_REAL_PARENT_DPATH}/boot"
25+
cd "${REPO_REAL_PARENT_path}/boot"
2626

2727
# Download and make hypopg.
2828
git clone https://github.com/HypoPG/hypopg.git
2929
cd ./hypopg
30-
PG_CONFIG="${REPO_REAL_PARENT_DPATH}/boot/build/postgres/bin/pg_config" make install
31-
cd "${REPO_REAL_PARENT_DPATH}/boot"
30+
PG_CONFIG="${REPO_REAL_PARENT_path}/boot/build/postgres/bin/pg_config" make install
31+
cd "${REPO_REAL_PARENT_path}/boot"
3232

3333
# Download and make pg_hint_plan.
3434
# We need -L to follow links.
3535
curl -L https://github.com/ossc-db/pg_hint_plan/archive/refs/tags/REL15_1_5_1.tar.gz -o REL15_1_5_1.tar.gz
3636
tar -xzf REL15_1_5_1.tar.gz
3737
rm REL15_1_5_1.tar.gz
3838
cd ./pg_hint_plan-REL15_1_5_1
39-
PATH="${REPO_REAL_PARENT_DPATH}/boot/build/postgres/bin:$PATH" make
40-
PATH="${REPO_REAL_PARENT_DPATH}/boot/build/postgres/bin:$PATH" make install
41-
cp ./pg_hint_plan.so ${REPO_REAL_PARENT_DPATH}/boot/build/postgres/lib
39+
PATH="${REPO_REAL_PARENT_path}/boot/build/postgres/bin:$PATH" make
40+
PATH="${REPO_REAL_PARENT_path}/boot/build/postgres/bin:$PATH" make install
41+
cp ./pg_hint_plan.so ${REPO_REAL_PARENT_path}/boot/build/postgres/lib

dbms/postgres/cli.py

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
WORKSPACE_PATH_PLACEHOLDER,
3939
DBGymWorkspace,
4040
fully_resolve_path,
41-
get_default_dbdata_parent_dpath,
41+
get_default_dbdata_parent_path,
4242
is_fully_resolved,
4343
is_ssd,
4444
)
@@ -68,30 +68,30 @@ def _postgres_build(dbgym_workspace: DBGymWorkspace, rebuild: bool) -> None:
6868
"""
6969
This function exists as a hook for integration tests.
7070
"""
71-
expected_repo_symlink_dpath = get_repo_symlink_path(
71+
expected_repo_symlink_path = get_repo_symlink_path(
7272
dbgym_workspace.dbgym_workspace_path
7373
)
74-
if not rebuild and expected_repo_symlink_dpath.exists():
74+
if not rebuild and expected_repo_symlink_path.exists():
7575
logging.getLogger(DBGYM_LOGGER_NAME).info(
76-
f"Skipping _postgres_build: {expected_repo_symlink_dpath}"
76+
f"Skipping _postgres_build: {expected_repo_symlink_path}"
7777
)
7878
return
7979

8080
logging.getLogger(DBGYM_LOGGER_NAME).info(
81-
f"Setting up repo in {expected_repo_symlink_dpath}"
81+
f"Setting up repo in {expected_repo_symlink_path}"
8282
)
83-
repo_real_dpath = dbgym_workspace.dbgym_this_run_path / "repo"
84-
repo_real_dpath.mkdir(parents=False, exist_ok=False)
83+
repo_real_path = dbgym_workspace.dbgym_this_run_path / "repo"
84+
repo_real_path.mkdir(parents=False, exist_ok=False)
8585
subprocess_run(
86-
f"./_build_repo.sh {repo_real_dpath}",
87-
cwd=dbgym_workspace.base_dbgym_repo_dpath / "dbms" / "postgres",
86+
f"./_build_repo.sh {repo_real_path}",
87+
cwd=dbgym_workspace.base_dbgym_repo_path / "dbms" / "postgres",
8888
)
8989

9090
# only link at the end so that the link only ever points to a complete repo
91-
repo_symlink_dpath = dbgym_workspace.link_result(repo_real_dpath)
92-
assert expected_repo_symlink_dpath.samefile(repo_symlink_dpath)
91+
repo_symlink_path = dbgym_workspace.link_result(repo_real_path)
92+
assert expected_repo_symlink_path.samefile(repo_symlink_path)
9393
logging.getLogger(DBGYM_LOGGER_NAME).info(
94-
f"Set up repo in {expected_repo_symlink_dpath}"
94+
f"Set up repo in {expected_repo_symlink_path}"
9595
)
9696

9797

@@ -112,29 +112,29 @@ def _postgres_build(dbgym_workspace: DBGymWorkspace, rebuild: bool) -> None:
112112
"--intended-dbdata-hardware",
113113
type=click.Choice(["hdd", "ssd"]),
114114
default="hdd",
115-
help=f"The intended hardware dbdata should be on. Used as a sanity check for --dbdata-parent-dpath.",
115+
help=f"The intended hardware dbdata should be on. Used as a sanity check for --dbdata-parent-path.",
116116
)
117117
@click.option(
118-
"--dbdata-parent-dpath",
118+
"--dbdata-parent-path",
119119
default=None,
120120
type=Path,
121-
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)}.",
121+
help=f"The path to the parent directory of the dbdata which will be actively tuned. The default is {get_default_dbdata_parent_path(WORKSPACE_PATH_PLACEHOLDER)}.",
122122
)
123123
def postgres_dbdata(
124124
dbgym_workspace: DBGymWorkspace,
125125
benchmark_name: str,
126126
scale_factor: float,
127127
pgbin_path: Optional[Path],
128128
intended_dbdata_hardware: str,
129-
dbdata_parent_dpath: Optional[Path],
129+
dbdata_parent_path: Optional[Path],
130130
) -> None:
131131
_postgres_dbdata(
132132
dbgym_workspace,
133133
benchmark_name,
134134
scale_factor,
135135
pgbin_path,
136136
intended_dbdata_hardware,
137-
dbdata_parent_dpath,
137+
dbdata_parent_path,
138138
)
139139

140140

@@ -144,38 +144,38 @@ def _postgres_dbdata(
144144
scale_factor: float,
145145
pgbin_path: Optional[Path],
146146
intended_dbdata_hardware: str,
147-
dbdata_parent_dpath: Optional[Path],
147+
dbdata_parent_path: Optional[Path],
148148
) -> None:
149149
"""
150150
This function exists as a hook for integration tests.
151151
"""
152152
# Set args to defaults programmatically (do this before doing anything else in the function)
153153
if pgbin_path is None:
154154
pgbin_path = get_pgbin_symlink_path(dbgym_workspace.dbgym_workspace_path)
155-
if dbdata_parent_dpath is None:
156-
dbdata_parent_dpath = get_default_dbdata_parent_dpath(
155+
if dbdata_parent_path is None:
156+
dbdata_parent_path = get_default_dbdata_parent_path(
157157
dbgym_workspace.dbgym_workspace_path
158158
)
159159

160160
# Fully resolve all input paths.
161161
pgbin_path = fully_resolve_path(pgbin_path)
162-
dbdata_parent_dpath = fully_resolve_path(dbdata_parent_dpath)
162+
dbdata_parent_path = fully_resolve_path(dbdata_parent_path)
163163

164164
# Check assertions on args
165165
if intended_dbdata_hardware == "hdd":
166166
assert not is_ssd(
167-
dbdata_parent_dpath
168-
), f"Intended hardware is HDD but dbdata_parent_dpath ({dbdata_parent_dpath}) is an SSD"
167+
dbdata_parent_path
168+
), f"Intended hardware is HDD but dbdata_parent_path ({dbdata_parent_path}) is an SSD"
169169
elif intended_dbdata_hardware == "ssd":
170170
assert is_ssd(
171-
dbdata_parent_dpath
172-
), f"Intended hardware is SSD but dbdata_parent_dpath ({dbdata_parent_dpath}) is an HDD"
171+
dbdata_parent_path
172+
), f"Intended hardware is SSD but dbdata_parent_path ({dbdata_parent_path}) is an HDD"
173173
else:
174174
assert False
175175

176176
# Create dbdata
177177
_create_dbdata(
178-
dbgym_workspace, benchmark_name, scale_factor, pgbin_path, dbdata_parent_dpath
178+
dbgym_workspace, benchmark_name, scale_factor, pgbin_path, dbdata_parent_path
179179
)
180180

181181

@@ -184,7 +184,7 @@ def _create_dbdata(
184184
benchmark_name: str,
185185
scale_factor: float,
186186
pgbin_path: Path,
187-
dbdata_parent_dpath: Path,
187+
dbdata_parent_path: Path,
188188
) -> None:
189189
"""
190190
If you change the code of _create_dbdata(), you should also delete the symlink so that the next time you run
@@ -202,13 +202,13 @@ def _create_dbdata(
202202
return
203203

204204
# It's ok for the dbdata/ directory to be temporary. It just matters that the .tgz is saved in a safe place.
205-
dbdata_path = dbdata_parent_dpath / "dbdata_being_created"
206-
# We might be reusing the same dbdata_parent_dpath, so delete dbdata_path if it already exists
205+
dbdata_path = dbdata_parent_path / "dbdata_being_created"
206+
# We might be reusing the same dbdata_parent_path, so delete dbdata_path if it already exists
207207
if dbdata_path.exists():
208208
shutil.rmtree(dbdata_path)
209209

210210
# Call initdb.
211-
# Save any script we call from pgbin_symlink_dpath because they are dependencies generated from another task run.
211+
# Save any script we call from pgbin_symlink_path because they are dependencies generated from another task run.
212212
dbgym_workspace.save_file(pgbin_path / "initdb")
213213
subprocess_run(f'./initdb -D "{dbdata_path}"', cwd=pgbin_path)
214214

@@ -242,23 +242,23 @@ def _create_dbdata(
242242

243243
def _generic_dbdata_setup(dbgym_workspace: DBGymWorkspace) -> None:
244244
# get necessary vars
245-
pgbin_real_dpath = get_pgbin_symlink_path(
245+
pgbin_real_path = get_pgbin_symlink_path(
246246
dbgym_workspace.dbgym_workspace_path
247247
).resolve()
248-
assert pgbin_real_dpath.exists()
248+
assert pgbin_real_path.exists()
249249
dbgym_pguser = DBGYM_POSTGRES_USER
250250
dbgym_pgpass = DBGYM_POSTGRES_PASS
251251
pgport = DEFAULT_POSTGRES_PORT
252252

253253
# Create user
254-
dbgym_workspace.save_file(pgbin_real_dpath / "psql")
254+
dbgym_workspace.save_file(pgbin_real_path / "psql")
255255
subprocess_run(
256256
f"./psql -c \"create user {dbgym_pguser} with superuser password '{dbgym_pgpass}'\" {DEFAULT_POSTGRES_DBNAME} -p {pgport} -h localhost",
257-
cwd=pgbin_real_dpath,
257+
cwd=pgbin_real_path,
258258
)
259259
subprocess_run(
260260
f'./psql -c "grant pg_monitor to {dbgym_pguser}" {DEFAULT_POSTGRES_DBNAME} -p {pgport} -h localhost',
261-
cwd=pgbin_real_dpath,
261+
cwd=pgbin_real_path,
262262
)
263263

264264
# Load shared preload libraries
@@ -267,14 +267,14 @@ def _generic_dbdata_setup(dbgym_workspace: DBGymWorkspace) -> None:
267267
# You have to use TO and you can't put single quotes around the libraries (https://postgrespro.com/list/thread-id/2580120)
268268
# The method I wrote here works for both one library and multiple libraries
269269
f'./psql -c "ALTER SYSTEM SET shared_preload_libraries TO {SHARED_PRELOAD_LIBRARIES};" {DEFAULT_POSTGRES_DBNAME} -p {pgport} -h localhost',
270-
cwd=pgbin_real_dpath,
270+
cwd=pgbin_real_path,
271271
)
272272

273273
# Create the dbgym database. Since one dbdata dir maps to one benchmark, all benchmarks will use the same database
274274
# as opposed to using databases named after the benchmark.
275275
subprocess_run(
276276
f"./psql -c \"create database {DBGYM_POSTGRES_DBNAME} with owner = '{dbgym_pguser}'\" {DEFAULT_POSTGRES_DBNAME} -p {pgport} -h localhost",
277-
cwd=pgbin_real_dpath,
277+
cwd=pgbin_real_path,
278278
)
279279

280280

0 commit comments

Comments
 (0)