00001 """
00002 record jobs done
00003 """
00004
00005
00006 __copyright__ = """
00007 Copyright 2008 Sean Ross-Ross
00008 """
00009 __license__ = """
00010 This file is part of SLIMpy .
00011
00012 SLIMpy is free software: you can redistribute it and/or modify
00013 it under the terms of the GNU Lesser General Public License as published by
00014 the Free Software Foundation, either version 3 of the License, or
00015 (at your option) any later version.
00016
00017 SLIMpy is distributed in the hope that it will be useful,
00018 but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00020 GNU Lesser General Public License for more details.
00021
00022 You should have received a copy of the GNU Lesser General Public License
00023 along with SLIMpy . If not, see <http://www.gnu.org/licenses/>.
00024 """
00025
00026 import time
00027
00028 class JobRecord( object ):
00029 """
00030 tracks time spent working on a job which node
00031 etc.
00032 """
00033
00034 def __init__( self, job_id, node_name, node_num ):
00035
00036 self.node_info = ( node_name, node_num )
00037
00038 self.name = job_id
00039
00040 self.created = 0
00041 self.finished = 0
00042 self._crashed = False
00043
00044 def start( self ):
00045 self.created = time.time()
00046
00047 def stop_crash( self ):
00048 self._crashed = True
00049 self.stop()
00050
00051 def stop( self ):
00052 self.finished = time.time()
00053
00054 def total_time( self ):
00055 return self.finished - self.created
00056
00057