MinosRSMJobAnalyser.py

Go to the documentation of this file.
00001 import re
00002 from GBSJobAnalyser import GBSJobAnalyser
00003 
00004 class MinosRSMJobAnalyser(GBSJobAnalyser) :
00005     """Job termination analysis object. Based on output returned and
00006     past history decides what to do next.
00007 
00008     This class inherits from GBSJobAnalyser and adds support for the
00009     retry request NEW_SEED by renaming the job to the next free subrun
00010     number for the job's run number.
00011     """
00012 
00013     def __init__(self,name,parent,model,model_args):
00014         GBSJobAnalyser.__init__(self,name,parent,model,model_args)
00015 
00016     def  Apply(self):
00017 
00018         """Apply results of analysis to client job dealing with NEW_SEED request."""
00019 
00020         job = self.GetJob()
00021 
00022         if not job or not re.search("NEW_SEED",self.GetRetryArgs()):
00023             GBSJobAnalyser.Apply(self)
00024             return
00025         run        = job.GetRun()
00026         subrun     = job.GetSubrun()
00027         task       = job.GetParent()
00028         job_list   = task.GetJobs("job_%8.8d_.*" % run)
00029         max_subrun = 0
00030         for j_name,j in job_list.iteritems(): max_subrun = max(max_subrun,j.GetSubrun())
00031         max_subrun += 1
00032         task.RenameJob(job.GetName(),"job_%8.8d_%4.4d" % (run,max_subrun))
00033         GBSJobAnalyser.Apply(self)
00034         jobTryDir = job._GetTryOutputDir()
00035         gbs_log_file_spec = jobTryDir + "/" + job._GetGbsLogFileName()
00036         f = open(gbs_log_file_spec,'a')
00037         f.write("    Rename subrun %d - > %d" % (subrun,max_subrun))
00038         f.write("    - This explains the 'GBS_JOB_ANALYSIS Unable to find file, recreating it'")
00039         f.write("    - Look at the GBS log file for the old subrun for the remainder of the log.")
00040         f.close()
00041 

Generated on Fri Mar 5 09:25:41 2010 for gbs by  doxygen 1.4.7