test
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.EventID.cppID(), and Types.LuminosityBlockID.cppID().

22 
23  def run(self):
24  exit = False
25  failed=0
26  while not exit:
27  #if checkStatus(self.project,80.0): break
28  try:
29  status = crabStatus(self.project)
30  except CrabException:
31  failed+=1
32  print "Crab retrieve status failed (",failed,")"
33  if failed>10:
34  raise
35  else:
36  statusNew = convertStatus(status)
37  print "Relative percentage finished: %.0f%%" % statusNew['Finished']
38  print "Relative percentage failed : %.0f%%" % statusNew['Failed']
39  print "Relative percentage running : %.0f%%" % statusNew['Running']
40  if statusNew['Failed'] > 50.0: raise RuntimeError,'Too many jobs have failed (%.0f%%).' % statusNew['Failed']
41  if statusNew['Finished'] >= self.threshold: break
42 
43  self.lock.acquire()
44  if self.finish.isSet(): exit = True
45  self.lock.release()
46 
47  if not exit: time.sleep(180)
48 
49  print "Finished..."
50 
51  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().