minos::MinosDCMTask::MinosDCMTask Class Reference

List of all members.

Public Member Functions

def __init__
def GetType
def __repr__
def AsString
def AddProtoJob
def GetDCMQuery
def SetDCMQuery
def GetTestOnlyMethods

Private Member Functions

def _DoMemberIO

Private Attributes

 __DCMQuery


Detailed Description

Top level object to manage a single task.

This class inherits from GBSTask and adds the following user callable methods

Getters:-

GetDCMQuery()
  Return the DCM Query used to create ProtoJobs


Setters:-

SetDCMQuery(query)

  Define the DCM query used to create ProtoJobs

  e.g. task.SetDCMQuery("[ file_name like N00008695_002%.cosmic.sntp.R1_18.0.root ]")

AddProtoJob()

  Apply DCM query and for each file returned use the run and
  subrun numbers to form a name.  If a Job of that name does not
  already exist add a ProtJob using the DCM URL as the Script Local
  Arg.

  Warn if there are Jobs that don't correspond to a file returned
  from the query.

Definition at line 6 of file MinosDCMTask.py.


Member Function Documentation

def minos::MinosDCMTask::MinosDCMTask::__init__ (   self,
  name,
  parent,
  model,
  model_args 
)

Definition at line 39 of file MinosDCMTask.py.

00039                                                    :
00040         self.__DCMQuery   = ""
00041 
00042         GBSTask.__init__(self,name,parent,model,model_args)
00043 
    def _DoMemberIO(self,ioh):

def minos::MinosDCMTask::MinosDCMTask::_DoMemberIO (   self,
  ioh 
) [private]

Definition at line 44 of file MinosDCMTask.py.

00044                              :
00045         self.__DCMQuery   = ioh("DCM Query",  "s",self.__DCMQuery)
00046         GBSTask._DoMemberIO(self,ioh)
00047 
    def GetType(self): return "MinosDCMTask"

def minos::MinosDCMTask::MinosDCMTask::GetType (   self  ) 

Definition at line 48 of file MinosDCMTask.py.

00048                      : return "MinosDCMTask"
00049 

def minos::MinosDCMTask::MinosDCMTask::__repr__ (   self  ) 

Definition at line 50 of file MinosDCMTask.py.

00050                        : return self.AsString()
00051     

def minos::MinosDCMTask::MinosDCMTask::AsString (   self,
  level = "Full" 
)

Return string description.

 Return string description at the following levels:-
"Brief"    one line summary suitable for rows in tables
"Heading"  one line summary suitable as heading for "Brief"
"Full"     full desciption including value of every data member

Definition at line 55 of file MinosDCMTask.py.

00055                                      :
00056 
00057         """Return string description.
00058 
00059          Return string description at the following levels:-
00060         "Brief"    one line summary suitable for rows in tables
00061         "Heading"  one line summary suitable as heading for "Brief"
00062         "Full"     full desciption including value of every data member"""
00063 
00064         if (    level == "Heading" \
00065              or level == "Brief" ): return GBSTask.AsString(self,level)
00066 
00067         s  = GBSTask.AsString(self,level)
00068         s += "\nDCM Query: '" + self.__DCMQuery + "'"
00069         return s
00070     
00071 
    def  AddProtoJob(self):

def minos::MinosDCMTask::MinosDCMTask::AddProtoJob (   self  ) 

Apply DCM query and add new ProtJobs as necessary.

Definition at line 72 of file MinosDCMTask.py.

00072                           :
00073 
00074         """Apply DCM query and add new ProtJobs as necessary."""
00075 
00076         file_list_file = self.GetStoreLocation("child_dir") + "/DCM_query_result"
00077         if os.path.isfile(file_list_file): os.remove(file_list_file)
00078         cmd = "$DCM_HOME/dcm.sh get --accept_dcm_url --file_list %s %s >/dev/null" % (file_list_file,self.__DCMQuery)
00079         if os.system(cmd):
00080             print "Failed to run " + cmd
00081             return
00082         f = open(file_list_file)
00083 
00084         #  Get a full list of current job.
00085         unmatched_jobs = GBSTask.GetJobs(self)
00086         
00087         num_pjobs = 0
00088         for line in f:
00089             line = line.rstrip()
00090             mo = re.search(r"(\d{6,}_\d{3,})",line)
00091             if not mo:
00092                 print "Cannot extract run and subrun number from: " + line,
00093             else:
00094                 job_name = mo.group(1)
00095                 # Remove name from current job list
00096                 if unmatched_jobs.has_key(job_name): del unmatched_jobs[job_name]
00097                 if GBSTask.AddProtoJob(self,job_name,line):
00098                     print "Accepting job_%s: %s" % (job_name,line)
00099                     num_pjobs += 1
00100                     
00101         f.close()
00102         os.remove(file_list_file)
00103 
00104         if num_pjobs: print str(num_pjobs) + " Protojobs created"
00105         else:         print "No Protojobs created"
00106 
00107         # Print any jobs that don't match current query.
00108         unmatched_job_names = unmatched_jobs.keys()
00109         if len(unmatched_job_names):
00110             print "\nCaution: The following jobs are not part of the current DCM query:-\n"
00111             unmatched_job_names.sort()
00112             for job_name in unmatched_job_names:
00113                 print job_name + ": " + unmatched_jobs[job_name].GetScriptLocalArgs()
00114                      
    def GetDCMQuery(self):

def minos::MinosDCMTask::MinosDCMTask::GetDCMQuery (   self  ) 

Return the DCM Query used to create ProtoJobs

Definition at line 115 of file MinosDCMTask.py.

00115                          :
00116 
00117         """Return the DCM Query used to create ProtoJobs"""
00118 
00119         return self.__DCMQuery
00120 
    def SetDCMQuery(self,query):

def minos::MinosDCMTask::MinosDCMTask::SetDCMQuery (   self,
  query 
)

Define the DCM query used to create ProtoJobs

Definition at line 121 of file MinosDCMTask.py.

00121                                :
00122 
00123         """Define the DCM query used to create ProtoJobs"""
00124 
00125         if self.IsDisabled("SetDCMQuery"): return
00126         self.__DCMQuery = query
00127         self.Write()
00128         
    def GetTestOnlyMethods(self):

def minos::MinosDCMTask::MinosDCMTask::GetTestOnlyMethods (   self  ) 

Return a list of methods that are only available in 'Test' mode.

Definition at line 129 of file MinosDCMTask.py.

00129                                 :
00130 
00131         """Return a list of methods that are only available in 'Test' mode."""
00132 
00133         l = GBSTask.GetTestOnlyMethods(self)
00134         l.append("SetDCMQuery")
00135         return l
00136 
00137     
00138 
00139 


Member Data Documentation

minos::MinosDCMTask::MinosDCMTask::__DCMQuery [private]

Definition at line 40 of file MinosDCMTask.py.


The documentation for this class was generated from the following file:
Generated on Mon Feb 18 14:42:02 2008 for gbs by  doxygen 1.5.4