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.9 by spiga, Fri Nov 17 15:28:47 2006 UTC vs.
Revision 1.17.2.1 by fanzago, Tue Oct 9 10:46:56 2007 UTC

# Line 44 | Line 44 | class SchedulerGlite(SchedulerEdg):
44    
45          req = ''
46          req = req + jbt.getRequirements()
47 <    
47 >  
48 >  
49          if self.EDG_requirements:
50 <            if (req == ' '):
51 <                req = req + self.EDG_requirements
52 <            else:
52 <                req = req +  ' && ' + self.EDG_requirements
50 >            if (not req == ' '): req = req +  ' && '
51 >            req = req + self.EDG_requirements
52 >
53          if self.EDG_ce_white_list:
54              ce_white_list = string.split(self.EDG_ce_white_list,',')
55 <            for i in range(len(ce_white_list)):
56 <                if i == 0:
57 <                    if (req == ' '):
58 <                        req = req + '((RegExp("' + string.strip(ce_white_list[i]) + '", other.GlueCEUniqueId))'
59 <                    else:
60 <                        req = req +  ' && ((RegExp("' + string.strip(ce_white_list[i]) + '", other.GlueCEUniqueId))'
61 <                    pass
62 <                else:
63 <                    req = req +  ' || (RegExp("' + string.strip(ce_white_list[i]) + '", other.GlueCEUniqueId))'
64 <            req = req + ')'
55 >            tmpCe=[]
56 >            concString = '&&'
57 >            for ce in ce_white_list:
58 >                tmpCe.append('RegExp("' + string.strip(ce) + '", other.GlueCEUniqueId)')
59 >            ### MATTY' FIX: if more then one CE: && -> ||
60 >            #print "list CE: " + str(tmpCe)
61 >            if len(tmpCe) == 1:
62 >                req +=  " && (" + concString.join(tmpCe) + ") "
63 >            elif len(tmpCe) > 1:
64 >                firstCE = 0
65 >                for reqTemp in tmpCe:
66 >                    #print reqTemp
67 >                    if firstCE == 0:
68 >                        #print "adding: "+str(" && ( (" + reqTemp + ") ")
69 >                        req += " && ( (" + reqTemp + ") "
70 >                        firstCE = 1
71 >                    elif firstCE > 0:
72 >                        #print "adding: "+str(" || (" + reqTemp + ") ")
73 >                        req += " || (" + reqTemp + ") "
74 >                if firstCE > 0:
75 >                    req += ") "
76 >            ## old code
77 > #            if len(tmpCe): req = req + " && (" + concString.join(tmpCe) + ") "
78          
79          if self.EDG_ce_black_list:
80              ce_black_list = string.split(self.EDG_ce_black_list,',')
81 +            tmpCe=[]
82 +            concString = '&&'
83              for ce in ce_black_list:
84 <                if (req == ' '):
85 <                    req = req + '(!RegExp("' + string.strip(ce) + '", other.GlueCEUniqueId))'
86 <                else:
72 <                    req = req +  ' && (!RegExp("' + string.strip(ce) + '", other.GlueCEUniqueId))'
73 <                pass
84 >                tmpCe.append('(!RegExp("' + string.strip(ce) + '", other.GlueCEUniqueId))')
85 >            if len(tmpCe): req = req + " && (" + concString.join(tmpCe) + ") "
86 >
87          if self.EDG_clock_time:
88 <            if (req == ' '):
89 <                req = req + 'other.GlueCEPolicyMaxWallClockTime>='+self.EDG_clock_time
77 <            else:
78 <                req = req + ' && other.GlueCEPolicyMaxWallClockTime>='+self.EDG_clock_time
88 >            if (not req == ' '): req = req + ' && '
89 >            req = req + 'other.GlueCEPolicyMaxWallClockTime>='+self.EDG_clock_time
90  
91          if self.EDG_cpu_time:
92 <            if (req == ' '):
93 <                req = req + ' other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time
83 <            else:
84 <                req = req + ' && other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time
92 >            if (not req == ' '): req = req + ' && '
93 >            req = req + ' other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time
94                  
95          for i in range(len(first)): # Add loop DS
96              self.param='sched_param_'+str(i)+'.clad'
# Line 90 | Line 99 | class SchedulerGlite(SchedulerEdg):
99              itr4=self.findSites_(first[i])
100              reqSites=''
101              reqtmp=[]  
93            j = 0
102              concString = '||'
103 +
104 +            #############
105 +            # MC Changed matching syntax to avoid gang matching
106 +            #############
107              for arg in itr4:
96                #############
97                # MC Changed matching syntax to avoid gang matching
98                #############
108                  reqtmp.append(' Member("'+arg+'" , other.GlueCESEBindGroupSEUniqueID) ')
109 <            if len(reqtmp): reqSites = reqSites + " && (" + concString.join(reqtmp) + ')'
110 <            reqSites = reqSites + ';\n'
109 >
110 >            if len(reqtmp): reqSites = reqSites + " && (" + concString.join(reqtmp) + ") "
111 >
112 >            # requirement added to skip gliteCE
113 >            reqSites = reqSites + '&& (!RegExp("blah", other.GlueCEUniqueId));\n'
114 >
115              param_file.write('Requirements = ' + req + reqSites )
116    
117              if (self.rb_param_file != ''):
# Line 139 | Line 152 | class SchedulerGlite(SchedulerEdg):
152          txt += '    echo "middleware =$middleware" \n'
153          txt += 'elif [ $GRID3_APP_DIR ]; then\n'
154          txt += '    middleware=OSG \n'
155 <        txt += '    echo "SyncCE=`echo $EDG_WL_LOG_DESTINATION`" | tee -a $RUNTIME_AREA/$repo \n'
155 >        txt += '    if [ $GLOBUS_GRAM_JOB_CONTACT ]; then \n'
156 >        txt += '        SyncCE=`echo "echo $GLOBUS_GRAM_JOB_CONTACT" | cut -d: -f2 | sed \'s/\/\///\'`;\n'
157 >        txt += '        echo "SyncCE=$SyncCE"  | tee -a $RUNTIME_AREA/$repo ;\n'
158 >        txt += '    else\n'
159 >        txt += '        echo "not reporting SyncCE";\n'
160 >        txt += '    fi\n';
161          txt += '    echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n'
162          txt += '    echo "middleware =$middleware" \n'
163          txt += 'elif [ $OSG_APP ]; then \n'
164          txt += '    middleware=OSG \n'
165 <        txt += '    echo "SyncCE=`echo $EDG_WL_LOG_DESTINATION`" | tee -a $RUNTIME_AREA/$repo \n'
165 >        txt += '    if [ $GLOBUS_GRAM_JOB_CONTACT ]; then \n'
166 >        txt += '        SyncCE=`echo "echo $GLOBUS_GRAM_JOB_CONTACT" | cut -d: -f2 | sed \'s/\/\///\'`;\n'
167 >        txt += '        echo "SyncCE=$SyncCE"  | tee -a $RUNTIME_AREA/$repo ;\n'
168 >        txt += '    else\n'
169 >        txt += '        echo "not reporting SyncCE";\n'
170 >        txt += '    fi\n';
171          txt += '    echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n'
172          txt += '    echo "middleware =$middleware" \n'
173          txt += 'else \n'
# Line 166 | Line 189 | class SchedulerGlite(SchedulerEdg):
189          
190          txt += '\n\n'
191  
192 <        if int(self.copy_data) == 1:
193 <           if self.SE:
194 <              txt += 'export SE='+self.SE+'\n'
195 <              txt += 'echo "SE = $SE"\n'
196 <           if self.SE_PATH:
197 <              if ( self.SE_PATH[-1] != '/' ) : self.SE_PATH = self.SE_PATH + '/'
198 <              txt += 'export SE_PATH='+self.SE_PATH+'\n'
199 <              txt += 'echo "SE_PATH = $SE_PATH"\n'
192 >        #if int(self.copy_data) == 1:
193 >        #   if self.SE:
194 >        #      txt += 'export SE='+self.SE+'\n'
195 >        #      txt += 'echo "SE = $SE"\n'
196 >        #   if self.SE_PATH:
197 >        #      if ( self.SE_PATH[-1] != '/' ) : self.SE_PATH = self.SE_PATH + '/'
198 >        #      txt += 'export SE_PATH='+self.SE_PATH+'\n'
199 >        #      txt += 'echo "SE_PATH = $SE_PATH"\n'
200  
201          txt += 'export VO='+self.VO+'\n'
202          ### some line for LFC catalog setting
203 <        txt += 'if [ $middleware == LCG ]; then \n'
204 <        txt += '    if [[ $LCG_CATALOG_TYPE != \''+self.lcg_catalog_type+'\' ]]; then\n'
205 <        txt += '        export LCG_CATALOG_TYPE='+self.lcg_catalog_type+'\n'
206 <        txt += '    fi\n'
207 <        txt += '    if [[ $LFC_HOST != \''+self.lfc_host+'\' ]]; then\n'
208 <        txt += '        export LFC_HOST='+self.lfc_host+'\n'
209 <        txt += '    fi\n'
210 <        txt += '    if [[ $LFC_HOME != \''+self.lfc_home+'\' ]]; then\n'
211 <        txt += '        export LFC_HOME='+self.lfc_home+'\n'
212 <        txt += '    fi\n'
213 <        txt += 'elif [ $middleware == OSG ]; then\n'
214 <        txt += '    echo "LFC catalog setting to be implemented for OSG"\n'
215 <        txt += 'fi\n'
203 >        #txt += 'if [ $middleware == LCG ]; then \n'
204 >        #txt += '    if [[ $LCG_CATALOG_TYPE != \''+self.lcg_catalog_type+'\' ]]; then\n'
205 >        #txt += '        export LCG_CATALOG_TYPE='+self.lcg_catalog_type+'\n'
206 >        #txt += '    fi\n'
207 >        #txt += '    if [[ $LFC_HOST != \''+self.lfc_host+'\' ]]; then\n'
208 >        #txt += '        export LFC_HOST='+self.lfc_host+'\n'
209 >        #txt += '    fi\n'
210 >        #txt += '    if [[ $LFC_HOME != \''+self.lfc_home+'\' ]]; then\n'
211 >        #txt += '        export LFC_HOME='+self.lfc_home+'\n'
212 >        #txt += '    fi\n'
213 >        #txt += 'elif [ $middleware == OSG ]; then\n'
214 >        #txt += '    echo "LFC catalog setting to be implemented for OSG"\n'
215 >        #txt += 'fi\n'
216          #####
217 <        if int(self.register_data) == 1:
218 <           txt += 'if [ $middleware == LCG ]; then \n'
219 <           txt += '    export LFN='+self.LFN+'\n'
220 <           txt += '    lfc-ls $LFN\n'
221 <           txt += '    result=$?\n'
222 <           txt += '    echo $result\n'
223 <           ### creation of LFN dir in LFC catalog, under /grid/cms dir  
224 <           txt += '    if [ $result != 0 ]; then\n'
225 <           txt += '       lfc-mkdir $LFN\n'
226 <           txt += '       result=$?\n'
227 <           txt += '       echo $result\n'
228 <           txt += '    fi\n'
229 <           txt += 'elif [ $middleware == OSG ]; then\n'
230 <           txt += '    echo " Files registration to be implemented for OSG"\n'
231 <           txt += 'fi\n'
232 <           txt += '\n'
233 <
234 <           if self.VO:
235 <              txt += 'export VO='+self.VO+'\n'
236 <           if self.LFN:
237 <              txt += 'if [ $middleware == LCG ]; then \n'
238 <              txt += '    export LFN='+self.LFN+'\n'
239 <              txt += 'fi\n'
217 <              txt += '\n'
217 >        #if int(self.register_data) == 1:
218 >        #   txt += 'if [ $middleware == LCG ]; then \n'
219 >        #   txt += '    export LFN='+self.LFN+'\n'
220 >        #   txt += '    lfc-ls $LFN\n'
221 >        #   txt += '    result=$?\n'
222 >        #   txt += '    echo $result\n'
223 >        #   ### creation of LFN dir in LFC catalog, under /grid/cms dir  
224 >        #   txt += '    if [ $result != 0 ]; then\n'
225 >        #   txt += '       lfc-mkdir $LFN\n'
226 >        #   txt += '       result=$?\n'
227 >        #   txt += '       echo $result\n'
228 >        #   txt += '    fi\n'
229 >        #   txt += 'elif [ $middleware == OSG ]; then\n'
230 >        #   txt += '    echo " Files registration to be implemented for OSG"\n'
231 >        #   txt += 'fi\n'
232 >        #   txt += '\n'
233 >        #   if self.VO:
234 >        #      txt += 'export VO='+self.VO+'\n'
235 >        #   if self.LFN:
236 >        #      txt += 'if [ $middleware == LCG ]; then \n'
237 >        #      txt += '    export LFN='+self.LFN+'\n'
238 >        #      txt += 'fi\n'
239 >        #      txt += '\n'
240  
241          txt += 'if [ $middleware == LCG ]; then\n'
242          txt += '    CloseCEs=`glite-brokerinfo getCE`\n'
# Line 254 | Line 276 | class SchedulerGlite(SchedulerEdg):
276          return cmd_out
277  
278      def findSites_(self, n):
279 +        itr4 = []
280          sites = common.jobDB.destination(n)
281          if len(sites)>0 and sites[0]=="":
282 <            return []
283 <        return sites
282 >            return itr4
283 >        if sites != [""]:
284 >            ##Addedd Daniele
285 >            replicas = self.blackWhiteListParser.checkBlackList(sites,n)
286 >            if len(replicas)!=0:
287 >                replicas = self.blackWhiteListParser.checkWhiteList(replicas,n)
288 >              
289 >            if len(replicas)==0:
290 >                msg = 'No sites remaining that host any part of the requested data! Exiting... '
291 >                raise CrabException(msg)
292 >            itr4 = replicas
293 >            #####        
294 >        return itr4
295 >
296 >    def submitTout(self, list):
297 >        return 180

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines