From 9e08a699c62ac738feee3200b94a5a16c4841e28 Mon Sep 17 00:00:00 2001 From: dheiman Date: Thu, 12 May 2011 17:47:56 +0000 Subject: [PATCH] Corrected memory handling and jobName formatting issues git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5797 348d0f76-0448-11de-a6fe-93d51630548a --- .../gridengine/GridEngineJobRunner.scala | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/scala/src/org/broadinstitute/sting/queue/engine/gridengine/GridEngineJobRunner.scala b/scala/src/org/broadinstitute/sting/queue/engine/gridengine/GridEngineJobRunner.scala index 9918669fa..d0ac2c760 100644 --- a/scala/src/org/broadinstitute/sting/queue/engine/gridengine/GridEngineJobRunner.scala +++ b/scala/src/org/broadinstitute/sting/queue/engine/gridengine/GridEngineJobRunner.scala @@ -54,8 +54,9 @@ class GridEngineJobRunner(val function: CommandLineFunction) extends CommandLine // Force the remote environment to inherit local environment settings var nativeSpecString: String = "-V" - // Set the display name to 1024 characters of the description - gridEngineJob.setJobName(function.description.take(1024)) + // Set the display name to < 512 characters of the description + // NOTE: Not sure if this is configuration specific? + gridEngineJob.setJobName(GridEngineJobRunner.toJobName(function.description.take(500))) // Set the output file for stdout gridEngineJob.setOutputPath(":" + function.jobOutputFile.getPath) @@ -83,8 +84,9 @@ class GridEngineJobRunner(val function: CommandLineFunction) extends CommandLine // If the memory limit is set (GB) specify the memory limit if (function.memoryLimit.isDefined) { - val memLim: String = function.memoryLimit.get + "G" - nativeSpecString += " -l mem_free=" + memLim + ",h_vmem=" + memLim + val memAvl: String = function.memoryLimit.get + "G" + val memMax: String = (function.memoryLimit.get * 1.2 * 1024).ceil.toInt + "M" + nativeSpecString += " -l mem_free=" + memAvl + ",h_rss=" + memMax } // If the priority is set (user specified Int) specify the priority @@ -144,7 +146,9 @@ object GridEngineJobRunner extends Logging { try { gridEngineSession.init("") } catch { - case de: DrmaaException => throw new QException("init() failed", de) + case de: DrmaaException => + logger.error("Issue initializing Grid Engine", de) + throw new QException("init() failed", de) } } } @@ -232,7 +236,14 @@ object GridEngineJobRunner extends Logging { } } + // Reap what we've sown override def finalize() { gridEngineSession.exit() } + + // Grid Engine disallows certain characters from being in job names. + // This replaces all illegal characters with underscores + private def toJobName(name: String): String = { + name.replaceAll("""[\n\t\r/:@\\*?]""", "_") + } }