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

import_work_directory, hardlink mode #155

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
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
10 changes: 9 additions & 1 deletion sisyphus/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ def _sis_import_from_dirs(self, import_dirs, mode, use_alias=False):
:param import_dirs:
:return:
"""
assert mode in ("copy", "symlink", "dryrun"), "Unsupported mode given: %s" % mode
assert mode in ("copy", "symlink", "hardlink", "dryrun"), "Unsupported mode given: %s" % mode
local_path = self._sis_path()

if use_alias and not self._sis_aliases:
Expand Down Expand Up @@ -628,6 +628,14 @@ def _sis_import_from_dirs(self, import_dirs, mode, use_alias=False):
elif mode == "symlink":
logging.info("Symlink import %s from %s" % (self._sis_id(), import_path))
os.symlink(src=os.path.abspath(import_path), dst=local_path, target_is_directory=True)
elif mode == "hardlink":
logging.info("Hardlink import %s from %s" % (self._sis_id(), import_path))
shutil.copytree(
src=os.path.abspath(import_path),
dst=local_path,
symlinks=True,
copy_function=os.link,
)
else:
logging.info("Possible import %s from %s" % (self._sis_id(), import_path))
return True
Expand Down
2 changes: 1 addition & 1 deletion sisyphus/toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ def import_work_directory(directories: Union[str, List[str]], mode="dryrun", use
Link or copy finished jobs from other work directories.

:param str directories: Path to other work directories
:param str mode: How to import job directories. Options: (copy, symlink, dryrun)
:param str mode: How to import job directories. Options: (copy, symlink, hardlink, dryrun)
"""

if isinstance(directories, str):
Expand Down
Loading