Skip to content

Commit

Permalink
Fixed K8s launcher fails to set pod work directory
Browse files Browse the repository at this point in the history
The workflow execution work directory may be created by 
the pod itself by the init script. 

Therefore it should not be set as pod work directory otherwise the 
pod creation fails if it does not exist.
  • Loading branch information
pditommaso committed Nov 14, 2018
1 parent 697efff commit dc8bfea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/main/groovy/nextflow/k8s/K8sDriverLauncher.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,11 @@ class K8sDriverLauncher {
// -- setup config file
String cmd = "source /etc/nextflow/init.sh; ${getLaunchCli()}"

// create the launcher pod
new PodSpecBuilder()
.withPodName(runName)
.withImageName(k8sConfig.getNextflowImageName())
.withCommand(['/bin/bash', '-c', cmd])
.withWorkDir(k8sConfig.getLaunchDir())
.withLabels([ app: 'nextflow', runName: runName ])
.withNamespace(k8sClient.config.namespace)
.withServiceAccount(k8sClient.config.serviceAccount)
Expand All @@ -399,6 +399,8 @@ class K8sDriverLauncher {
.withEnv( PodEnv.value('NXF_ASSETS', k8sConfig.getProjectDir()) )
.withEnv( PodEnv.value('NXF_EXECUTOR', 'k8s'))
.build()

// note: do *not* set the work directory because it may need to be created by the init script
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/test/groovy/nextflow/k8s/K8sDriverLauncherTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ class K8sDriverLauncherTest extends Specification {
[name:'foo-boo',
image:'the-image',
command:['/bin/bash', '-c', "source /etc/nextflow/init.sh; nextflow run foo"],
workingDir: '/the/user/dir',
env:[
[name:'NXF_WORK', value:'/the/work/dir'],
[name:'NXF_ASSETS', value:'/the/project/dir'],
Expand Down

0 comments on commit dc8bfea

Please sign in to comment.