diff --git a/src/neptune_scale/cli/main.py b/src/neptune_scale/cli/main.py index d3927b1..8e4921d 100644 --- a/src/neptune_scale/cli/main.py +++ b/src/neptune_scale/cli/main.py @@ -23,6 +23,7 @@ sync, ) from neptune_scale.storage.operations import DATA_DIR +from neptune_scale.util.styles import ensure_style_detected @click.group() @@ -33,6 +34,8 @@ ) @click.pass_context def main(ctx: click.Context, path: Optional[str]) -> None: + ensure_style_detected() + ctx.ensure_object(dict) if path is None: neptune_dir = Path(".") / DATA_DIR diff --git a/src/neptune_scale/cli/sync.py b/src/neptune_scale/cli/sync.py index 8e4b0e8..7f26d1c 100644 --- a/src/neptune_scale/cli/sync.py +++ b/src/neptune_scale/cli/sync.py @@ -53,6 +53,7 @@ list_runs, ) from neptune_scale.util import get_logger +from neptune_scale.util.styles import STYLES @dataclass @@ -216,13 +217,24 @@ def _verify_fork_parent(local_run: LocalRun, parent_must_exist: bool) -> None: return time.sleep(2**i) - msg = f"Parent Run `{local_run.fork_run_id}` does not exist." - if parent_must_exist: - logger.error(msg) - raise NeptuneRunForkParentNotFound() + msg = """ +{h1} +Parent Run `{fork_run_id}` does not exist. +{end} + +This can happen if the parent run was created in offline mode and is not yet +synced to the Neptune backend. + +Run {bash}neptune status -v{end} to list all local runs, and manually sync the parent +run first using {bash}neptune sync {end}. + +Alternatively you can run {bash}neptune sync --sync-no-parent{end} to ignore this error, +and proceed with syncing the without the parent run. + """ + raise Exception(msg.format(fork_run_id=local_run.fork_run_id, **STYLES)) - msg += " Proceeding because --sync-no-parent was passed." + msg = f"Parent Run `{local_run.fork_run_id}` does not exist. Proceeding because --sync-no-parent was passed." logger.warning(msg)