From 045dd971ac8718cca877dedd41c77e128a5d1c64 Mon Sep 17 00:00:00 2001 From: DriesSchaumont <5946712+DriesSchaumont@users.noreply.github.com> Date: Mon, 23 Oct 2023 15:02:13 +0200 Subject: [PATCH 1/2] Using a nextflow module with the same name as a nextflow operator causes recursion. --- .../src/concat/config.vsh.yaml | 20 +++++++++++++ .../testnextflowvdsl3/src/concat/script.sh | 1 + .../operator_conflict/config.vsh.yaml | 13 ++++++++ .../src/test_wfs/operator_conflict/main.nf | 30 +++++++++++++++++++ 4 files changed, 64 insertions(+) create mode 100644 src/test/resources/testnextflowvdsl3/src/concat/config.vsh.yaml create mode 100644 src/test/resources/testnextflowvdsl3/src/concat/script.sh create mode 100644 src/test/resources/testnextflowvdsl3/src/test_wfs/operator_conflict/config.vsh.yaml create mode 100644 src/test/resources/testnextflowvdsl3/src/test_wfs/operator_conflict/main.nf diff --git a/src/test/resources/testnextflowvdsl3/src/concat/config.vsh.yaml b/src/test/resources/testnextflowvdsl3/src/concat/config.vsh.yaml new file mode 100644 index 000000000..2666064af --- /dev/null +++ b/src/test/resources/testnextflowvdsl3/src/concat/config.vsh.yaml @@ -0,0 +1,20 @@ +functionality: + name: concat + arguments: + - name: "--input" + type: file + required: true + example: input.txt + - name: "--output" + type: file + required: true + direction: output + example: output.txt + resources: + - type: bash_script + path: script.sh +platforms: + - type: native + - type: docker + image: nextflow/bash:latest + - type: nextflow diff --git a/src/test/resources/testnextflowvdsl3/src/concat/script.sh b/src/test/resources/testnextflowvdsl3/src/concat/script.sh new file mode 100644 index 000000000..d626016cc --- /dev/null +++ b/src/test/resources/testnextflowvdsl3/src/concat/script.sh @@ -0,0 +1 @@ +cp "$par_input" "$par_output" \ No newline at end of file diff --git a/src/test/resources/testnextflowvdsl3/src/test_wfs/operator_conflict/config.vsh.yaml b/src/test/resources/testnextflowvdsl3/src/test_wfs/operator_conflict/config.vsh.yaml new file mode 100644 index 000000000..c09eae976 --- /dev/null +++ b/src/test/resources/testnextflowvdsl3/src/test_wfs/operator_conflict/config.vsh.yaml @@ -0,0 +1,13 @@ +functionality: + name: operator_conflict + namespace: test_wfs + resources: + - type: nextflow_script + path: main.nf + entrypoint: base + # TODO: make absolute when the ns build uses the right CWD + - path: ../../../resources + dependencies: + - name: concat +platforms: + - type: nextflow \ No newline at end of file diff --git a/src/test/resources/testnextflowvdsl3/src/test_wfs/operator_conflict/main.nf b/src/test/resources/testnextflowvdsl3/src/test_wfs/operator_conflict/main.nf new file mode 100644 index 000000000..4099a20aa --- /dev/null +++ b/src/test/resources/testnextflowvdsl3/src/test_wfs/operator_conflict/main.nf @@ -0,0 +1,30 @@ + +workflow base { + take: input_ch + main: + + // generate list from 0 to 1 + ch = Channel.fromList(0..1) + | map { num -> + // create temporary file + file = tempFile() + file.write("num: $num") + + ["num$num", [ num: num, file: file ]] + } + | concat.run( + fromState: ["input": "input"], + toState: {id, output, state -> + def newState = [ + "step1_output": output.output, + "num": state.num, + "file": state.file + ] + return newState + } + ) + + + emit: + input_ch +} From 438211451881849f6020e56a6c93c467e9aebb06 Mon Sep 17 00:00:00 2001 From: DriesSchaumont <5946712+DriesSchaumont@users.noreply.github.com> Date: Mon, 23 Oct 2023 15:19:59 +0200 Subject: [PATCH 2/2] Add test to sbt --- .../viash/runners/nextflow/NextflowScriptTest.scala | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/scala/io/viash/runners/nextflow/NextflowScriptTest.scala b/src/test/scala/io/viash/runners/nextflow/NextflowScriptTest.scala index 4db43d0b1..cb8f1689a 100644 --- a/src/test/scala/io/viash/runners/nextflow/NextflowScriptTest.scala +++ b/src/test/scala/io/viash/runners/nextflow/NextflowScriptTest.scala @@ -122,6 +122,18 @@ class NextflowScriptTest extends AnyFunSuite with BeforeAndAfterAll { assert(exitCode == 0, s"\nexit code was $exitCode\nStd output:\n$stdOut\nStd error:\n$stdErr") } + test("Test conflicts with nextlow operator", DockerTest, NextflowTest) { + val (exitCode, stdOut, stdErr) = NextflowTestHelper.run( + mainScript = "target/nextflow/test_wfs/operator_conflict/main.nf", + args = List( + "--publish_dir", "output" + ), + cwd = tempFolFile + ) + + assert(exitCode == 0, s"\nexit code was $exitCode\nStd output:\n$stdOut\nStd error:\n$stdErr") + } + test("Test nested workflows", DockerTest, NextflowTest) { val (exitCode, stdOut, stdErr) = NextflowTestHelper.run(