CMS 3D CMS Logo

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

Public Member Functions

def __init__
 
def addOption
 
def run
 
- Public Member Functions inherited from production_tasks.Task
def __init__
 
def addOption
 
def getname
 
def run
 

Additional Inherited Members

- Public Attributes inherited from production_tasks.Task
 dataset
 
 instance
 
 name
 
 options
 
 user
 

Detailed Description

Checks the job STDOUT to catch common problems like exceptions, CPU time exceeded. Sets the job status in the report accordingly.

Definition at line 732 of file production_tasks.py.

Constructor & Destructor Documentation

def production_tasks.CheckJobStatus.__init__ (   self,
  dataset,
  user,
  options 
)

Definition at line 734 of file production_tasks.py.

735  def __init__(self, dataset, user, options):
Task.__init__(self,'CheckJobStatus', dataset, user, options)

Member Function Documentation

def production_tasks.CheckJobStatus.addOption (   self,
  parser 
)

Definition at line 736 of file production_tasks.py.

737  def addOption(self, parser):
parser.add_option("--output_wildcard", dest="output_wildcard", help="The wildcard to use when testing the output of this production (defaults to same as -w)", default=None)
def production_tasks.CheckJobStatus.run (   self,
  input 
)

Definition at line 738 of file production_tasks.py.

References mergeVDriftHistosByStation.file, FileExportPlugin.FileExportPlugin.options, cmsswPreprocessor.CmsswPreprocessor.options, DOTExport.DotProducer.options, confdb.HLTProcess.options, production_tasks.Task.options, and edmIntegrityCheck.IntegrityCheck.options.

739  def run(self, input):
740 
741  job_status = input['MonitorJobs']['LSFJobStatus']
742 
743  result = {}
744  for j, status in job_status.iteritems():
745  valid = True
746  if os.path.exists(status):
747 
748  fileHandle = None
749  if status.endswith('.gz') or status.endswith('.GZ'):
750  fileHandle = gzip.GzipFile(status)
751  else:
752  fileHandle = file(status)
753 
754  open_count = 0
755  close_count = 0
756  for line in fileHandle:
757  #start by counting files opened and closed
758  #suggestion from Enrique
759  if 'pened file' in line:
760  open_count += 1
761  if 'losed file' in line:
762  close_count += 1
763 
764  if 'Exception' in line:
765  result[j] = 'Exception'
766  valid = False
767  break
768  elif 'CPU time limit exceeded' in line:
769  result[j] = 'CPUTimeExceeded'
770  valid = False
771  break
772  elif 'Killed' in line:
773  result[j] = 'JobKilled'
774  valid = False
775  break
776  elif 'A fatal system signal has occurred' in line:
777  result[j] = 'SegFault'
778  valid = False
779  break
780 
781  if valid and open_count != close_count:
782  result[j] = 'FileOpenCloseMismatch'
783  valid = False
784  if valid:
785  result[j] = 'VALID'
786  else:
787  result[j] = status
788 
789  #allows a different wildcard in the final check.
790  options = copy.deepcopy(self.options)
791  if self.options.output_wildcard is not None:
792  options.wildcard = self.options.output_wildcard
793 
794  mask = GenerateMask(input['RunCMSBatch']['SampleDataset'],self.options.batch_user,options)
795  report = mask.run({'CheckForMask':{'MaskPresent':False}})
796  report['LSFJobStatusCheck'] = result
return report