CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
CrabWatch.CrabWatch Class Reference
Inheritance diagram for CrabWatch.CrabWatch:

Public Member Functions

def __init__ (self, project, action=getOutput)
 
def run (self)
 
def setThreshold (self, threshold)
 

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  def __init__(self, project, action = getOutput):
11  Thread.__init__(self)
12  self.project = project
13  self.action = action
14  self.threshold = 100.0
15 
16  self.lock = Lock()
17  self.finish = Event()
18 
def __init__(self, project, action=getOutput)
Definition: CrabWatch.py:10

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(), Types.LuminosityBlockID.cppID(), and o2olib.O2OTool.execute().

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

Definition at line 19 of file CrabWatch.py.

References objects.autophobj.float, and CrabWatch.CrabWatch.threshold.

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

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