File tree Expand file tree Collapse file tree 2 files changed +29
-4
lines changed Expand file tree Collapse file tree 2 files changed +29
-4
lines changed Original file line number Diff line number Diff line change 7
7
absolute_import )
8
8
from builtins import open
9
9
10
- import os
11
-
12
10
from ... import engine as pe
13
11
from ....interfaces import base as nib
14
- from ....interfaces .utility import IdentityInterface
12
+ from ....interfaces .utility import IdentityInterface , Function , Merge
15
13
from ....interfaces .base import traits , File
16
14
17
15
@@ -612,3 +610,20 @@ def nested_wf(i, name='smallwf'):
612
610
# there should be six nodes in total
613
611
assert len (result .nodes ()) == 6 , \
614
612
"The number of expanded nodes is incorrect."
613
+
614
+
615
+ def test_name_prefix_join (tmpdir ):
616
+ tmpdir .chdir ()
617
+
618
+ def sq (x ):
619
+ return x ** 2
620
+
621
+ wf = pe .Workflow ('wf' , base_dir = tmpdir .strpath )
622
+ square = pe .Node (Function (function = sq ), name = 'square' )
623
+ square .iterables = [('x' , [1 , 2 ])]
624
+ square_join = pe .JoinNode (Merge (1 , ravel_inputs = True ),
625
+ name = 'square_join' ,
626
+ joinsource = 'square' ,
627
+ joinfield = ['in1' ])
628
+ wf .connect (square , 'out' , square_join , "in1" )
629
+ wf .run ()
Original file line number Diff line number Diff line change @@ -1050,7 +1050,17 @@ def make_field_func(*pair):
1050
1050
expansions = defaultdict (list )
1051
1051
for node in graph_in .nodes ():
1052
1052
for src_id in list (old_edge_dict .keys ()):
1053
- if node .itername .startswith (src_id ):
1053
+ # Drop the original JoinNodes; only concerned with
1054
+ # generated Nodes
1055
+ if hasattr (node , 'joinfield' ):
1056
+ continue
1057
+ # Patterns:
1058
+ # - src_id : Non-iterable node
1059
+ # - src_id.[a-z]\d+ : IdentityInterface w/ iterables
1060
+ # - src_id.[a-z]I.[a-z]\d+ : Non-IdentityInterface w/ iterables
1061
+ # - src_idJ\d+ : JoinNode(IdentityInterface)
1062
+ if re .match (src_id + r'((\.[a-z](I\.[a-z])?|J)\d+)?$' ,
1063
+ node .itername ):
1054
1064
expansions [src_id ].append (node )
1055
1065
for in_id , in_nodes in list (expansions .items ()):
1056
1066
logger .debug ("The join node %s input %s was expanded"
You can’t perform that action at this time.
0 commit comments