CMS 3D CMS Logo

Public Member Functions | Public Attributes

CrabWatch::CrabWatch Class Reference

Inherits threading::Thread.

List of all members.

Public Member Functions

def __init__
def run
def setThreshold

Public Attributes

 action
 finish
 lock
 project
 threshold

Detailed Description

Definition at line 6 of file CrabWatch.py.


Constructor & Destructor Documentation

def CrabWatch::CrabWatch::__init__ (   self,
  project,
  action = getOutput 
)

Definition at line 10 of file CrabWatch.py.

00011                                                    :
00012         Thread.__init__(self)
00013         self.project = project
00014         self.action = action
00015         self.threshold = 100.0
00016 
00017         self.lock = Lock()
00018         self.finish = Event() 
 

Member Function Documentation

def CrabWatch::CrabWatch::run (   self)

Definition at line 22 of file CrabWatch.py.

00023                  :
00024         exit = False
00025         while not exit:
00026             #if checkStatus(self.project,80.0): break
00027             status = crabStatus(self.project)
00028             statusNew = convertStatus(status)
00029             print "Relative percentage finished: %.0f%%" % statusNew['Finished']
00030             print "Relative percentage failed  : %.0f%%" % statusNew['Failed']
00031             print "Relative percentage running : %.0f%%" % statusNew['Running']
00032             if statusNew['Failed'] > 50.0: raise RuntimeError,'Too many jobs have failed (%.0f%%).' % statusNew['Failed']
00033             if statusNew['Finished'] >= self.threshold: break
00034 
00035             self.lock.acquire()
00036             if self.finish.isSet(): exit = True 
00037             self.lock.release()
00038  
00039             if not exit: time.sleep(180)
00040  
00041         print "Finished..."
00042 
00043         if self.action: self.action(self.project)

def CrabWatch::CrabWatch::setThreshold (   self,
  threshold 
)

Definition at line 19 of file CrabWatch.py.

00020                                     :
00021         self.threshold = float(threshold)


Member Data Documentation

Definition at line 10 of file CrabWatch.py.

Definition at line 10 of file CrabWatch.py.

Definition at line 10 of file CrabWatch.py.

Definition at line 10 of file CrabWatch.py.

Definition at line 10 of file CrabWatch.py.