Skip to content

Commit

Permalink
Fixed remote bin directory when using buckerDir option
Browse files Browse the repository at this point in the history
  • Loading branch information
pditommaso committed Dec 16, 2018
1 parent b61ee9a commit 6d79678
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class AwsBatchExecutor extends Executor {
*/
def disableBinDir = session.getExecConfigProp(name, 'disableRemoteBinDir', false)
if( session.binDir && !session.binDir.empty() && !disableBinDir ) {
def s3 = Nextflow.tempDir()
def s3 = getTempDir()
log.info "Uploading local `bin` scripts folder to ${s3.toUriString()}/bin"
remoteBinDir = FilesEx.copyTo(session.binDir, s3)
}
Expand Down
21 changes: 19 additions & 2 deletions src/main/groovy/nextflow/executor/Executor.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import java.nio.file.Path
import groovy.transform.PackageScope
import groovy.util.logging.Slf4j
import nextflow.Session
import nextflow.file.FileHelper
import nextflow.processor.TaskHandler
import nextflow.processor.TaskMonitor
import nextflow.processor.TaskRun
Expand Down Expand Up @@ -84,14 +85,30 @@ abstract class Executor {
}

/**
* The path where workflow scratch data is written.
* The path where scratch data is written for the current executor.
*
* @return The workflow base work directory
* @return The executor base work directory
*/
Path getWorkDir() {
session.getWorkDir()
}

/**
* Temporary work directory relative to the executor work directory
*
* @return The temporary directory path
*/
Path getTempDir( String name = null, boolean create = true ) {
def path = FileHelper.createTempFolder(getWorkDir())
if( name )
path = path.resolve(name)

if( !path.exists() && create && !path.mkdirs() )
throw new IOException("Unable to create folder: $path -- Check file system permission" )

return path
}

/**
* @return Create a new instance of the {@code TaskQueueHolder} component
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import java.nio.file.Path
import com.google.cloud.storage.contrib.nio.CloudStoragePath
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import nextflow.Nextflow
import nextflow.exception.AbortOperationException
import nextflow.executor.Executor
import nextflow.executor.SupportedScriptTypes
Expand All @@ -33,7 +32,6 @@ import nextflow.processor.TaskRun
import nextflow.script.ScriptType
import nextflow.util.Duration
import nextflow.util.ServiceName

/**
* Google Pipelines Executor.
*
Expand Down Expand Up @@ -112,7 +110,6 @@ class GooglePipelinesExecutor extends Executor {
throw new AbortOperationException("You can't specify both 'google.zone' and 'google.region' configuration parameters -- Please remove one of them from your configuration")
}


def path = session.config.navigate('env.PATH')
if( path ) {
log.warn "Environment PATH defined in config file is ignored by Google Pipeline executor"
Expand All @@ -124,8 +121,8 @@ class GooglePipelinesExecutor extends Executor {
def disableBinDir = session.getExecConfigProp(name, 'disableRemoteBinDir', false)
Path remoteBinDir = null
if( session.binDir && !disableBinDir ) {
def cloudPath = Nextflow.tempDir() + "/" //need the ending slash to mark it as a directory since it doesn't exist yet
log.info "Uploading local `bin` scripts folder to ${cloudPath.toUriString()}bin"
def cloudPath = getTempDir()
log.info "Uploading local `bin` scripts folder to ${cloudPath.toUriString()}/bin"
remoteBinDir = FilesEx.copyTo(session.binDir, cloudPath)
}

Expand Down

0 comments on commit 6d79678

Please sign in to comment.