Warn if the resolved path may not match where the DB was actually written. At run time, ``GlobalConfigValidator`` auto-renames an experiment (appending a timestamp to ``name``) when ``continue_from_checkpoint`` is False and the job directory already exists and is non-empty. Since ``view
(config)
| 63 | |
| 64 | |
| 65 | def _warn_if_renamed(config) -> None: |
| 66 | """Warn if the resolved path may not match where the DB was actually written. |
| 67 | |
| 68 | At run time, ``GlobalConfigValidator`` auto-renames an experiment (appending a |
| 69 | timestamp to ``name``) when ``continue_from_checkpoint`` is False and the job |
| 70 | directory already exists and is non-empty. Since ``view`` resolves the clean |
| 71 | (pre-rename) path, the database in that case lives under a timestamped sibling |
| 72 | ``<name>_<timestamp>/`` and the clean path may be stale or point at a different run. |
| 73 | """ |
| 74 | import glob |
| 75 | |
| 76 | job_dir = config.get_checkpoint_job_dir() |
| 77 | if config.continue_from_checkpoint or not os.path.isdir(job_dir) or not os.listdir(job_dir): |
| 78 | return |
| 79 | |
| 80 | parent = os.path.dirname(job_dir) |
| 81 | candidates = sorted( |
| 82 | d for d in glob.glob(os.path.join(parent, f"{config.name}_*")) if os.path.isdir(d) |
| 83 | ) |
| 84 | hint = "" |
| 85 | if candidates: |
| 86 | hint = " Likely candidate(s): " + ", ".join(os.path.basename(d) for d in candidates) |
| 87 | |
| 88 | typer.secho( |
| 89 | "Warning: experiment was likely auto-renamed at run time " |
| 90 | "(continue_from_checkpoint=False and the job directory already exists). " |
| 91 | f"The resolved database path is under {job_dir!r}, but the actual database " |
| 92 | f"is probably under a timestamped sibling {config.name}_<timestamp>/{hint} " |
| 93 | "Pass --url directly at the database file to avoid ambiguity.", |
| 94 | fg=typer.colors.YELLOW, |
| 95 | err=True, |
| 96 | ) |
| 97 | |
| 98 | |
| 99 | def view_command( |