Skip to content

Commit

Permalink
Merge pull request #1228 from blankenberg/wf_extrac_15.10
Browse files Browse the repository at this point in the history
[15.10] Fixes for dataset 'cleanup'/association linking when extracting workflows from a history.
  • Loading branch information
jmchilton committed Dec 8, 2015
2 parents 94b0499 + 8334593 commit 2be1707
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions lib/galaxy/workflow/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
from galaxy.tools import ToolOutputCollectionPart
from galaxy.tools.parameters.grouping import (
Conditional,
Repeat
Repeat,
Section
)
from .steps import (
attach_ordered_steps,
Expand Down Expand Up @@ -340,10 +341,11 @@ def cleanup( prefix, inputs, values ):
if k.startswith( key ):
del root_values[k]
elif isinstance( input, Repeat ):
group_values = values[key]
for i, rep_values in enumerate( group_values ):
rep_index = rep_values['__index__']
cleanup( "%s%s_%d|" % (prefix, key, rep_index ), input.inputs, group_values[i] )
if key in values:
group_values = values[key]
for i, rep_values in enumerate( group_values ):
rep_index = rep_values['__index__']
cleanup( "%s%s_%d|" % (prefix, key, rep_index ), input.inputs, group_values[i] )
elif isinstance( input, Conditional ):
# Scrub dynamic resource related parameters from workflows,
# they cause problems and the workflow probably should include
Expand All @@ -352,9 +354,13 @@ def cleanup( prefix, inputs, values ):
if input.name in values:
del values[input.name]
return
group_values = values[input.name]
current_case = group_values['__current_case__']
cleanup( "%s%s|" % ( prefix, key ), input.cases[current_case].inputs, group_values )
if input.name in values:
group_values = values[input.name]
current_case = group_values['__current_case__']
cleanup( "%s%s|" % ( prefix, key ), input.cases[current_case].inputs, group_values )
elif isinstance( input, Section ):
if input.name in values:
cleanup( "%s%s|" % ( prefix, key ), input.inputs, values[input.name] )
cleanup( "", inputs, values )
return associations

Expand Down

0 comments on commit 2be1707

Please sign in to comment.