MinosRSMTask.py

Go to the documentation of this file.
00001 import re
00002 
00003 from GBSTask import GBSTask
00004 
00005 def IsValidJobName(name):
00006     """Class method to check that job name is of form job_rrrrrrrr_ssss"""
00007 
00008     if re.search(r"job_\d{8}_\d{4}",name): return True
00009     print "Sorry, job name " + name + " is not valid.  It should take the form: job_rrrrrrrr_ssss"
00010     return False
00011 
00012 
00013 class MinosRSMTask(GBSTask) :
00014     """Top level object to manage a single task.
00015 
00016     This class inherits from GBSTask and adds the constraint that Job and ProtoJob names
00017     must be of the form:-
00018 
00019       job_rrrrrrrr_ssss
00020 
00021       where
00022 
00023         rrrrrrrr  is an 8 digit zero padded run number
00024         ssss      is a 4 digit zero padded subrun number
00025 
00026     It manages Monte Carlo jobs in which the run and subrun numbers
00027     determine the Monte Carlo random number seed and introduces the
00028     new method
00029 
00030       RenameJob(old_name, new_name)
00031 
00032     which allows a job to use a seed.
00033     """
00034 
00035     ######  GBSObject inherited responsibilities   ###### 
00036       
00037 
00038     def __init__(self,name,parent,model,model_args):
00039         GBSTask.__init__(self,name,parent,model,model_args)
00040 
00041     def _DoMemberIO(self,ioh):
00042         GBSTask._DoMemberIO(self,ioh)
00043 
00044     def GetType(self): return "MinosRSMTask"
00045 
00046     def __repr__(self) : return self.AsString()
00047     
00048     ######  User Callable Methods (Getters then Setters)  ###### 
00049     
00050 
00051 
00052     ######  Private Methods (not user callable)  ######
00053 
00054     def _AddJobOrProtoJob(self,job_name,args_str,env_str,type):
00055 
00056        """Create a new named Job or ProtoJob and optionally assign its application script local args."""
00057        if not IsValidJobName(job_name): return None
00058        return GBSTask._AddJobOrProtoJob(self,job_name,args_str,env_str,type)
00059 
00060     def RenameJob(self,old_name,new_name):
00061        """Rename job from old_name to new_name."""
00062        if not IsValidJobName(new_name): return
00063        job = self.GetJob(old_name)
00064        if not job: return
00065        if self.GetJob(new_name,False):
00066            print "Sorry, there already is a job named " + new_name
00067            return
00068        job._Rename(new_name)
00069        del self._jobManagers[old_name]
00070        self._jobManagers[new_name] = job
00071 

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