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

fix: issue #1257 (missing logfile failure when using shadow directory) #1258

Merged
merged 5 commits into from Nov 27, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 3 additions & 8 deletions snakemake/dag.py
Expand Up @@ -638,17 +638,10 @@ def unneeded_files():

def handle_log(self, job, upload_remote=True):
for f in job.log:
f = job.shadowed_path(f)
if not f.exists_local:
# If log file was not created during job, create an empty one.
f.touch_or_create()
if upload_remote and f.is_remote and not f.should_stay_on_remote:
f.upload_to_remote()
if not f.exists_remote:
raise RemoteFileException(
"The file upload was attempted, but it does not "
"exist on remote. Check that your credentials have "
"read AND write permissions."
)

def handle_remote(self, job, upload=True):
"""Remove local files if they are no longer needed and upload."""
Expand All @@ -657,6 +650,8 @@ def handle_remote(self, job, upload=True):
files = job.expanded_output
if job.benchmark:
files = chain(job.expanded_output, (job.benchmark,))
if job.log:
files = chain(files, job.log)
for f in files:
if f.is_remote and not f.should_stay_on_remote:
f.upload_to_remote()
Expand Down
4 changes: 4 additions & 0 deletions tests/test_shadowed_log/Snakefile
@@ -0,0 +1,4 @@
rule all:
shadow: "minimal"
output: touch("all.out")
log: "all.log"
Empty file.
Empty file.
5 changes: 5 additions & 0 deletions tests/tests.py
Expand Up @@ -357,6 +357,11 @@ def test_shadow_prefix_qsub():
run(dpath("test_shadow_prefix"), shadow_prefix="shadowdir", cluster="./qsub")


@skip_on_windows
def test_shadowed_log():
run(dpath("test_shadowed_log"))


def test_until():
run(
dpath("test_until"),
Expand Down