Skip to content

Commit

Permalink
Add initial support for bin in working directory
Browse files Browse the repository at this point in the history
Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
  • Loading branch information
lbeckman314 committed Dec 21, 2023
1 parent c46fa3a commit 0f36a79
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 0f36a79

Please sign in to comment.