Skip to content

Commit 17f89ff

Browse files
committed
deleted all the cur_* functions from workspace fixed all uses of them
1 parent 2ffa8c7 commit 17f89ff

File tree

5 files changed

+7
-80
lines changed

5 files changed

+7
-80
lines changed

dbms/postgres/cli.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ def _create_dbdata(
226226
stop_postgres(dbgym_workspace, pgbin_path, dbdata_path)
227227

228228
# Create .tgz file.
229-
# Note that you can't pass "[dbdata].tgz" as an arg to cur_task_runs_data_path() because that would create "[dbdata].tgz" as a dir.
230229
dbdata_tgz_real_path = dbgym_workspace.dbgym_this_run_path / linkname_to_name(
231230
expected_dbdata_tgz_symlink_path.name
232231
)

env/pg_conn.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,9 @@ def disconnect(self) -> None:
102102
self._conn = None
103103

104104
def move_log(self) -> None:
105-
pglog_path = (
106-
self.dbgym_workspace.cur_task_runs_artifacts_path(mkdir=True)
107-
/ f"pg{self.pgport}.log"
108-
)
105+
pglog_path = self.dbgym_workspace.dbgym_this_run_path / f"pg{self.pgport}.log"
109106
pglog_this_step_path = (
110-
self.dbgym_workspace.cur_task_runs_artifacts_path(mkdir=True)
107+
self.dbgym_workspace.dbgym_this_run_path
111108
/ f"pg{self.pgport}.log.{self.log_step}"
112109
)
113110
if pglog_path.exists():
@@ -299,8 +296,7 @@ def restart_with_changes(
299296
"-l",
300297
# We log to pg{self.pgport}.log instead of pg.log so that different PostgresConn objects
301298
# don't all try to write to the same file.
302-
self.dbgym_workspace.cur_task_runs_artifacts_path(mkdir=True)
303-
/ f"pg{self.pgport}.log",
299+
self.dbgym_workspace.dbgym_this_run_path / f"pg{self.pgport}.log",
304300
"start",
305301
].run(retcode=None)
306302

env/tuning_artifacts.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@ def __init__(
8181
self, dbgym_workspace: DBGymWorkspace, metadata: TuningMetadata
8282
) -> None:
8383
self.dbgym_workspace = dbgym_workspace
84-
self.tuning_artifacts_path = self.dbgym_workspace.cur_task_runs_artifacts_path(
85-
"tuning_artifacts", mkdir=True
84+
self.tuning_artifacts_path = (
85+
self.dbgym_workspace.dbgym_this_run_path / "tuning_artifacts"
8686
)
87+
self.tuning_artifacts_path.mkdir(parents=False, exist_ok=False)
8788
assert is_fully_resolved(self.tuning_artifacts_path)
8889
self.next_step_num = 0
8990

task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def task(ctx: click.Context) -> None:
1818
dbgym_workspace = make_standard_dbgym_workspace()
1919
ctx.obj = dbgym_workspace
2020

21-
log_path = dbgym_workspace.cur_task_runs_artifacts_path(mkdir=True)
21+
log_path = dbgym_workspace.dbgym_this_run_path
2222
set_up_loggers(log_path)
2323
set_up_warnings(log_path)
2424

util/workspace.py

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -50,30 +50,6 @@ def get_latest_run_path_from_workspace_path(workspace_path: Path) -> Path:
5050
DEFAULT_BOOT_CONFIG_PATH = POSTGRES_PATH / "default_boot_config.yaml"
5151

5252

53-
# Paths of dependencies in the workspace. These are named "*_path" because they will be an absolute path
54-
# The reason these _cannot_ be relative paths is because relative paths are relative to the codebase root, not the workspace root
55-
# Note that it's okay to hardcode the codebase paths (like dbgym_dbms_postgres) here. In the worst case, we'll just break an
56-
# integration test. The "source of truth" of codebase paths is based on DBGymWorkspace.cur_source_path(), which will always
57-
# reflect the actual codebase structure. As long as we automatically enforce getting the right codebase paths when writing, it's
58-
# ok to have to hardcode them when reading.
59-
# Details
60-
# - If a name already has the workload_name, I omit scale factor. This is because the workload_name includes the scale factor
61-
# - By convention, symlinks should end with ".link". The bug that motivated this decision involved replaying a tuning run. When
62-
# replaying a tuning run, you read the tuning_steps/ folder of the tuning run. Earlier, I created a symlink to that tuning_steps/
63-
# folder called run_*/*/tuning_steps. However, replay itself generates an replay_info.log file, which goes in
64-
# run_*/*/tuning_steps/. The bug was that my replay function was overwriting the replay_info.log file of the
65-
# tuning run. By naming all symlinks "*.link", we avoid the possibility of subtle bugs like this happening.
66-
def get_default_workload_path(
67-
workspace_path: Path, benchmark_name: str, workload_name: str
68-
) -> Path:
69-
return (
70-
get_symlinks_path_from_workspace_path(workspace_path)
71-
/ f"dbgym_benchmark_{benchmark_name}"
72-
/ "data"
73-
/ (workload_name + ".link")
74-
)
75-
76-
7753
SCALE_FACTOR_PLACEHOLDER: str = "[scale_factor]"
7854

7955

@@ -323,51 +299,6 @@ def open_and_save(self, open_path: Path, mode: str = "r") -> IO[Any]:
323299
def append_group(self, name: str) -> None:
324300
self.cur_path_list.append(name)
325301

326-
def cur_source_path(self, *dirs: str) -> Path:
327-
cur_path = self.base_dbgym_repo_path
328-
assert self.cur_path_list[0] == "dbgym"
329-
for folder in self.cur_path_list[1:]:
330-
cur_path = cur_path / folder
331-
for dir in dirs:
332-
cur_path = cur_path / dir
333-
return cur_path
334-
335-
def _cur_symlinks_path(self, *dirs: str, mkdir: bool = False) -> Path:
336-
flattened_structure = "_".join(self.cur_path_list)
337-
cur_path = self.dbgym_symlinks_path / flattened_structure
338-
for dir in dirs:
339-
cur_path = cur_path / dir
340-
if mkdir:
341-
cur_path.mkdir(parents=True, exist_ok=True)
342-
return cur_path
343-
344-
def cur_task_runs_path(self, *dirs: str, mkdir: bool = False) -> Path:
345-
flattened_structure = "_".join(self.cur_path_list)
346-
cur_path = self.dbgym_this_run_path / flattened_structure
347-
for dir in dirs:
348-
cur_path = cur_path / dir
349-
if mkdir:
350-
cur_path.mkdir(parents=True, exist_ok=True)
351-
return cur_path
352-
353-
def cur_symlinks_bin_path(self, *dirs: str, mkdir: bool = False) -> Path:
354-
return self._cur_symlinks_path("bin", *dirs, mkdir=mkdir)
355-
356-
def cur_symlinks_build_path(self, *dirs: str, mkdir: bool = False) -> Path:
357-
return self._cur_symlinks_path("build", *dirs, mkdir=mkdir)
358-
359-
def cur_symlinks_data_path(self, *dirs: str, mkdir: bool = False) -> Path:
360-
return self._cur_symlinks_path("data", *dirs, mkdir=mkdir)
361-
362-
def cur_task_runs_build_path(self, *dirs: str, mkdir: bool = False) -> Path:
363-
return self.cur_task_runs_path("build", *dirs, mkdir=mkdir)
364-
365-
def cur_task_runs_data_path(self, *dirs: str, mkdir: bool = False) -> Path:
366-
return self.cur_task_runs_path("data", *dirs, mkdir=mkdir)
367-
368-
def cur_task_runs_artifacts_path(self, *dirs: str, mkdir: bool = False) -> Path:
369-
return self.cur_task_runs_path("artifacts", *dirs, mkdir=mkdir)
370-
371302

372303
def get_workspace_path_from_config(dbgym_config_path: Path) -> Path:
373304
"""

0 commit comments

Comments
 (0)