From 52fa00b03ccf85121288ae840a14b2b0654a150c Mon Sep 17 00:00:00 2001 From: John Chilton Date: Mon, 3 Aug 2015 16:06:58 +0100 Subject: [PATCH] Fixes for DeleteIntermediatesAction. Shouldn't assume the workflow invocation has completely been evaluated or that a job is available yet for invocation steps. --- lib/galaxy/jobs/actions/post.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/galaxy/jobs/actions/post.py b/lib/galaxy/jobs/actions/post.py index da867d47aa6..f82f907028c 100644 --- a/lib/galaxy/jobs/actions/post.py +++ b/lib/galaxy/jobs/actions/post.py @@ -399,9 +399,18 @@ class DeleteIntermediatesAction(DefaultJobAction): # concurrently, sometimes non-terminal steps won't be cleaned up # because of the lag in job state updates. wfi = job.workflow_invocation_step.workflow_invocation + if wfi.active: + log.debug("Workflow still scheduling so new jobs may appear, skipping deletion of intermediate files.") + # Still evaluating workflow so we don't yet have all workflow invocation + # steps to start looking at. + return if wfi.workflow.has_outputs_defined(): jobs_to_check = [wfistep.job for wfistep in wfi.steps if not wfistep.workflow_step.workflow_outputs] for j2c in jobs_to_check: + if j2c is None: + # Job not yet created, this will be re-evaluated after subsequent jobs in + # workflow. + return for input_dataset in [x.dataset for x in j2c.input_datasets if x.dataset.creating_job.workflow_invocation_step and x.dataset.creating_job.workflow_invocation_step.workflow_invocation == wfi]: safe_to_delete = True for job_to_check in [d_j.job for d_j in input_dataset.dependent_jobs]: