Public Member Functions | |
| def | __init__ |
| def | GetType |
| def | __repr__ |
| def | GetRun |
| def | GetSubrun |
| def | SetLocalEnvironment |
Private Member Functions | |
| def | _DoMemberIO |
| def | _Rename |
Object to submit, and if necessary resubmit a job until it
succeeds or needs user intervention.
This class inherits from GBSJob and exploits the constraint,
imposed by MinosRSMTask, that its name must be of the form:-
job_rrrrrrrr_ssss
where
rrrrrrrr is an 8 digit zero padded run number
ssss is a 4 digit zero padded subrun number
to add to its local environment:-
run=<run-number>
subrun=<subrun-number>
It introduces the new methods:-
GetRun()
GetSubrun()
Rename(new_name)
Definition at line 7 of file MinosRSMJob.py.
| def minos::MinosRSMJob::MinosRSMJob::__init__ | ( | self, | ||
| name, | ||||
| parent, | ||||
| model, | ||||
| model_args | ||||
| ) |
Definition at line 37 of file MinosRSMJob.py.
00037 : 00038 GBSJob.__init__(self,name,parent,model,model_args) 00039 self.SetLocalEnvironment(self.GetLocalEnvironment()) 00040 def _DoMemberIO(self,ioh):
| def minos::MinosRSMJob::MinosRSMJob::_DoMemberIO | ( | self, | ||
| ioh | ||||
| ) | [private] |
| def minos::MinosRSMJob::MinosRSMJob::GetType | ( | self | ) |
| def minos::MinosRSMJob::MinosRSMJob::__repr__ | ( | self | ) |
| def minos::MinosRSMJob::MinosRSMJob::GetRun | ( | self | ) |
Return run number
Definition at line 50 of file MinosRSMJob.py.
00050 : 00051 """Return run number""" 00052 return int(re.search(r"job_(\d+)",self.GetName()).group(1)) 00053 def GetSubrun(self):
| def minos::MinosRSMJob::MinosRSMJob::GetSubrun | ( | self | ) |
Return subrun number
Definition at line 54 of file MinosRSMJob.py.
00054 : 00055 """Return subrun number""" 00056 return int(re.search(r"job_\d+_(\d+)",self.GetName()).group(1)) 00057 def SetLocalEnvironment(self,env_str):
| def minos::MinosRSMJob::MinosRSMJob::SetLocalEnvironment | ( | self, | ||
| env_str | ||||
| ) |
Set, as a comma separated list string, the environment that local to this job. Extends the GBSJob method by adding run=<run-number>,subrun=<subrun-number>.
Definition at line 58 of file MinosRSMJob.py.
00058 : 00059 00060 """Set, as a comma separated list string, the environment that local to this job. 00061 00062 Extends the GBSJob method by adding run=<run-number>,subrun=<subrun-number>.""" 00063 00064 # Remove any pre-existing run and subrun variables. 00065 p = re.compile(r",?subrun=\d+") 00066 env_str = p.sub("",env_str) 00067 p = re.compile(r",?run=\d+") 00068 env_str = p.sub("",env_str) 00069 # Add separating comma if required 00070 if env_str: env_str += "," 00071 env_str += "run=" + str(self.GetRun()) + ",subrun=" + str(self.GetSubrun()) 00072 GBSJob.SetLocalEnvironment(self,env_str) 00073 00074 ###### Private Methods (not user callable) ######
| def minos::MinosRSMJob::MinosRSMJob::_Rename | ( | self, | ||
| new_name | ||||
| ) | [private] |
Rename job to new_name. Should only be called by parent Task.
Definition at line 77 of file MinosRSMJob.py.
00077 : 00078 """Rename job to new_name. Should only be called by parent Task.""" 00079 00080 # Check that rename is legal. 00081 if not IsValidJobName(new_name): return 00082 if self.GetParent().GetJob(new_name,False): 00083 print "Sorry, there already is a job named " + new_name 00084 return 00085 00086 # Perform rename including environmental variables, state file and child directory (if present). 00087 old_state_file = self.GetStoreLocation("self") 00088 old_child_dir = self.GetStoreLocation("child_dir") 00089 GBSJob.Rename(self,new_name) 00090 new_state_file = self.GetStoreLocation("self") 00091 new_child_dir = self.GetStoreLocation("child_dir") 00092 os.rename(old_state_file,new_state_file) 00093 if os.path.isdir(old_child_dir): os.rename(old_child_dir,new_child_dir) 00094 self.SetLocalEnvironment(self.GetLocalEnvironment()) 00095 self.Write() self.Write()
1.5.4