Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions dagshub/streaming/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,21 @@ def __init__(
if not project_root:
try:
self.project_root = get_project_root(Path(os.path.abspath(".")))
except ValueError:
raise ValueError(
"Could not find a git repo. Either run the function inside of a git repo, "
"specify `project_root` with the path to a cloned DagsHub repository, "
"or specify `repo_url` (url of repo on DagsHub) and "
"`project_root` (path to the folder where to mount the filesystem) arguments"
)
except ValueError as err:
if repo_url:
self.project_root = Path(os.path.abspath("."))
log_message(
f"No git repo detected; mounting DagsHub filesystem for {repo_url} at "
f"current working directory: {self.project_root}",
logger,
)
else:
raise ValueError(
"Could not find a git repo. Either run the function inside of a git repo, "
"specify `project_root` with the path to a cloned DagsHub repository, "
"or specify `repo_url` (url of repo on DagsHub); "
"optionally provide `project_root` (defaults to current working directory)"
) from err

else:
self.project_root = Path(os.path.abspath(project_root))
Expand Down