Skip to content

Commit

Permalink
Kuberun should honour -bg (background) option #1159
Browse files Browse the repository at this point in the history
  • Loading branch information
pditommaso committed Jun 1, 2019
1 parent bff6c16 commit 4b160b7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Expand Up @@ -57,15 +57,17 @@ class CmdKubeRun extends CmdRun {
runName = runName.replace('_','-')
}

protected boolean background() { launcher.options.background }

@Override
void run() {
final scriptArgs = (args?.size()>1 ? args[1..-1] : []) as List<String>
final pipeline = stdin ? '-' : ( args ? args[0] : null )
if( !pipeline )
throw new AbortOperationException("No project name was specified")

checkRunName()
new K8sDriverLauncher(cmd: this, runName: runName, podImage: podImage).run(pipeline, scriptArgs)
new K8sDriverLauncher(cmd: this, runName: runName, podImage: podImage, background: background())
.run(pipeline, scriptArgs)
}

}
Expand Up @@ -87,6 +87,11 @@ class K8sDriverLauncher {

private boolean interactive

/**
* Runs in background mode
*/
private boolean background

/**
* Workflow script positional parameters
*/
Expand All @@ -103,14 +108,23 @@ class K8sDriverLauncher {
this.args = args
this.pipelineName = name
this.interactive = name == 'login'
if( background && interactive )
throw new AbortOperationException("Option -bg conflicts with interactive mode")
this.config = makeConfig(pipelineName)
this.k8sConfig = makeK8sConfig(config)
this.k8sClient = makeK8sClient(k8sConfig)
this.k8sConfig.checkStorageAndPaths(k8sClient)
createK8sConfigMap()
createK8sLauncherPod()
waitPodStart()
interactive ? launchLogin() : printK8sPodOutput()
// login into container session
if( interactive )
launchLogin()
// dump pod output
else if( !background )
printK8sPodOutput()
else
log.debug "Nextflow driver launched in background mode -- pod: $runName"
}

protected void waitPodStart() {
Expand Down

0 comments on commit 4b160b7

Please sign in to comment.