From 43523dac98c6a7dda819caa7835349c11adf0a6c Mon Sep 17 00:00:00 2001 From: John Chilton Date: Mon, 18 Jul 2016 08:36:27 -0400 Subject: [PATCH 1/2] Fix flushing so mapped output collections created uniformly. --- lib/galaxy/tools/execute.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/galaxy/tools/execute.py b/lib/galaxy/tools/execute.py index 2e28e6aa014..04afd97130f 100644 --- a/lib/galaxy/tools/execute.py +++ b/lib/galaxy/tools/execute.py @@ -192,6 +192,9 @@ class ToolExecutionTracker( object ): job.add_output_dataset_collection( output_name, collection ) collections[ output_name ] = collection + # Needed to flush the association created just above with + # job.add_output_dataset_collection. + trans.sa_session.flush() self.implicit_collections = collections __all__ = [ execute ] From 9ede8e556be1f6038361b579c1457068e50e951a Mon Sep 17 00:00:00 2001 From: John Chilton Date: Mon, 18 Jul 2016 17:01:15 -0400 Subject: [PATCH 2/2] Fix duplicated entries when using collections in history extract. This would "sometimes" correctly pick the first job to represent a collection creation step but in many cases not. Explicitly grab the "first". --- lib/galaxy/workflow/extract.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/galaxy/workflow/extract.py b/lib/galaxy/workflow/extract.py index 285afda733b..5737eb6f57e 100644 --- a/lib/galaxy/workflow/extract.py +++ b/lib/galaxy/workflow/extract.py @@ -220,15 +220,17 @@ class WorkflowSummary( object ): dataset_collection = content hid = content.hid self.collection_types[ hid ] = content.collection.collection_type - if content.creating_job_associations: - for assoc in content.creating_job_associations: - job = assoc.job - if job not in self.jobs or self.jobs[ job ][ 0 ][ 1 ].history_content_type == "dataset": - self.jobs[ job ] = [ ( assoc.name, dataset_collection ) ] - if content.implicit_output_name: - self.implicit_map_jobs.append( job ) - else: - self.jobs[ job ].append( ( assoc.name, dataset_collection ) ) + cja = content.creating_job_associations + if cja: + # Use the first job to represent all mapped jobs. + representive_job_assoc = content.creating_job_associations[0] + job = representive_job_assoc.job + if job not in self.jobs or self.jobs[ job ][ 0 ][ 1 ].history_content_type == "dataset": + self.jobs[ job ] = [ ( representive_job_assoc.name, dataset_collection ) ] + if content.implicit_output_name: + self.implicit_map_jobs.append( job ) + else: + self.jobs[ job ].append( ( representive_job_assoc.name, dataset_collection ) ) # This whole elif condition may no longer be needed do to additional # tracking with creating_job_associations. Will delete at some point. elif content.implicit_output_name: