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.20 by mcinquil, Fri Oct 5 12:09:51 2007 UTC vs.
Revision 1.29 by spiga, Fri Dec 7 16:50:13 2007 UTC

# Line 30 | Line 30 | class SchedulerGlite(SchedulerEdg):
30          index = int(common.jobDB.nJobs()) - 1
31          job = common.job_list[index]
32          jbt = job.type()
33 <        
33 >
34          lastDest=''
35          first = []
36          last  = []
# Line 39 | Line 39 | class SchedulerGlite(SchedulerEdg):
39              if (currDest!=lastDest):
40                  lastDest = currDest
41                  first.append(n)
42 <                if n != 0:last.append(n-1)
42 >                if n != 0:last.append(n-1)
43          if len(first)>len(last) :last.append(common.jobDB.nJobs())
44 <  
44 >
45          req = ''
46          req = req + jbt.getRequirements()
47 <  
48 <  
47 >
48 >
49          if self.EDG_requirements:
50              if (not req == ' '): req = req +  ' && '
51              req = req + self.EDG_requirements
# Line 75 | Line 75 | class SchedulerGlite(SchedulerEdg):
75                      req += ") "
76              ## old code
77   #            if len(tmpCe): req = req + " && (" + concString.join(tmpCe) + ") "
78 <        
78 >
79          if self.EDG_ce_black_list:
80              ce_black_list = string.split(self.EDG_ce_black_list,',')
81              tmpCe=[]
# Line 91 | Line 91 | class SchedulerGlite(SchedulerEdg):
91          if self.EDG_cpu_time:
92              if (not req == ' '): req = req + ' && '
93              req = req + ' other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time
94 <                
94 >
95          for i in range(len(first)): # Add loop DS
96              self.param='sched_param_'+str(i)+'.clad'
97              param_file = open(common.work_space.shareDir()+'/'+self.param, 'w')
98  
99              itr4=self.findSites_(first[i])
100              reqSites=''
101 <            reqtmp=[]  
101 >            reqtmp=[]
102              concString = '||'
103  
104              #############
# Line 113 | Line 113 | class SchedulerGlite(SchedulerEdg):
113              reqSites = reqSites + '&& (!RegExp("blah", other.GlueCEUniqueId));\n'
114  
115              param_file.write('Requirements = ' + req + reqSites )
116 <  
116 >
117              if (self.rb_param_file != ''):
118 <                param_file.write(self.rb_param_file)  
118 >                param_file.write(self.rb_param_file)
119  
120              if len(self.EDG_addJdlParam):
121 +                if self.EDG_addJdlParam[-1] == '': self.EDG_addJdlParam= self.EDG_addJdlParam[:-1]
122                  for p in self.EDG_addJdlParam:
123 <                    param_file.write(p)
123 >                    param_file.write(string.strip(p)+';\n')
124  
125 <            param_file.close()  
125 >            param_file.close()
126  
127      def wsSetupEnvironment(self):
128          """
# Line 144 | Line 145 | class SchedulerGlite(SchedulerEdg):
145          txt += 'echo "SyncGridJobId=`echo $SyncGridJobId`" | tee -a $RUNTIME_AREA/$repo \n'
146          txt += 'echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
147  
148 <        txt += 'echo "middleware discovery " \n'
148 >        txt += 'echo "middleware discovery: " \n'
149          txt += 'if [ $VO_CMS_SW_DIR ]; then \n'
150          txt += '    middleware=LCG \n'
151          txt += '    echo "SyncCE=`glite-brokerinfo getCE`" | tee -a $RUNTIME_AREA/$repo \n'
152          txt += '    echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n'
153 <        txt += '    echo "middleware =$middleware" \n'
153 <        txt += 'elif [ $GRID3_APP_DIR ]; then\n'
154 <        txt += '    middleware=OSG \n'
155 <        txt += '    echo "SyncCE=`echo $GLITE_WL_LOG_DESTINATION`" | tee -a $RUNTIME_AREA/$repo \n'
156 <        txt += '    echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n'
157 <        txt += '    echo "middleware =$middleware" \n'
153 >        txt += '    echo ">>> middleware =$middleware" \n'
154          txt += 'elif [ $OSG_APP ]; then \n'
155          txt += '    middleware=OSG \n'
156 <        txt += '    echo "SyncCE=`echo $GLITE_WL_LOG_DESTINATION`" | tee -a $RUNTIME_AREA/$repo \n'
156 >        txt += '    if [ $OSG_JOB_CONTACT ]; then \n'
157 >        txt += '        SyncCE="$OSG_JOB_CONTACT"; \n'
158 >        txt += '        echo "SyncCE=$SyncCE" | tee -a $RUNTIME_AREA/$repo ;\n'
159 >        txt += '    else\n'
160 >        txt += '        echo "not reporting SyncCE";\n'
161 >        txt += '    fi\n';
162          txt += '    echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n'
163 <        txt += '    echo "middleware =$middleware" \n'
163 >        txt += '    echo ">>> middleware =$middleware" \n'
164          txt += 'else \n'
165          txt += '    echo "SET_CMS_ENV 10030 ==> middleware not identified" \n'
166          txt += '    echo "JOB_EXIT_STATUS = 10030" \n'
167          txt += '    echo "JobExitCode=10030" | tee -a $RUNTIME_AREA/$repo \n'
168          txt += '    dumpStatus $RUNTIME_AREA/$repo \n'
168        txt += '    rm -f $RUNTIME_AREA/$repo \n'
169        txt += '    echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
170        txt += '    echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
169          txt += '    exit 1 \n'
170          txt += 'fi \n'
171  
174        txt += '# report first time to DashBoard \n'
172          txt += 'dumpStatus $RUNTIME_AREA/$repo \n'
173 <        txt += 'rm -f $RUNTIME_AREA/$repo \n'
174 <        txt += 'echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
175 <        txt += 'echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
176 <        
173 >        #txt += 'rm -f $RUNTIME_AREA/$repo \n'
174 >        #txt += 'echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
175 >        #txt += 'echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
176 >
177          txt += '\n\n'
178  
179          #if int(self.copy_data) == 1:
# Line 189 | Line 186 | class SchedulerGlite(SchedulerEdg):
186          #      txt += 'echo "SE_PATH = $SE_PATH"\n'
187  
188          txt += 'export VO='+self.VO+'\n'
189 <        ### some line for LFC catalog setting
190 <        txt += 'if [ $middleware == LCG ]; then \n'
191 <        txt += '    if [[ $LCG_CATALOG_TYPE != \''+self.lcg_catalog_type+'\' ]]; then\n'
192 <        txt += '        export LCG_CATALOG_TYPE='+self.lcg_catalog_type+'\n'
193 <        txt += '    fi\n'
194 <        txt += '    if [[ $LFC_HOST != \''+self.lfc_host+'\' ]]; then\n'
195 <        txt += '        export LFC_HOST='+self.lfc_host+'\n'
196 <        txt += '    fi\n'
197 <        txt += '    if [[ $LFC_HOME != \''+self.lfc_home+'\' ]]; then\n'
198 <        txt += '        export LFC_HOME='+self.lfc_home+'\n'
199 <        txt += '    fi\n'
200 <        txt += 'elif [ $middleware == OSG ]; then\n'
201 <        txt += '    echo "LFC catalog setting to be implemented for OSG"\n'
202 <        txt += 'fi\n'
189 >        ### some line for LFC catalog setting
190 >        #txt += 'if [ $middleware == LCG ]; then \n'
191 >        #txt += '    if [[ $LCG_CATALOG_TYPE != \''+self.lcg_catalog_type+'\' ]]; then\n'
192 >        #txt += '        export LCG_CATALOG_TYPE='+self.lcg_catalog_type+'\n'
193 >        #txt += '    fi\n'
194 >        #txt += '    if [[ $LFC_HOST != \''+self.lfc_host+'\' ]]; then\n'
195 >        #txt += '        export LFC_HOST='+self.lfc_host+'\n'
196 >        #txt += '    fi\n'
197 >        #txt += '    if [[ $LFC_HOME != \''+self.lfc_home+'\' ]]; then\n'
198 >        #txt += '        export LFC_HOME='+self.lfc_home+'\n'
199 >        #txt += '    fi\n'
200 >        #txt += 'elif [ $middleware == OSG ]; then\n'
201 >        #txt += '    echo "LFC catalog setting to be implemented for OSG"\n'
202 >        #txt += 'fi\n'
203          #####
204 <        if int(self.register_data) == 1:
205 <           txt += 'if [ $middleware == LCG ]; then \n'
206 <           txt += '    export LFN='+self.LFN+'\n'
207 <           txt += '    lfc-ls $LFN\n'
208 <           txt += '    result=$?\n'
209 <           txt += '    echo $result\n'
210 <           ### creation of LFN dir in LFC catalog, under /grid/cms dir  
211 <           txt += '    if [ $result != 0 ]; then\n'
212 <           txt += '       lfc-mkdir $LFN\n'
213 <           txt += '       result=$?\n'
214 <           txt += '       echo $result\n'
215 <           txt += '    fi\n'
216 <           txt += 'elif [ $middleware == OSG ]; then\n'
217 <           txt += '    echo " Files registration to be implemented for OSG"\n'
218 <           txt += 'fi\n'
219 <           txt += '\n'
220 <
221 <           if self.VO:
222 <              txt += 'export VO='+self.VO+'\n'
223 <           if self.LFN:
224 <              txt += 'if [ $middleware == LCG ]; then \n'
225 <              txt += '    export LFN='+self.LFN+'\n'
226 <              txt += 'fi\n'
230 <              txt += '\n'
204 >        #if int(self.register_data) == 1:
205 >        #   txt += 'if [ $middleware == LCG ]; then \n'
206 >        #   txt += '    export LFN='+self.LFN+'\n'
207 >        #   txt += '    lfc-ls $LFN\n'
208 >        #   txt += '    result=$?\n'
209 >        #   txt += '    echo $result\n'
210 >        #   ### creation of LFN dir in LFC catalog, under /grid/cms dir
211 >        #   txt += '    if [ $result != 0 ]; then\n'
212 >        #   txt += '       lfc-mkdir $LFN\n'
213 >        #   txt += '       result=$?\n'
214 >        #   txt += '       echo $result\n'
215 >        #   txt += '    fi\n'
216 >        #   txt += 'elif [ $middleware == OSG ]; then\n'
217 >        #   txt += '    echo " Files registration to be implemented for OSG"\n'
218 >        #   txt += 'fi\n'
219 >        #   txt += '\n'
220 >        #   if self.VO:
221 >        #      txt += 'export VO='+self.VO+'\n'
222 >        #   if self.LFN:
223 >        #      txt += 'if [ $middleware == LCG ]; then \n'
224 >        #      txt += '    export LFN='+self.LFN+'\n'
225 >        #      txt += 'fi\n'
226 >        #      txt += '\n'
227  
228 <        txt += 'if [ $middleware == LCG ]; then\n'
228 >        txt += 'if [ $middleware == LCG ]; then\n'
229          txt += '    CloseCEs=`glite-brokerinfo getCE`\n'
230          txt += '    echo "CloseCEs = $CloseCEs"\n'
231          txt += '    CE=`echo $CloseCEs | sed -e "s/:.*//"`\n'
# Line 242 | Line 238 | class SchedulerGlite(SchedulerEdg):
238          txt += '        echo "JOB_EXIT_STATUS = 10099" \n'
239          txt += '        echo "JobExitCode=10099" | tee -a $RUNTIME_AREA/$repo \n'
240          txt += '        dumpStatus $RUNTIME_AREA/$repo \n'
241 <        txt += '        rm -f $RUNTIME_AREA/$repo \n'
242 <        txt += '        echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
243 <        txt += '        echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
241 >        #txt += '        rm -f $RUNTIME_AREA/$repo \n'
242 >        #txt += '        echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
243 >        #txt += '        echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
244          txt += '        exit 1 \n'
245          txt += '    fi \n'
246 <        txt += 'fi \n'
246 >        txt += 'fi \n'
247  
248          return txt
249 <        
249 >
250      def loggingInfo(self, id):
251          """
252          retrieve the logging info from logging and bookkeeping and return it
# Line 271 | Line 267 | class SchedulerGlite(SchedulerEdg):
267          sites = common.jobDB.destination(n)
268          if len(sites)>0 and sites[0]=="":
269              return itr4
270 <        if sites != [""]:
270 >        if sites != [""]:
271              ##Addedd Daniele
272              replicas = self.blackWhiteListParser.checkBlackList(sites,n)
273              if len(replicas)!=0:
274                  replicas = self.blackWhiteListParser.checkWhiteList(replicas,n)
275 <              
276 <            if len(replicas)==0:
277 <                msg = 'No sites remaining that host any part of the requested data! Exiting... '
278 <                raise CrabException(msg)
279 <            itr4 = replicas
280 <            #####        
275 >
276 >            #if len(replicas)==0:
277 >                #msg = 'No sites remaining that host any part of the requested data! Exiting... '
278 >                #raise CrabException(msg)
279 >            itr4 = replicas
280 >            #####
281          return itr4
282  
283 <    def submitTout(self, list):
283 >    def tOut(self, list):
284          return 180

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines