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.7 by slacapra, Tue Oct 17 09:52:57 2006 UTC vs.
Revision 1.25 by mcinquil, Fri Oct 19 11:48:01 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("' + ce_white_list[i] + '", other.GlueCEUniqueId))'
59 <                    else:
60 <                        req = req +  ' && ((RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))'
61 <                    pass
62 <                else:
63 <                    req = req +  ' || (RegExp("' + 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("' + ce + '", other.GlueCEUniqueId))'
86 <                else:
72 <                    req = req +  ' && (!RegExp("' + 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 [ $OSG_JOB_CONTACT ]; then \n'
156 >        txt += '        SyncCE="$OSG_JOB_CONTACT"; \n'
157 >        txt += '        echo "SyncCE=$SyncCE" | tee -a $RUNTIME_AREA/$repo ;\n'
158 > #$GLOBUS_GRAM_JOB_CONTACT ]; then \n'
159 > #        txt += '        SyncCE=`echo "echo $GLOBUS_GRAM_JOB_CONTACT" | cut -d: -f2 | sed \'s/\/\///\'`;\n'
160 > #        txt += '        echo "SyncCE=$SyncCE"  | tee -a $RUNTIME_AREA/$repo ;\n'
161 >        txt += '    else\n'
162 >        txt += '        echo "not reporting SyncCE";\n'
163 >        txt += '    fi\n';
164          txt += '    echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n'
165          txt += '    echo "middleware =$middleware" \n'
166          txt += 'elif [ $OSG_APP ]; then \n'
167          txt += '    middleware=OSG \n'
168 <        txt += '    echo "SyncCE=`echo $EDG_WL_LOG_DESTINATION`" | tee -a $RUNTIME_AREA/$repo \n'
168 >        txt += '    if [ $OSG_JOB_CONTACT ]; then \n'
169 >        txt += '        SyncCE="$OSG_JOB_CONTACT"; \n'
170 >        txt += '        echo "SyncCE=$SyncCE" | tee -a $RUNTIME_AREA/$repo ;\n'
171 > #        txt += '        SyncCE=`echo "echo $GLOBUS_GRAM_JOB_CONTACT" | cut -d: -f2 | sed \'s/\/\///\'`;\n'
172 > #        txt += '        echo "SyncCE=$SyncCE"  | tee -a $RUNTIME_AREA/$repo ;\n'
173 >        txt += '    else\n'
174 >        txt += '        echo "not reporting SyncCE";\n'
175 >        txt += '    fi\n';
176          txt += '    echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n'
177          txt += '    echo "middleware =$middleware" \n'
178          txt += 'else \n'
# Line 166 | Line 194 | class SchedulerGlite(SchedulerEdg):
194          
195          txt += '\n\n'
196  
197 <        if int(self.copy_data) == 1:
198 <           if self.SE:
199 <              txt += 'export SE='+self.SE+'\n'
200 <              txt += 'echo "SE = $SE"\n'
201 <           if self.SE_PATH:
202 <              if ( self.SE_PATH[-1] != '/' ) : self.SE_PATH = self.SE_PATH + '/'
203 <              txt += 'export SE_PATH='+self.SE_PATH+'\n'
204 <              txt += 'echo "SE_PATH = $SE_PATH"\n'
197 >        #if int(self.copy_data) == 1:
198 >        #   if self.SE:
199 >        #      txt += 'export SE='+self.SE+'\n'
200 >        #      txt += 'echo "SE = $SE"\n'
201 >        #   if self.SE_PATH:
202 >        #      if ( self.SE_PATH[-1] != '/' ) : self.SE_PATH = self.SE_PATH + '/'
203 >        #      txt += 'export SE_PATH='+self.SE_PATH+'\n'
204 >        #      txt += 'echo "SE_PATH = $SE_PATH"\n'
205  
206          txt += 'export VO='+self.VO+'\n'
207          ### some line for LFC catalog setting
208 <        txt += 'if [ $middleware == LCG ]; then \n'
209 <        txt += '    if [[ $LCG_CATALOG_TYPE != \''+self.lcg_catalog_type+'\' ]]; then\n'
210 <        txt += '        export LCG_CATALOG_TYPE='+self.lcg_catalog_type+'\n'
211 <        txt += '    fi\n'
212 <        txt += '    if [[ $LFC_HOST != \''+self.lfc_host+'\' ]]; then\n'
213 <        txt += '        export LFC_HOST='+self.lfc_host+'\n'
214 <        txt += '    fi\n'
215 <        txt += '    if [[ $LFC_HOME != \''+self.lfc_home+'\' ]]; then\n'
216 <        txt += '        export LFC_HOME='+self.lfc_home+'\n'
217 <        txt += '    fi\n'
218 <        txt += 'elif [ $middleware == OSG ]; then\n'
219 <        txt += '    echo "LFC catalog setting to be implemented for OSG"\n'
220 <        txt += 'fi\n'
208 >        #txt += 'if [ $middleware == LCG ]; then \n'
209 >        #txt += '    if [[ $LCG_CATALOG_TYPE != \''+self.lcg_catalog_type+'\' ]]; then\n'
210 >        #txt += '        export LCG_CATALOG_TYPE='+self.lcg_catalog_type+'\n'
211 >        #txt += '    fi\n'
212 >        #txt += '    if [[ $LFC_HOST != \''+self.lfc_host+'\' ]]; then\n'
213 >        #txt += '        export LFC_HOST='+self.lfc_host+'\n'
214 >        #txt += '    fi\n'
215 >        #txt += '    if [[ $LFC_HOME != \''+self.lfc_home+'\' ]]; then\n'
216 >        #txt += '        export LFC_HOME='+self.lfc_home+'\n'
217 >        #txt += '    fi\n'
218 >        #txt += 'elif [ $middleware == OSG ]; then\n'
219 >        #txt += '    echo "LFC catalog setting to be implemented for OSG"\n'
220 >        #txt += 'fi\n'
221          #####
222 <        if int(self.register_data) == 1:
223 <           txt += 'if [ $middleware == LCG ]; then \n'
224 <           txt += '    export LFN='+self.LFN+'\n'
225 <           txt += '    lfc-ls $LFN\n'
226 <           txt += '    result=$?\n'
227 <           txt += '    echo $result\n'
228 <           ### creation of LFN dir in LFC catalog, under /grid/cms dir  
229 <           txt += '    if [ $result != 0 ]; then\n'
230 <           txt += '       lfc-mkdir $LFN\n'
231 <           txt += '       result=$?\n'
232 <           txt += '       echo $result\n'
233 <           txt += '    fi\n'
234 <           txt += 'elif [ $middleware == OSG ]; then\n'
235 <           txt += '    echo " Files registration to be implemented for OSG"\n'
236 <           txt += 'fi\n'
237 <           txt += '\n'
238 <
239 <           if self.VO:
240 <              txt += 'export VO='+self.VO+'\n'
241 <           if self.LFN:
242 <              txt += 'if [ $middleware == LCG ]; then \n'
243 <              txt += '    export LFN='+self.LFN+'\n'
244 <              txt += 'fi\n'
217 <              txt += '\n'
222 >        #if int(self.register_data) == 1:
223 >        #   txt += 'if [ $middleware == LCG ]; then \n'
224 >        #   txt += '    export LFN='+self.LFN+'\n'
225 >        #   txt += '    lfc-ls $LFN\n'
226 >        #   txt += '    result=$?\n'
227 >        #   txt += '    echo $result\n'
228 >        #   ### creation of LFN dir in LFC catalog, under /grid/cms dir  
229 >        #   txt += '    if [ $result != 0 ]; then\n'
230 >        #   txt += '       lfc-mkdir $LFN\n'
231 >        #   txt += '       result=$?\n'
232 >        #   txt += '       echo $result\n'
233 >        #   txt += '    fi\n'
234 >        #   txt += 'elif [ $middleware == OSG ]; then\n'
235 >        #   txt += '    echo " Files registration to be implemented for OSG"\n'
236 >        #   txt += 'fi\n'
237 >        #   txt += '\n'
238 >        #   if self.VO:
239 >        #      txt += 'export VO='+self.VO+'\n'
240 >        #   if self.LFN:
241 >        #      txt += 'if [ $middleware == LCG ]; then \n'
242 >        #      txt += '    export LFN='+self.LFN+'\n'
243 >        #      txt += 'fi\n'
244 >        #      txt += '\n'
245  
246          txt += 'if [ $middleware == LCG ]; then\n'
247          txt += '    CloseCEs=`glite-brokerinfo getCE`\n'
# Line 243 | Line 270 | class SchedulerGlite(SchedulerEdg):
270          retrieve the logging info from logging and bookkeeping and return it
271          """
272          self.checkProxy()
273 <        cmd = 'glite-job-logging-info -v 2 ' + id
273 >        cmd = 'glite-job-logging-info -v 3 ' + id
274          cmd_out = runCommand(cmd)
275          return cmd_out
276  
# Line 254 | Line 281 | class SchedulerGlite(SchedulerEdg):
281          return cmd_out
282  
283      def findSites_(self, n):
284 +        itr4 = []
285          sites = common.jobDB.destination(n)
286          if len(sites)>0 and sites[0]=="":
287 <            return []
288 <        return sites
287 >            return itr4
288 >        if sites != [""]:
289 >            ##Addedd Daniele
290 >            replicas = self.blackWhiteListParser.checkBlackList(sites,n)
291 >            if len(replicas)!=0:
292 >                replicas = self.blackWhiteListParser.checkWhiteList(replicas,n)
293 >              
294 >            #if len(replicas)==0:
295 >                #msg = 'No sites remaining that host any part of the requested data! Exiting... '
296 >                #raise CrabException(msg)
297 >            itr4 = replicas
298 >            #####        
299 >        return itr4
300 >
301 >    def submitTout(self, list):
302 >        return 180

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines