From 0f36a79ca5522aa34be539e06015637591b4c601 Mon Sep 17 00:00:00 2001 From: Liam Beckman Date: Wed, 20 Dec 2023 16:48:23 -0800 Subject: [PATCH] Add initial support for `bin` in working directory Signed-off-by: Liam Beckman --- .../ga4gh/tes/executor/TesFileCopyStrategy.groovy | 3 ++- .../ga4gh/tes/executor/TesTaskHandler.groovy | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/plugins/nf-ga4gh/src/main/nextflow/ga4gh/tes/executor/TesFileCopyStrategy.groovy b/plugins/nf-ga4gh/src/main/nextflow/ga4gh/tes/executor/TesFileCopyStrategy.groovy index 9b8362705d..03f37a764a 100644 --- a/plugins/nf-ga4gh/src/main/nextflow/ga4gh/tes/executor/TesFileCopyStrategy.groovy +++ b/plugins/nf-ga4gh/src/main/nextflow/ga4gh/tes/executor/TesFileCopyStrategy.groovy @@ -113,7 +113,8 @@ class TesFileCopyStrategy implements ScriptFileCopyStrategy { copy.remove('PATH') // when a remote bin directory is provide managed it properly if( remoteBinDir ) { - result << "cp -r ${remoteBinDir}/* \$PWD/nextflow-bin/\n" + result << "mkdir -p \$PWD/nextflow-bin/\n" + result << "cp -r \$PWD/bin/* \$PWD/nextflow-bin/\n" result << "chmod +x \$PWD/nextflow-bin/* || true\n" result << "export PATH=\$PWD/nextflow-bin:\$PATH\n" } diff --git a/plugins/nf-ga4gh/src/main/nextflow/ga4gh/tes/executor/TesTaskHandler.groovy b/plugins/nf-ga4gh/src/main/nextflow/ga4gh/tes/executor/TesTaskHandler.groovy index 2d26b1ee83..a56684fa37 100644 --- a/plugins/nf-ga4gh/src/main/nextflow/ga4gh/tes/executor/TesTaskHandler.groovy +++ b/plugins/nf-ga4gh/src/main/nextflow/ga4gh/tes/executor/TesTaskHandler.groovy @@ -23,6 +23,7 @@ import static nextflow.processor.TaskStatus.COMPLETED import static nextflow.processor.TaskStatus.RUNNING import java.nio.file.Path +import java.nio.file.Files import groovy.transform.CompileStatic import groovy.util.logging.Slf4j @@ -189,6 +190,10 @@ class TesTaskHandler extends TaskHandler { // add task control files body.addInputsItem(inItem(scriptFile)) body.addInputsItem(inItem(wrapperFile)) + Path remoteBinDir = executor.getRemoteBinDir() + Files.newDirectoryStream(remoteBinDir).each { path -> + body.addInputsItem(inItem(path, null ,true)) + } // add task input files if(inputFile.exists()) body.addInputsItem(inItem(inputFile)) @@ -234,10 +239,15 @@ class TesTaskHandler extends TaskHandler { return size != null ? ((double)size.bytes)/1073741824 : null } - private TesInput inItem( Path realPath, String fileName = null) { + private TesInput inItem( Path realPath, String fileName = null, boolean isBin = false) { def result = new TesInput() result.url = realPath.toUriString() - result.path = fileName ? "$WORK_DIR/$fileName" : "$WORK_DIR/${realPath.getName()}" + if (isBin) { + result.path = fileName ? "$WORK_DIR/bin/$fileName" : "$WORK_DIR/bin/${realPath.getName()}" + } + else { + result.path = fileName ? "$WORK_DIR/$fileName" : "$WORK_DIR/${realPath.getName()}" + } log.trace "[TES] Adding INPUT file: $result" return result }