ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/SchedulerGlite.py
(Generate patch)

Comparing COMP/CRAB/python/SchedulerGlite.py (file contents):
Revision 1.49 by ewv, Thu Apr 24 15:10:42 2008 UTC vs.
Revision 1.56 by spiga, Mon May 26 16:57:35 2008 UTC

# Line 12 | Line 12 | class SchedulerGlite(SchedulerGrid):
12      def __init__(self, name="GLITE"):
13          SchedulerGrid.__init__(self,name)
14  
15 +        self.OSBsize = 55000000
16 +
17      def configure(self,cfg_params):
18          SchedulerGrid.configure(self, cfg_params)
19          self.checkProxy()
20          self.environment_unique_identifier = 'GLITE_WMS_JOBID'
21  
22 +    def realSchedParams(self,cfg_params):
23 +        """
24 +        Return dictionary with specific parameters, to use
25 +        with real scheduler  
26 +        """
27 +        self.rb_param_file=''
28 +        if (cfg_params.has_key('EDG.rb')):
29 +            self.rb_param_file=common.scheduler.rb_configure(cfg_params.get("EDG.rb"))
30 +        self.wms_service=cfg_params.get("EDG.wms_service",'')
31 +        self.skipWMSAuth=cfg_params.get("EDG.skipwmsauth",0)
32 +        params = { 'service' : self.wms_service, \
33 +                   'config' : self.rb_param_file, \
34 +                   'skipWMSAuth' : self.skipWMSAuth
35 +                 }
36 +        return  params
37 +      
38 +
39      def rb_configure(self, RB):
40          if not RB: return None
41          glite_config = None
# Line 90 | Line 109 | class SchedulerGlite(SchedulerGrid):
109          if self.EDG_addJdlParam:
110              if self.EDG_addJdlParam[-1] == '': self.EDG_addJdlParam= self.EDG_addJdlParam[:-1]
111              for p in self.EDG_addJdlParam:
112 <             #   param_file.write(string.strip(p)+';\n')
94 <                req+=string.strip(p)+';\n' ## BL--DS
112 >                req+=string.strip(p)+';\n'
113          return req
114  
115      def specific_req(self):
# Line 123 | Line 141 | class SchedulerGlite(SchedulerGrid):
141              if (not req == ' '): req = req +  ' && '
142              req = req + self.EDG_requirements
143  
144 <        Task_Req={'jobType':req}## DS--BL
144 >        Task_Req={'jobType':req}
145          common._db.updateTask_(Task_Req)
146  
147      def sched_parameter(self,i,task):
148          """
149          Returns string with requirements and scheduler-specific parameters
150          """
151 <        dest=  task.jobs[i-1]['dlsDestination'] ## DS--BL
151 >        dest=  task.jobs[i-1]['dlsDestination']
152  
153          req=''
154          req +=task['jobType']
155  
156          sched_param=''
157          sched_param+='Requirements = ' + req +self.specific_req() + self.se_list(i,dest) +\
158 <                                        self.ce_list()[0] +';\n' ## BL--DS
159 <        if self.EDG_addJdlParam: sched_param+=self.jdlParam() ## BL--DS
158 >                                        self.ce_list()[0] +';\n'
159 >        if self.EDG_addJdlParam: sched_param+=self.jdlParam()
160          sched_param+='MyProxyServer = "' + self.proxyServer + '";\n'
161          sched_param+='VirtualOrganisation = "' + self.VO + '";\n'
162          sched_param+='RetryCount = '+str(self.EDG_retry_count)+';\n'
# Line 159 | Line 177 | class SchedulerGlite(SchedulerGrid):
177          if len(sites)>0 and sites[0]=="":
178              return itr4
179          if sites != [""]:
162            ##Addedd Daniele
180              replicas = self.blackWhiteListParser.checkBlackList(sites,n)
181              if len(replicas)!=0:
182                  replicas = self.blackWhiteListParser.checkWhiteList(replicas,n)
183  
184              itr4 = replicas
168            #####
185          return itr4
186  
187 +    
188 +    def wsExitFunc(self):
189 +        """
190 +        """
191 +        txt = '\n'
192  
193 <
194 <
195 <    def tOut(self, list):
196 <        return 180
193 >        txt += '#\n'
194 >        txt += '# EXECUTE THIS FUNCTION BEFORE EXIT \n'
195 >        txt += '#\n\n'
196 >
197 >        txt += 'func_exit() { \n'
198 >        txt += self.wsExitFunc_common()
199 >        ### specific Glite check for OSB
200 >        txt += '    tar zcvf ${out_files}.tgz  ${final_list}\n'
201 >        txt += '    tmp_size=`ls -gGrta ${out_files}.tgz | awk \'{ print $3 }\'`\n'
202 >        txt += '    rm ${out_files}.tgz\n'  
203 >        txt += '    size=`expr $tmp_size`\n'
204 >        txt += '    echo "Total Output dimension: $size"\n'
205 >        txt += '    limit='+str(self.OSBsize) +' \n'  
206 >        txt += '    echo "WARNING: output files size limit is set to: $limit"\n'
207 >        txt += '    if [ "$limit" -lt "$size" ]; then\n'
208 >        txt += '        exceed=1\n'
209 >        txt += '        job_exit_code=70000\n'
210 >        txt += '        echo "Output Sanbox too big. Produced output is lost "\n'
211 >        txt += '    else\n'
212 >        txt += '        exceed=0\n'
213 >        txt += '        echo "Total Output dimension $size is fine."\n'
214 >        txt += '    fi\n'
215 >
216 >        txt += '    echo "JOB_EXIT_STATUS = $job_exit_code"\n'
217 >        txt += '    echo "JobExitCode=$job_exit_code" >> $RUNTIME_AREA/$repo\n'
218 >        txt += '    dumpStatus $RUNTIME_AREA/$repo\n'
219 >        txt += '    if [ $exceed -ne 1 ]; then\n'
220 >        txt += '        tar zcvf ${out_files}.tgz  ${final_list}\n'
221 >        txt += '    else\n'
222 >        txt += '        tar zcvf ${out_files}.tgz CMSSW_${NJob}.stdout CMSSW_${NJob}.stderr\n'
223 >        txt += '    fi\n'
224 >        txt += '    exit $job_exit_code\n'
225 >
226 >        txt += '}\n'
227 >        return txt
228 >
229 >    def userName(self):
230 >        """ return the user name """
231 >        tmp=runCommand("voms-proxy-info -identity")
232 >        return tmp.strip()

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines