2010-08-10 00:42:48 +08:00
|
|
|
package org.broadinstitute.sting.queue.engine
|
|
|
|
|
|
|
|
|
|
import org.broadinstitute.sting.queue.util.{Logging, ShellJob}
|
|
|
|
|
import org.broadinstitute.sting.queue.function.CommandLineFunction
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Runs jobs one at a time locally
|
|
|
|
|
*/
|
2010-08-12 05:58:26 +08:00
|
|
|
class ShellJobRunner extends JobRunner with Logging {
|
2010-08-10 00:42:48 +08:00
|
|
|
/**
|
|
|
|
|
* Runs the function on the local shell.
|
|
|
|
|
* @param function Command to run.
|
|
|
|
|
* @param qGraph graph that holds the job, and if this is a dry run.
|
|
|
|
|
*/
|
|
|
|
|
def run(function: CommandLineFunction, qGraph: QGraph) = {
|
|
|
|
|
val job = new ShellJob
|
|
|
|
|
job.command = function.commandLine
|
|
|
|
|
job.workingDir = function.commandDirectory
|
|
|
|
|
job.outputFile = function.jobOutputFile
|
|
|
|
|
job.errorFile = function.jobErrorFile
|
|
|
|
|
|
|
|
|
|
if (logger.isDebugEnabled) {
|
|
|
|
|
logger.debug(function.commandDirectory + " > " + function.commandLine)
|
|
|
|
|
} else {
|
|
|
|
|
logger.info(function.commandLine)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!qGraph.dryRun)
|
|
|
|
|
job.run
|
|
|
|
|
}
|
|
|
|
|
}
|