diff --git a/build.xml b/build.xml index ce91d935b..b27893493 100644 --- a/build.xml +++ b/build.xml @@ -401,6 +401,16 @@ + + + + + + + + + @@ -409,13 +419,6 @@ - - - - - - - @@ -440,7 +443,7 @@ - + @@ -472,6 +475,9 @@ + + + @@ -487,7 +493,7 @@ - + diff --git a/scala/src/org/broadinstitute/sting/queue/engine/QGraphSettings.scala b/scala/src/org/broadinstitute/sting/queue/engine/QGraphSettings.scala index 10b795fa0..be4dea51a 100644 --- a/scala/src/org/broadinstitute/sting/queue/engine/QGraphSettings.scala +++ b/scala/src/org/broadinstitute/sting/queue/engine/QGraphSettings.scala @@ -58,7 +58,7 @@ class QGraphSettings { var statusEmailTo: List[String] = Nil @Argument(fullName="status_email_from", shortName="statusFrom", doc="Email address to send emails from upon completion or on error.", required=false) - var statusEmailFrom: String = System.getProperty("user.name") + "@" + SystemUtils.domainName + var statusEmailFrom: String = System.getProperty("user.name") + "@" + SystemUtils.mailName @Argument(fullName="dot_graph", shortName="dot", doc="Outputs the queue graph to a .dot file. See: http://en.wikipedia.org/wiki/DOT_language", required=false) var dotFile: File = _ diff --git a/scala/src/org/broadinstitute/sting/queue/function/InProcessFunction.scala b/scala/src/org/broadinstitute/sting/queue/function/InProcessFunction.scala index 00207fea0..783eef1bf 100644 --- a/scala/src/org/broadinstitute/sting/queue/function/InProcessFunction.scala +++ b/scala/src/org/broadinstitute/sting/queue/function/InProcessFunction.scala @@ -1,3 +1,27 @@ +/* + * Copyright (c) 2011, The Broad Institute + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + package org.broadinstitute.sting.queue.function /** @@ -5,5 +29,5 @@ package org.broadinstitute.sting.queue.function */ trait InProcessFunction extends QFunction { def run() - def description = (List(this.getClass.getSimpleName) ++ this.outputs.filterNot(file => isLogFile(file)).map(_.getAbsolutePath)).mkString(" ") + def description = this.getClass.getSimpleName + " " + this.commandOutputs.mkString(" ") } diff --git a/scala/src/org/broadinstitute/sting/queue/function/QFunction.scala b/scala/src/org/broadinstitute/sting/queue/function/QFunction.scala index d3176da9c..3cdd7a913 100644 --- a/scala/src/org/broadinstitute/sting/queue/function/QFunction.scala +++ b/scala/src/org/broadinstitute/sting/queue/function/QFunction.scala @@ -145,12 +145,6 @@ trait QFunction extends Logging { Some(files.exists(_.exists)) } - /** - * Returns true if the file should be used for status output. - * @return true if the file should be used for status output. - */ - def useStatusOutput(file: File) = !isLogFile(file) - /** * Returns true if the file is a log file for this function. */ @@ -161,9 +155,8 @@ trait QFunction extends Logging { * Returns the output files for this function. * @return Set[File] outputs for this function. */ - private def statusPaths = outputs - .filter(file => useStatusOutput(file)) - .map(file => file.getParentFile + "/." + file.getName) + private def statusPaths = + commandOutputs.map(file => file.getParentFile + "/." + file.getName) /** * Returns the output files for this function. @@ -203,6 +196,12 @@ trait QFunction extends Logging { */ def outputs = getFieldFiles(outputFields) + /** + * Returns the non-log outputs for this function. + * @return the non-log outputs for this function. + */ + def commandOutputs = outputs.filterNot(file => isLogFile(file)) + /** * Returns the set of directories where files may be written. */ @@ -227,7 +226,7 @@ trait QFunction extends Logging { * Deletes the output files and all the status files for this function. */ def deleteOutputs() = { - outputs.filterNot(file => isLogFile(file)).foreach(file => IOUtils.tryDelete(file)) + commandOutputs.foreach(file => IOUtils.tryDelete(file)) doneOutputs.foreach(file => IOUtils.tryDelete(file)) failOutputs.foreach(file => IOUtils.tryDelete(file)) } diff --git a/scala/src/org/broadinstitute/sting/queue/function/scattergather/CloneFunction.scala b/scala/src/org/broadinstitute/sting/queue/function/scattergather/CloneFunction.scala index fa627a7de..b5cef3d5c 100644 --- a/scala/src/org/broadinstitute/sting/queue/function/scattergather/CloneFunction.scala +++ b/scala/src/org/broadinstitute/sting/queue/function/scattergather/CloneFunction.scala @@ -62,11 +62,10 @@ class CloneFunction extends CommandLineFunction { } } + override def commandOutputs = withScatterPart(() => originalFunction.commandOutputs) override def dotString = withScatterPart(() => originalFunction.dotString) override def description = withScatterPart(() => originalFunction.description) override protected def functionFieldClass = originalFunction.getClass - override def useStatusOutput(file: File) = - !isLogFile(file) && originalFunction.useStatusOutput(file) def commandLine = withScatterPart(() => originalFunction.commandLine) diff --git a/scala/src/org/broadinstitute/sting/queue/function/scattergather/GathererFunction.scala b/scala/src/org/broadinstitute/sting/queue/function/scattergather/GathererFunction.scala index 2c56e4a86..c1204fd1d 100644 --- a/scala/src/org/broadinstitute/sting/queue/function/scattergather/GathererFunction.scala +++ b/scala/src/org/broadinstitute/sting/queue/function/scattergather/GathererFunction.scala @@ -38,4 +38,5 @@ class GathererFunction(gathererClass: Class[_ <: Gatherer]) extends InProcessFun waitForGatherParts gatherer.gather(this.gatherParts, this.originalOutput) } + override def description = this.gathererClass.getSimpleName + " " + this.commandOutputs.mkString(" ") } diff --git a/scala/src/org/broadinstitute/sting/queue/function/scattergather/ScatterGatherableFunction.scala b/scala/src/org/broadinstitute/sting/queue/function/scattergather/ScatterGatherableFunction.scala index 9938aca02..e6294c093 100644 --- a/scala/src/org/broadinstitute/sting/queue/function/scattergather/ScatterGatherableFunction.scala +++ b/scala/src/org/broadinstitute/sting/queue/function/scattergather/ScatterGatherableFunction.scala @@ -252,7 +252,7 @@ trait ScatterGatherableFunction extends CommandLineFunction { if (ReflectionUtils.hasAnnotation(gatherField.field, classOf[Gather])) { gatherClass = ReflectionUtils.getAnnotation(gatherField.field, classOf[Gather]).value } else { - throw new QException("Missing @Gather annotation: " + gatherField.field.getName) + throw new QException("Missing @Gather annotation: " + gatherField.field) } } diff --git a/scala/src/org/broadinstitute/sting/queue/util/SystemUtils.scala b/scala/src/org/broadinstitute/sting/queue/util/SystemUtils.scala index fb13f6ebb..0bb4977b4 100644 --- a/scala/src/org/broadinstitute/sting/queue/util/SystemUtils.scala +++ b/scala/src/org/broadinstitute/sting/queue/util/SystemUtils.scala @@ -1,7 +1,33 @@ +/* + * Copyright (c) 2011, The Broad Institute + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + package org.broadinstitute.sting.queue.util import java.lang.management.ManagementFactory import java.net.InetAddress +import java.io.File +import io.Source /** * A collection of various system utilities. @@ -10,8 +36,11 @@ object SystemUtils { val inetAddress = InetAddress.getLocalHost.getHostAddress val hostName = InetAddress.getLocalHost.getCanonicalHostName - val domainName = { - if (hostName == inetAddress) + val mailName = { + val mailnameFile = new File("/etc/mailname") + if (mailnameFile.exists) + Source.fromFile(mailnameFile).mkString.trim + else if (hostName == inetAddress) inetAddress else hostName.split('.').takeRight(2).mkString(".") diff --git a/scala/test/org/broadinstitute/sting/queue/util/SystemUtilsUnitTest.scala b/scala/test/org/broadinstitute/sting/queue/util/SystemUtilsUnitTest.scala index cafb1994d..c79299dd8 100644 --- a/scala/test/org/broadinstitute/sting/queue/util/SystemUtilsUnitTest.scala +++ b/scala/test/org/broadinstitute/sting/queue/util/SystemUtilsUnitTest.scala @@ -32,12 +32,12 @@ class SystemUtilsUnitTest { def testHostInfo { val inetAddress = SystemUtils.inetAddress val hostName = SystemUtils.hostName - val domainName = SystemUtils.domainName + val mailName = SystemUtils.mailName - if (inetAddress.split('.').takeRight(2).mkString(".") == domainName) + if (inetAddress.split('.').takeRight(2).mkString(".") == mailName) Assert.fail("""Invalid domain name generated: |inetAddress: %s |hostName: %s - |domainName: %s""".stripMargin.format(inetAddress, hostName, domainName)) + |mailName: %s""".stripMargin.format(inetAddress, hostName, mailName)) } }