2010-05-24 04:21:09 +08:00
|
|
|
package org.broadinstitute.sting.queue
|
|
|
|
|
|
|
|
|
|
import tools.nsc.MainGenericRunner
|
|
|
|
|
import org.broadinstitute.sting.queue.util.ClasspathUtils
|
|
|
|
|
import collection.mutable.ListBuffer
|
|
|
|
|
import org.broadinstitute.sting.queue.util.Logging
|
|
|
|
|
|
|
|
|
|
object QCommandLine extends Application with Logging {
|
2010-07-01 02:37:58 +08:00
|
|
|
var usage = """usage: java -jar Queue.jar [-P name=value] [-P file.properties] [-I input.file] [-I input_files.list] [-bsub] [-bsubWait] [-dry] [-debug] -S pipeline.scala"""
|
2010-05-24 04:21:09 +08:00
|
|
|
|
|
|
|
|
override def main(args: Array[String]) = {
|
2010-05-26 06:52:29 +08:00
|
|
|
val qArgs: QArguments = try {
|
|
|
|
|
new QArguments(args)
|
2010-05-24 04:21:09 +08:00
|
|
|
} catch {
|
2010-05-26 06:52:29 +08:00
|
|
|
case exception => {
|
2010-06-15 12:43:46 +08:00
|
|
|
println(exception)
|
2010-05-24 04:21:09 +08:00
|
|
|
println(usage)
|
|
|
|
|
System.exit(-1)
|
|
|
|
|
}
|
2010-05-26 06:52:29 +08:00
|
|
|
null
|
2010-05-24 04:21:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.debug("starting")
|
|
|
|
|
|
2010-05-26 06:52:29 +08:00
|
|
|
if (qArgs.scripts.size == 0) {
|
2010-05-24 04:21:09 +08:00
|
|
|
println("Error: Missing script")
|
|
|
|
|
println(usage)
|
|
|
|
|
System.exit(-1)
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-26 06:52:29 +08:00
|
|
|
// NOTE: Something in MainGenericRunner is exiting the VM.
|
|
|
|
|
if (qArgs.scripts.size != 1) {
|
|
|
|
|
println("Error: Only one script can be run at a time")
|
2010-05-24 04:21:09 +08:00
|
|
|
println(usage)
|
|
|
|
|
System.exit(-1)
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-26 06:52:29 +08:00
|
|
|
val newArgs = new ListBuffer[String]
|
|
|
|
|
newArgs.appendAll(args)
|
|
|
|
|
QArguments.strip(newArgs, "-S")
|
|
|
|
|
newArgs.prepend("-nocompdaemon", "-classpath", ClasspathUtils.manifestAwareClassPath, qArgs.scripts.head)
|
|
|
|
|
MainGenericRunner.main(newArgs.toArray)
|
|
|
|
|
|
2010-06-15 12:43:46 +08:00
|
|
|
// NOTE: This line is not reached because the MainGenericRunner exits the VM.
|
2010-05-24 04:21:09 +08:00
|
|
|
logger.debug("exiting")
|
|
|
|
|
}
|
|
|
|
|
}
|