2010-08-10 00:42:48 +08:00
|
|
|
package org.broadinstitute.sting.queue.engine
|
|
|
|
|
|
|
|
|
|
import org.broadinstitute.sting.queue.function.CommandLineFunction
|
2011-01-25 12:11:49 +08:00
|
|
|
import org.broadinstitute.sting.queue.util.ShellJob
|
2010-08-10 00:42:48 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Runs jobs one at a time locally
|
|
|
|
|
*/
|
2011-01-25 12:11:49 +08:00
|
|
|
class ShellJobRunner(val function: CommandLineFunction) extends CommandLineJobRunner {
|
2010-10-07 02:29:56 +08:00
|
|
|
private var runStatus: RunnerStatus.Value = _
|
|
|
|
|
|
2010-08-10 00:42:48 +08:00
|
|
|
/**
|
|
|
|
|
* Runs the function on the local shell.
|
|
|
|
|
* @param function Command to run.
|
|
|
|
|
*/
|
2011-01-25 12:11:49 +08:00
|
|
|
def start() {
|
|
|
|
|
val job = new ShellJob
|
2011-01-11 05:07:29 +08:00
|
|
|
|
2011-01-25 12:11:49 +08:00
|
|
|
job.workingDir = function.commandDirectory
|
|
|
|
|
job.outputFile = function.jobOutputFile
|
|
|
|
|
job.errorFile = function.jobErrorFile
|
2010-08-10 00:42:48 +08:00
|
|
|
|
2011-01-25 12:11:49 +08:00
|
|
|
writeExec()
|
|
|
|
|
job.shellScript = exec
|
2011-01-11 05:07:29 +08:00
|
|
|
|
2011-01-25 12:11:49 +08:00
|
|
|
// Allow advanced users to update the job.
|
|
|
|
|
updateJobRun(job)
|
2010-12-10 12:36:06 +08:00
|
|
|
|
2011-01-25 12:11:49 +08:00
|
|
|
runStatus = RunnerStatus.RUNNING
|
|
|
|
|
job.run()
|
|
|
|
|
runStatus = RunnerStatus.DONE
|
2010-08-10 00:42:48 +08:00
|
|
|
}
|
2010-10-07 02:29:56 +08:00
|
|
|
|
|
|
|
|
def status = runStatus
|
2010-08-10 00:42:48 +08:00
|
|
|
}
|