Skip to content

Commit

Permalink
Remove support for dsl1 multi into
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <[email protected]>
  • Loading branch information
pditommaso committed Nov 29, 2022
1 parent 4af2b1f commit f664af4
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 59 deletions.
7 changes: 4 additions & 3 deletions modules/nextflow/src/main/groovy/nextflow/dag/DAG.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,11 @@ class DAG {

def result = []
for(OutParam p :outputs) {
if( p instanceof DefaultOutParam ) break
for(Object it : p.outChannels) {
if( p instanceof DefaultOutParam )
break
final it = p.getOutChannel()
if( it!=null )
result << new ChannelHandler(channel: it, label: p instanceof TupleOutParam ? null : p.name)
}
}

return result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1397,8 +1397,8 @@ class TaskProcessor {

protected void bindOutParam( OutParam param, List values ) {
log.trace "<$name> Binding param $param with $values"
def x = values.size() == 1 ? values[0] : values
for( def it : param.getOutChannels() ) { it.bind(x) }
final x = values.size() == 1 ? values[0] : values
param.getOutChannel()?.bind(x)
}

protected void collectOutputs( TaskRun task ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ interface OutParam extends Cloneable {
*/
DataflowWriteChannel getOutChannel()

@Deprecated List<DataflowWriteChannel> getOutChannels()

short getIndex()

@Deprecated Mode getMode()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class OutputsList implements List<OutParam>, Cloneable {

List<DataflowWriteChannel> getChannels() {
final List<DataflowWriteChannel> result = new ArrayList<>(target.size())
for(OutParam param : target) { result.addAll(param.getOutChannels()) }
for(OutParam param : target) { result.add(param.getOutChannel()) }
return result
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ class DAGTest extends Specification {
pInList.add( ip1 )

def pOutList = new OutputsList()
def op1 = Mock(OutParam) { getOutChannels() >> [chE] }
def op1 = Mock(OutParam) { getOutChannel() >> chE }
pOutList.add( op1 )

when:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,7 @@ class ParamsOutTest extends Specification {
process foo {
output:
val one into a
val two into p, q
file 'three' into b
file 'four' into x,y,z
file 'two' into b
return ''
}
'''
Expand All @@ -142,31 +140,17 @@ class ParamsOutTest extends Specification {
when:
def process = parseAndReturnProcess(text, binding)
def out0 = (ValueOutParam)process.config.getOutputs().get(0)
def out1 = (ValueOutParam)process.config.getOutputs().get(1)
def out2 = (FileOutParam)process.config.getOutputs().get(2)
def out3 = (FileOutParam)process.config.getOutputs().get(3)
def out1 = (FileOutParam)process.config.getOutputs().get(1)

then:
process.config.getOutputs().size() == 4
process.config.getOutputs().size() == 2

out0.name == 'one'
out0.getOutChannels().size()==1
out0.getOutChannels().get(0) instanceof DataflowQueue

out1.name == 'two'
out1.getOutChannels().size()==2
out1.getOutChannels().get(0) instanceof DataflowQueue
out1.getOutChannels().get(1) instanceof DataflowQueue
out0.getOutChannel() instanceof DataflowQueue

out2.name == null
out2.getOutChannels().size()==1
out2.getOutChannels().get(0) instanceof DataflowQueue
out1.name == null
out1.getOutChannel() instanceof DataflowQueue

out3.name == null
out3.getOutChannels().size()==3
out3.getOutChannels().get(0) instanceof DataflowQueue
out3.getOutChannels().get(1) instanceof DataflowQueue
out3.getOutChannels().get(2) instanceof DataflowQueue
}

def testFileOutParams() {
Expand Down Expand Up @@ -366,30 +350,30 @@ class ParamsOutTest extends Specification {
then:
out0.name == 'x'
out0.getFilePatterns(binding,null) == ['hola']
out0.getOutChannels().get(0) instanceof DataflowQueue
out0.getOutChannels().get(0) == binding.x
out0.getOutChannel() instanceof DataflowQueue
out0.getOutChannel() == binding.x

out1.name == null
out1.getFilePatterns(binding,null) == ['hola_2']
out1.getOutChannels().get(0) instanceof DataflowQueue
out1.getOutChannels().get(0) == binding.q
out1.getOutChannel() instanceof DataflowQueue
out1.getOutChannel() == binding.q

out2.inner[0] instanceof FileOutParam
(out2.inner[0] as FileOutParam).name == 'z'
(out2.inner[0] as FileOutParam).getFilePatterns(binding,null) == ['hola_z']

out3.name == 'u'
out3.getFilePatterns(binding,null) == ['u']
out3.getOutChannels().get(0) instanceof DataflowQueue
out3.getOutChannels().get(0) == binding.u
out3.getOutChannel() instanceof DataflowQueue
out3.getOutChannel() == binding.u

out4.name == null
out4.getFilePatterns(binding,null) == ['file_v']
out4.getOutChannels().size()==0
out4.getOutChannel() == null

out5.name == null
out5.getFilePatterns(binding,null) == ['w']
out4.getOutChannels().size()==0
out4.getOutChannel() == null
}


Expand Down Expand Up @@ -523,17 +507,17 @@ class ParamsOutTest extends Specification {
then:
out0.name == null
out0.getFilePatterns(binding,null) == ['x']
out0.getOutChannels().size()==0
!out0.getOutChannel()

out1.name == 'y'
out1.getFilePatterns(binding,null) == ['y']
out1.getOutChannels().get(0) instanceof DataflowQueue
out1.getOutChannels().get(0) == binding.y
out1.getOutChannel() instanceof DataflowQueue
out1.getOutChannel() == binding.y

out2.name == null
out2.getFilePatterns(binding,null) == ['z']
out2.getOutChannels().get(0) instanceof DataflowQueue
out2.getOutChannels().get(0) == binding.channel_z
out2.getOutChannel() instanceof DataflowQueue
out2.getOutChannel() == binding.channel_z
}


Expand Down Expand Up @@ -753,7 +737,7 @@ class ParamsOutTest extends Specification {
process.config.getOutputs().size() == 1

// first set
out0.getOutChannels().size()==0
out0.getOutChannel() == null

out0.inner[0] instanceof ValueOutParam
out0.inner[0].name == 'X'
Expand All @@ -776,7 +760,6 @@ class ParamsOutTest extends Specification {
output:
stdout into p
stdout into (q)
stdout into (x,y,z)
return ''
}
Expand All @@ -788,16 +771,12 @@ class ParamsOutTest extends Specification {
when:
def out0 = (StdOutParam)process.config.getOutputs().get(0)
def out1 = (StdOutParam)process.config.getOutputs().get(1)
def out2 = (StdOutParam)process.config.getOutputs().get(2)

then:
process.config.getOutputs().size() == 3
process.config.getOutputs().size() == 2

out0.getOutChannels()[0].is binding.p
out1.getOutChannels()[0].is binding.q
out2.getOutChannels()[0].is binding.x
out2.getOutChannels()[1].is binding.y
out2.getOutChannels()[2].is binding.z
out0.getOutChannel().is binding.p
out1.getOutChannel().is binding.q

}

Expand Down Expand Up @@ -948,20 +927,17 @@ class ParamsOutTest extends Specification {

out0.getName() == 'x'
out0.getFilePattern() == null
out0.getOutChannels().size()==1
out0.getOutChannels().get(0) instanceof DataflowQueue
out0.getOutChannel() instanceof DataflowQueue
out0.isPathQualifier()

out1.getName() == null
out1.getFilePattern() == 'hello.*'
out1.getOutChannels().size()==1
out1.getOutChannels().get(0) instanceof DataflowQueue
out1.getOutChannel() instanceof DataflowQueue
out1.isPathQualifier()

out2.getName() == null
out2.getFilePattern() == 'hello.txt'
out2.getOutChannels().size()==1
out2.getOutChannels().get(0) instanceof DataflowQueue
out2.getOutChannel() instanceof DataflowQueue
out2.isPathQualifier()

}
Expand Down

0 comments on commit f664af4

Please sign in to comment.