Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

* `NextflowRunner`: Fix `readCsv` failing on S3 paths with Nextflow 25.10.x (PR #864). The `BufferedReader.ready()` method returns false for S3 streams when no data is pre-buffered, which broke compatibility with AWS SDK v2 used in Nextflow 25.10.x.

* `Nextflowrunner`: fix publishing of directories when the output file name template contains a trailing slash (PR #867).

# Viash 0.9.6 (2025-10-10): Hotfix for dependency path resolution

This release fixes an issue with dependency resolution in some edge cases that was introduced in Viash 0.9.5.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,25 @@ process publishFilesProc {
]
.transpose()
.collectMany{infile, outfile ->
if (infile.toString() != outfile.toString()) {
def infileString = infile.toString()
def outfileString = outfile.toString()
if (infileString != outfileString) {
/* Trailing slashes are removed from both the source and destination arguments.
From source arguments, this is useful when a source argument may have a trailing slash
and specify a symbolic link to a directory. Without removing the slash, cp will dereference
the symbolic link.
See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1

For the destination path addding a trailing slash is a problem when publishing directories:
it requires the destination directory to exist. This fails because we only create the parent
directories first.
*/
def regexTrailingSlashes = ~/\/+$/
def infileNoTrailingSlash = infileString - regexTrailingSlashes
def outfileNoTrailingSlash = outfileString - regexTrailingSlashes
[
"[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"",
"cp -r '${infile.toString()}' '${outfile.toString()}'"
"[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"",
"cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'"
]
} else {
// no need to copy if infile is the same as outfile
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: output_directory
arguments:
- name: "--output"
type: file
required: true
direction: output
resources:
- type: bash_script
path: script.sh
engines:
- type: native
- type: docker
image: nextflow/bash:latest
runners:
- type: nextflow
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/test

[ -d "$par_output" ] && rm "$par_output"

mkdir -p "$par_output"
echo "test123" > "${par_output}/test1.txt"
22 changes: 22 additions & 0 deletions src/test/scala/io/viash/runners/nextflow/Vdsl3StandaloneTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,28 @@ class Vdsl3StandaloneTest extends AnyFunSuite with BeforeAndAfterAll {
}
}

test("Output directory slashes", NextflowTest) {
Comment thread
DriesSchaumont marked this conversation as resolved.
Outdated
val (exitCode, stdOut, stdErr) = NextflowTestHelper.run(
mainScript = "target/nextflow/output_directory/main.nf",
args = List(
"--output", "$id.$key.foo/",
"--publish_dir", "moduleOutputDir1"
),
cwd = tempFolFile
)

assert(exitCode == 0, s"\nexit code was $exitCode\nStd output:\n$stdOut\nStd error:\n$stdErr")

val src = Source.fromFile(tempFolStr + "/moduleOutputDir1/run.output_directory.foo/test1.txt")

try {
val moduleOut = src.getLines().mkString(",")
assert(moduleOut.equals("test123"))
} finally {
src.close()
}
}

override def afterAll(): Unit = {
IO.deleteRecursively(temporaryFolder)
}
Expand Down
Loading