From 3dd992308c0fc8a0e0a4c8bd8d988243ba669e10 Mon Sep 17 00:00:00 2001 From: Patrick Wang Date: Mon, 8 Jul 2024 00:17:39 +0000 Subject: [PATCH] small typo --- manage/cli.py | 10 ++++++---- manage/tests/test_clean.py | 2 -- tune/protox/env/util/pg_conn.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/manage/cli.py b/manage/cli.py index 8497d4d..eb7b4b5 100644 --- a/manage/cli.py +++ b/manage/cli.py @@ -89,7 +89,7 @@ def manage_standardize(dbgym_cfg): help="The mode to clean the workspace (default=\"safe\"). \"aggressive\" means \"only keep run_*/ folders referenced by a file in symlinks/\". \"safe\" means \"in addition to that, recursively keep any run_*/ folders referenced by any symlinks in run_*/ folders we are keeping.\"" ) def manage_clean(dbgym_cfg: DBGymConfig, mode: str): - clean_workspace(dbgym_cfg, mode) + clean_workspace(dbgym_cfg, mode=mode, verbose=True) @click.command("count") @@ -128,7 +128,7 @@ def _count_files_in_workspace(dbgym_cfg: DBGymConfig) -> int: return total_count -def clean_workspace(dbgym_cfg: DBGymConfig, mode: str="safe") -> None: +def clean_workspace(dbgym_cfg: DBGymConfig, mode: str="safe", verbose=False) -> None: """ Clean all [workspace]/task_runs/run_*/ directories that are not referenced by any "active symlinks". If mode is "aggressive", "active symlinks" means *only* the symlinks directly in [workspace]/symlinks/. @@ -205,8 +205,10 @@ def clean_workspace(dbgym_cfg: DBGymConfig, mode: str="safe") -> None: else: os.remove(child_fordpath) ending_num_files = _count_files_in_workspace(dbgym_cfg) - print(f"Removed {starting_num_files - ending_num_files} out of {starting_num_files} files") - print(f"Workspace went from {starting_num_files - ending_num_files} to {starting_num_files}") + + if verbose: + print(f"Removed {starting_num_files - ending_num_files} out of {starting_num_files} files") + print(f"Workspace went from {starting_num_files - ending_num_files} to {starting_num_files}") manage_group.add_command(manage_show) diff --git a/manage/tests/test_clean.py b/manage/tests/test_clean.py index 74c0e62..689c9b5 100644 --- a/manage/tests/test_clean.py +++ b/manage/tests/test_clean.py @@ -728,8 +728,6 @@ def test_outside_task_runs_doesnt_get_deleted(self): clean_workspace(MockDBGymConfig(self.scratchspace_path), mode="safe") self.assertTrue(CleanTests.verify_structure(self.scratchspace_path, ending_structure)) - # test symlinks that point to strings which aren't absolute paths - if __name__ == '__main__': unittest.main() \ No newline at end of file diff --git a/tune/protox/env/util/pg_conn.py b/tune/protox/env/util/pg_conn.py index ef2595d..b28a75b 100644 --- a/tune/protox/env/util/pg_conn.py +++ b/tune/protox/env/util/pg_conn.py @@ -153,7 +153,7 @@ def start_with_changes( # still have the previous checkpoint available to us f"{self.checkpoint_dbdata_snapshot_fpath}.tmp", "-C", - parent_dir(self.dbdata_dpath), + parent_dpath_of_path(self.dbdata_dpath), self.dbdata_dpath, ].run()