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 12 of file MinosDCMTask.py.

00017            :-

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

Definition at line 23 of file MinosDCMTask.py.

00039                                                    :
        self.__DCMQuery   = ""

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

Definition at line 17 of file MinosDCMTask.py.

00017            :-
00018 
00019     SetDCMQuery(query)
00020 

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

Apply DCM query and add new ProtJobs as necessary.

Definition at line 45 of file MinosDCMTask.py.

00048                      : return "MinosDCMTask"
00049 
00050     def __repr__(self) : return self.AsString()
00051     
00052     ######  User Callable Methods (Getters then Setters)  ###### 
00053 
00054 
00055     def AsString(self,level = "Full"):
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 
00072     def  AddProtoJob(self):
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

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 28 of file MinosDCMTask.py.

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

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

Return the DCM Query used to create ProtoJobs

Definition at line 88 of file MinosDCMTask.py.

00088                      :
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:
                job_name = mo.group(1)

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

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

Definition at line 102 of file MinosDCMTask.py.

00104                     : 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 minos::MinosDCMTask::MinosDCMTask::GetType (   self  ) 

Definition at line 21 of file MinosDCMTask.py.

00039                                                    :
        self.__DCMQuery   = ""

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

Define the DCM query used to create ProtoJobs

Definition at line 94 of file MinosDCMTask.py.

00096                                                    : 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()


Member Data Documentation

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

Definition at line 13 of file MinosDCMTask.py.


The documentation for this class was generated from the following file:
Generated on Fri Mar 5 09:25:41 2010 for gbs by  doxygen 1.4.7