Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GH-32] Upload bin directory. #34

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package com.memverge.nextflow
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import nextflow.executor.AbstractGridExecutor
import nextflow.extension.FilesEx
import nextflow.processor.TaskConfig
import nextflow.processor.TaskRun
import nextflow.util.ServiceName
Expand All @@ -38,6 +39,8 @@ class FloatGridExecutor extends AbstractGridExecutor {

private AtomicInteger serial = new AtomicInteger()

private String _binDir

private FloatConf getFloatConf() {
return FloatConf.getConf(session.config)
}
Expand All @@ -49,6 +52,12 @@ class FloatGridExecutor extends AbstractGridExecutor {
return _floatJobs
}

@Override
protected void register() {
super.register()
uploadBinDir()
}

@Override
protected String getHeaderToken() {
return ''
Expand All @@ -58,11 +67,32 @@ class FloatGridExecutor extends AbstractGridExecutor {
protected List<String> getDirectives(TaskRun task, List<String> initial) {
log.info "[float] switch task ${task.id} to ${task.workDirStr}"
floatJobs.setWorkDir(task.id, task.workDirStr)

// go to the work directory
initial << 'cd'
initial << task.workDirStr

if (needBinDir()) {
// add path to the script
initial << 'export'
initial << 'PATH=$PATH:' + _binDir + '/bin'
}
return initial
}

private boolean needBinDir() {
return session.binDir && !session.binDir.empty() && !session.disableRemoteBinDir
}

private void uploadBinDir() {
// upload local binaries
if (needBinDir()) {
_binDir = getTempDir()
log.info "Uploading local `bin` ${session.binDir} to ${_binDir}/bin"
FilesEx.copyTo(session.binDir, _binDir)
}
}

private void validateTaskConf(TaskConfig config) {
if (!config.nfs && !floatConf.nfs) {
log.error '[float] missing "nfs": need a nfs to run float jobs'
Expand Down