diff --git a/src/dflow/config.py b/src/dflow/config.py index 5b1db197..7e9028d9 100644 --- a/src/dflow/config.py +++ b/src/dflow/config.py @@ -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"), } diff --git a/src/dflow/step.py b/src/dflow/step.py index 8795be01..c912f1c6 100644 --- a/src/dflow/step.py +++ b/src/dflow/step.py @@ -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):