From 0cb1605df0d7e84dda53535484d89e2bac4be614 Mon Sep 17 00:00:00 2001 From: Mark DePristo Date: Fri, 26 Aug 2011 09:22:58 -0400 Subject: [PATCH] Clean documentation for JobRunInfo --- .../sting/queue/engine/JobRunInfo.scala | 48 +++++++------------ 1 file changed, 17 insertions(+), 31 deletions(-) diff --git a/public/scala/src/org/broadinstitute/sting/queue/engine/JobRunInfo.scala b/public/scala/src/org/broadinstitute/sting/queue/engine/JobRunInfo.scala index c99cbb1fc..03124a420 100644 --- a/public/scala/src/org/broadinstitute/sting/queue/engine/JobRunInfo.scala +++ b/public/scala/src/org/broadinstitute/sting/queue/engine/JobRunInfo.scala @@ -27,52 +27,38 @@ package org.broadinstitute.sting.queue.engine import java.util.Date import java.text.SimpleDateFormat -/* - * 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. - */ - /** - * Base class containing all of the information about a job run. + * Class containing tracked information about a job run. */ + // todo -- it might be nice to have the hostname class JobRunInfo { - var startTime: Date = _ - var doneTime: Date = _ - var status: RunnerStatus.Value = RunnerStatus.DONE + /** constant date format */ + val formatter = new SimpleDateFormat("yy-MM-dd H:mm:ss:SSS"); - def getStatus = status + /** The start time with millisecond resolution of this job */ + var startTime: Date = _ + /** The done time with millisecond resolution of this job */ + var doneTime: Date = _ def getStartTime = startTime def getDoneTime = doneTime def getFormattedStartTime = formatTime(getStartTime) def getFormattedDoneTime = formatTime(getDoneTime) - val formatter = new SimpleDateFormat("yy-MM-dd H:mm:ss:SSS"); + /** Helper function that pretty prints the date */ private def formatTime(d: Date) = if ( d != null ) formatter.format(d) else "null" + /** + * Was any information set for this jobInfo? JobInfo can be unset because + * the job never ran or because it already completed. + */ def isFilledIn = startTime != null + /** + * How long did the job run (in wall time)? Returns -1 if this jobInfo isn't filled in + */ def getRuntimeInMs: Long = { - if ( getDoneTime != null && getStartTime != null ) + if ( isFilledIn ) getDoneTime.getTime - getStartTime.getTime else -1