Skip to content

Commit

Permalink
Fix using .run() without fromState defined an an input channel of t…
Browse files Browse the repository at this point in the history
…uples with more than two elements. (#587)

* Add failing example

* Implement fix

* Add CHANGELOG entry
  • Loading branch information
DriesSchaumont authored Nov 20, 2023
1 parent aed4d36 commit b59376f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

TODO add summary

## BUG FIXES

* `NextflowPlatform`: Fix `Invalid method invocation 'call'` error when using `.run()` without `fromState` defined and the input channel holds tuples with more than two elements (PR #587). This issue also impacts some other helper functionality like `runEach()`.

# Viash 0.8.0 (2023-10-23): Nextflow workflows and dependencies

Nextflow workflows definitions are picked up by Viash and assembled into a functional Nextflow workflow, reducing the amount of boilerplate code needed to be written by the user.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def workflowFactory(Map args, Map defaultWfArgs, Map meta) {
def new_data = workflowArgs.fromState(it.take(2))
[it[0], new_data]
} :
chRun
chRun | map {tup -> tup.take(2)}

// fill in defaults
chArgsWithDefaults = chArgs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ workflow base {
file = tempFile()
file.write("num: $num")

["num$num", [ num: num, file: file ]]
["num$num", [ file: file ], ["num": num]]
}
| sub_workflow.run(
fromState: ["file": "file"],
toState: {id, output, state ->
def newState = [
"step1_output": output.output,
Expand All @@ -22,8 +21,8 @@ workflow base {
return newState
}
)
| view{ id, state ->
def num = state.num
| view{ id, state, extra ->
def num = extra.num

// check id
assert id == "num$num": "id should be 'num$num'. Found: '$id'"
Expand Down

0 comments on commit b59376f

Please sign in to comment.