Skip to content

Commit

Permalink
fix: add debug_save_copy_method
Browse files Browse the repository at this point in the history
Signed-off-by: zjgemi <[email protected]>
  • Loading branch information
zjgemi committed Feb 23, 2024
1 parent ac2c5a9 commit 6ab8973
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/dflow/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ def split_headers(s):
"debug_workdir": os.environ.get("DFLOW_DEBUG_WORKDIR", "."),
"debug_artifact_dir": os.environ.get("DFLOW_DEBUG_ARTIFACT_DIR", "."),
"debug_failfast": boolize(os.environ.get("DFLOW_DEBUG_FAILFAST", False)),
"debug_save_copy_method": os.environ.get("DFLOW_DEBUG_SAVE_COPY_METHOD",
"symlink"),
}


Expand Down
9 changes: 7 additions & 2 deletions src/dflow/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -2120,10 +2120,15 @@ def exec_pod(self, scope, parameters, item=None):
cwd, "..", config["debug_artifact_dir"], key)

def try_link(src, dst):
if os.path.islink(dst):
if os.path.islink(dst) or os.path.isfile(dst):
os.remove(dst)
try:
os.symlink(src, dst)
if config["debug_save_copy_method"] == "symlink":
os.symlink(src, dst)
elif config["debug_save_copy_method"] == "link":
os.link(src, dst)
elif config["debug_save_copy_method"] == "copy":
shutil.copy2(src, dst)
except Exception:
pass
if os.path.isfile(path):
Expand Down

0 comments on commit 6ab8973

Please sign in to comment.