From 8d099ef98b1b260b74747aceeb6c150e68889f29 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 21 Jan 2020 10:47:50 +0100 Subject: [PATCH] Only delete writable files on job resubmission --- lib/galaxy/jobs/command_factory.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/galaxy/jobs/command_factory.py b/lib/galaxy/jobs/command_factory.py index 1b2a413b0ad..ac660488bc5 100644 --- a/lib/galaxy/jobs/command_factory.py +++ b/lib/galaxy/jobs/command_factory.py @@ -99,15 +99,13 @@ def build_command( # usually working will already exist, but it will not for task # split jobs. - # Remove the working directory incase this is for instance a SLURM re-submission. + # Remove all non-readonly files in the workfing directory incase this is a re-submission. # xref https://github.com/galaxyproject/galaxy/issues/3289 - commands_builder.prepend_command("""# Delete working/ and outputs/ only if job was resubmitted + commands_builder.prepend_command(""" if [ -f .job_started ]; then - rm -rf working outputs; mkdir -p working outputs + find working outputs -perm /0222 -delete 2> /dev/null || true fi -touch .job_started -cd working -""", sep='') +mkdir -p working outputs; touch .job_started; cd working""") container_monitor_command = job_wrapper.container_monitor_command(container) if container_monitor_command: