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)
123123def 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
243243def _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