Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling absolute checkpoint dir #1283

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
8 changes: 6 additions & 2 deletions jupyter_server/services/contents/filecheckpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ class FileCheckpoints(FileManagerMixin, Checkpoints):
config=True,
help="""The directory name in which to keep file checkpoints

This is a path relative to the file's own directory.
This path can either be relative or absolute.
If it is a relative path, the checkpoint will be saved to the file's own directory.

By default, it is .ipynb_checkpoints
""",
Expand Down Expand Up @@ -110,7 +111,10 @@ def checkpoint_path(self, checkpoint_id, path):
basename, ext = os.path.splitext(name)
filename = f"{basename}-{checkpoint_id}{ext}"
os_path = self._get_os_path(path=parent)
cp_dir = os.path.join(os_path, self.checkpoint_dir)
if os.path.isabs(self.checkpoint_dir):
cp_dir = os.path.join(self.checkpoint_dir, parent)
else:
cp_dir = os.path.join(os_path, self.checkpoint_dir)
with self.perm_to_403():
ensure_dir_exists(cp_dir)
cp_path = os.path.join(cp_dir, filename)
Expand Down
Loading