CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
CrabWatch.CrabWatch Class Reference
Inheritance diagram for CrabWatch.CrabWatch:

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.

10 
11  def __init__(self, project, action = getOutput):
12  Thread.__init__(self)
13  self.project = project
14  self.action = action
15  self.threshold = 100.0
16 
17  self.lock = Lock()
18  self.finish = Event()

Member Function Documentation

def CrabWatch.CrabWatch.run (   self)

Definition at line 22 of file CrabWatch.py.

References CrabWatch.CrabWatch.action, crabWrap.convertStatus(), crabWrap.crabStatus(), CrabWatch.CrabWatch.project, CrabTask.CrabTask.project, and CrabWatch.CrabWatch.threshold.

Referenced by Types.LuminosityBlockID.cppID().

22 
23  def run(self):
24  exit = False
25  while not exit:
26  #if checkStatus(self.project,80.0): break
27  status = crabStatus(self.project)
28  statusNew = convertStatus(status)
29  print "Relative percentage finished: %.0f%%" % statusNew['Finished']
30  print "Relative percentage failed : %.0f%%" % statusNew['Failed']
31  print "Relative percentage running : %.0f%%" % statusNew['Running']
32  if statusNew['Failed'] > 50.0: raise RuntimeError,'Too many jobs have failed (%.0f%%).' % statusNew['Failed']
33  if statusNew['Finished'] >= self.threshold: break
34 
35  self.lock.acquire()
36  if self.finish.isSet(): exit = True
37  self.lock.release()
38 
39  if not exit: time.sleep(180)
40 
41  print "Finished..."
42 
43  if self.action: self.action(self.project)
def convertStatus
Definition: crabWrap.py:174
def crabStatus
Definition: crabWrap.py:157
def CrabWatch.CrabWatch.setThreshold (   self,
  threshold 
)

Definition at line 19 of file CrabWatch.py.

References CrabWatch.CrabWatch.threshold.

19 
20  def setThreshold(self,threshold):
21  self.threshold = float(threshold)

Member Data Documentation

CrabWatch.CrabWatch.action

Definition at line 13 of file CrabWatch.py.

Referenced by CrabWatch.CrabWatch.run().

CrabWatch.CrabWatch.finish

Definition at line 17 of file CrabWatch.py.

Referenced by progressbar.ProgressBar.__next__().

CrabWatch.CrabWatch.lock

Definition at line 16 of file CrabWatch.py.

CrabWatch.CrabWatch.project

Definition at line 12 of file CrabWatch.py.

Referenced by CrabWatch.CrabWatch.run().

CrabWatch.CrabWatch.threshold

Definition at line 14 of file CrabWatch.py.

Referenced by utils.StatisticalTest.get_status(), CrabWatch.CrabWatch.run(), and CrabWatch.CrabWatch.setThreshold().