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.10 by slacapra, Wed Jan 17 18:17:58 2007 UTC vs.
Revision 1.26 by fanzago, Wed Nov 7 13:18:09 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 91 | Line 100 | class SchedulerGlite(SchedulerEdg):
100              reqSites=''
101              reqtmp=[]  
102              concString = '||'
103 +
104 +            #############
105 +            # MC Changed matching syntax to avoid gang matching
106 +            #############
107              for arg in itr4:
95                #############
96                # MC Changed matching syntax to avoid gang matching
97                #############
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 130 | Line 144 | class SchedulerGlite(SchedulerEdg):
144          txt += 'echo "SyncGridJobId=`echo $SyncGridJobId`" | tee -a $RUNTIME_AREA/$repo \n'
145          txt += 'echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
146  
147 <        txt += 'echo "middleware discovery " \n'
147 >        txt += 'echo "middleware discovery: " \n'
148          txt += 'if [ $VO_CMS_SW_DIR ]; then \n'
149          txt += '    middleware=LCG \n'
150          txt += '    echo "SyncCE=`glite-brokerinfo getCE`" | tee -a $RUNTIME_AREA/$repo \n'
151          txt += '    echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n'
152 <        txt += '    echo "middleware =$middleware" \n'
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 >        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'
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 [ $OSG_JOB_CONTACT ]; then \n'
166 >        txt += '        SyncCE="$OSG_JOB_CONTACT"; \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'
172 >        txt += '    echo ">>> middleware =$middleware" \n'
173          txt += 'else \n'
174          txt += '    echo "SET_CMS_ENV 10030 ==> middleware not identified" \n'
175          txt += '    echo "JOB_EXIT_STATUS = 10030" \n'
176          txt += '    echo "JobExitCode=10030" | tee -a $RUNTIME_AREA/$repo \n'
177          txt += '    dumpStatus $RUNTIME_AREA/$repo \n'
154        txt += '    rm -f $RUNTIME_AREA/$repo \n'
155        txt += '    echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
156        txt += '    echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
178          txt += '    exit 1 \n'
179          txt += 'fi \n'
180  
160        txt += '# report first time to DashBoard \n'
181          txt += 'dumpStatus $RUNTIME_AREA/$repo \n'
182 <        txt += 'rm -f $RUNTIME_AREA/$repo \n'
183 <        txt += 'echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
184 <        txt += 'echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
182 >        #txt += 'rm -f $RUNTIME_AREA/$repo \n'
183 >        #txt += 'echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
184 >        #txt += 'echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
185          
186          txt += '\n\n'
187  
188 <        if int(self.copy_data) == 1:
189 <           if self.SE:
190 <              txt += 'export SE='+self.SE+'\n'
191 <              txt += 'echo "SE = $SE"\n'
192 <           if self.SE_PATH:
193 <              if ( self.SE_PATH[-1] != '/' ) : self.SE_PATH = self.SE_PATH + '/'
194 <              txt += 'export SE_PATH='+self.SE_PATH+'\n'
195 <              txt += 'echo "SE_PATH = $SE_PATH"\n'
188 >        #if int(self.copy_data) == 1:
189 >        #   if self.SE:
190 >        #      txt += 'export SE='+self.SE+'\n'
191 >        #      txt += 'echo "SE = $SE"\n'
192 >        #   if self.SE_PATH:
193 >        #      if ( self.SE_PATH[-1] != '/' ) : self.SE_PATH = self.SE_PATH + '/'
194 >        #      txt += 'export SE_PATH='+self.SE_PATH+'\n'
195 >        #      txt += 'echo "SE_PATH = $SE_PATH"\n'
196  
197          txt += 'export VO='+self.VO+'\n'
198          ### some line for LFC catalog setting
199 <        txt += 'if [ $middleware == LCG ]; then \n'
200 <        txt += '    if [[ $LCG_CATALOG_TYPE != \''+self.lcg_catalog_type+'\' ]]; then\n'
201 <        txt += '        export LCG_CATALOG_TYPE='+self.lcg_catalog_type+'\n'
202 <        txt += '    fi\n'
203 <        txt += '    if [[ $LFC_HOST != \''+self.lfc_host+'\' ]]; then\n'
204 <        txt += '        export LFC_HOST='+self.lfc_host+'\n'
205 <        txt += '    fi\n'
206 <        txt += '    if [[ $LFC_HOME != \''+self.lfc_home+'\' ]]; then\n'
207 <        txt += '        export LFC_HOME='+self.lfc_home+'\n'
208 <        txt += '    fi\n'
209 <        txt += 'elif [ $middleware == OSG ]; then\n'
210 <        txt += '    echo "LFC catalog setting to be implemented for OSG"\n'
211 <        txt += 'fi\n'
199 >        #txt += 'if [ $middleware == LCG ]; then \n'
200 >        #txt += '    if [[ $LCG_CATALOG_TYPE != \''+self.lcg_catalog_type+'\' ]]; then\n'
201 >        #txt += '        export LCG_CATALOG_TYPE='+self.lcg_catalog_type+'\n'
202 >        #txt += '    fi\n'
203 >        #txt += '    if [[ $LFC_HOST != \''+self.lfc_host+'\' ]]; then\n'
204 >        #txt += '        export LFC_HOST='+self.lfc_host+'\n'
205 >        #txt += '    fi\n'
206 >        #txt += '    if [[ $LFC_HOME != \''+self.lfc_home+'\' ]]; then\n'
207 >        #txt += '        export LFC_HOME='+self.lfc_home+'\n'
208 >        #txt += '    fi\n'
209 >        #txt += 'elif [ $middleware == OSG ]; then\n'
210 >        #txt += '    echo "LFC catalog setting to be implemented for OSG"\n'
211 >        #txt += 'fi\n'
212          #####
213 <        if int(self.register_data) == 1:
214 <           txt += 'if [ $middleware == LCG ]; then \n'
215 <           txt += '    export LFN='+self.LFN+'\n'
216 <           txt += '    lfc-ls $LFN\n'
217 <           txt += '    result=$?\n'
218 <           txt += '    echo $result\n'
219 <           ### creation of LFN dir in LFC catalog, under /grid/cms dir  
220 <           txt += '    if [ $result != 0 ]; then\n'
221 <           txt += '       lfc-mkdir $LFN\n'
222 <           txt += '       result=$?\n'
223 <           txt += '       echo $result\n'
224 <           txt += '    fi\n'
225 <           txt += 'elif [ $middleware == OSG ]; then\n'
226 <           txt += '    echo " Files registration to be implemented for OSG"\n'
227 <           txt += 'fi\n'
228 <           txt += '\n'
229 <
230 <           if self.VO:
231 <              txt += 'export VO='+self.VO+'\n'
232 <           if self.LFN:
233 <              txt += 'if [ $middleware == LCG ]; then \n'
234 <              txt += '    export LFN='+self.LFN+'\n'
235 <              txt += 'fi\n'
216 <              txt += '\n'
213 >        #if int(self.register_data) == 1:
214 >        #   txt += 'if [ $middleware == LCG ]; then \n'
215 >        #   txt += '    export LFN='+self.LFN+'\n'
216 >        #   txt += '    lfc-ls $LFN\n'
217 >        #   txt += '    result=$?\n'
218 >        #   txt += '    echo $result\n'
219 >        #   ### creation of LFN dir in LFC catalog, under /grid/cms dir  
220 >        #   txt += '    if [ $result != 0 ]; then\n'
221 >        #   txt += '       lfc-mkdir $LFN\n'
222 >        #   txt += '       result=$?\n'
223 >        #   txt += '       echo $result\n'
224 >        #   txt += '    fi\n'
225 >        #   txt += 'elif [ $middleware == OSG ]; then\n'
226 >        #   txt += '    echo " Files registration to be implemented for OSG"\n'
227 >        #   txt += 'fi\n'
228 >        #   txt += '\n'
229 >        #   if self.VO:
230 >        #      txt += 'export VO='+self.VO+'\n'
231 >        #   if self.LFN:
232 >        #      txt += 'if [ $middleware == LCG ]; then \n'
233 >        #      txt += '    export LFN='+self.LFN+'\n'
234 >        #      txt += 'fi\n'
235 >        #      txt += '\n'
236  
237          txt += 'if [ $middleware == LCG ]; then\n'
238          txt += '    CloseCEs=`glite-brokerinfo getCE`\n'
# Line 228 | Line 247 | class SchedulerGlite(SchedulerEdg):
247          txt += '        echo "JOB_EXIT_STATUS = 10099" \n'
248          txt += '        echo "JobExitCode=10099" | tee -a $RUNTIME_AREA/$repo \n'
249          txt += '        dumpStatus $RUNTIME_AREA/$repo \n'
250 <        txt += '        rm -f $RUNTIME_AREA/$repo \n'
251 <        txt += '        echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
252 <        txt += '        echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
250 >        #txt += '        rm -f $RUNTIME_AREA/$repo \n'
251 >        #txt += '        echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
252 >        #txt += '        echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
253          txt += '        exit 1 \n'
254          txt += '    fi \n'
255          txt += 'fi \n'
# Line 253 | Line 272 | class SchedulerGlite(SchedulerEdg):
272          return cmd_out
273  
274      def findSites_(self, n):
275 +        itr4 = []
276          sites = common.jobDB.destination(n)
277          if len(sites)>0 and sites[0]=="":
278 <            return []
279 <        return sites
278 >            return itr4
279 >        if sites != [""]:
280 >            ##Addedd Daniele
281 >            replicas = self.blackWhiteListParser.checkBlackList(sites,n)
282 >            if len(replicas)!=0:
283 >                replicas = self.blackWhiteListParser.checkWhiteList(replicas,n)
284 >              
285 >            #if len(replicas)==0:
286 >                #msg = 'No sites remaining that host any part of the requested data! Exiting... '
287 >                #raise CrabException(msg)
288 >            itr4 = replicas
289 >            #####        
290 >        return itr4
291 >
292 >    def submitTout(self, list):
293 >        return 180

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines