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

Comparing COMP/CRAB/python/SchedulerEdg.py (file contents):
Revision 1.29 by fanzago, Fri Nov 18 15:50:23 2005 UTC vs.
Revision 1.47 by gutsche, Tue Apr 4 20:45:51 2006 UTC

# Line 2 | Line 2 | from Scheduler import Scheduler
2   from crab_logger import Logger
3   from crab_exceptions import *
4   from crab_util import *
5 + from EdgConfig import *
6   import common
7  
8   import os, sys, time
# Line 21 | Line 22 | class SchedulerEdg(Scheduler):
22  
23      def configure(self, cfg_params):
24  
25 <        try: self.edg_config = cfg_params["EDG.config"]
26 <        except KeyError: self.edg_config = ''
27 <
28 <        try: self.edg_config_vo = cfg_params["EDG.config_vo"]
29 <        except KeyError: self.edg_config_vo = ''
25 >        try:
26 >            RB = cfg_params["EDG.rb"]
27 >            edgConfig = EdgConfig(RB)
28 >            self.edg_config = edgConfig.config()
29 >            self.edg_config_vo = edgConfig.configVO()
30 >        except KeyError:
31 >            self.edg_config = ''
32 >            self.edg_config_vo = ''
33  
34          try: self.LCG_version = cfg_params["EDG.lcg_version"]
35          except KeyError: self.LCG_version = '2'
# Line 39 | Line 43 | class SchedulerEdg(Scheduler):
43          try: self.VO = cfg_params['EDG.virtual_organization']
44          except KeyError: self.VO = 'cms'
45  
46 +        try:
47 +             self.copy_input_data = common.analisys_common_info['copy_input_data']
48 +             #print "self.copy_input_data = ", self.copy_input_data
49 +        except KeyError: self.copy_input_data = 0
50 +
51          try: self.return_data = cfg_params['USER.return_data']
52 <        except KeyError: self.return_data = ''
52 >        except KeyError: self.return_data = 1
53  
54          try:
55              self.copy_data = cfg_params["USER.copy_data"]
56 <            try:
57 <                self.SE = cfg_params['USER.storage_element']
58 <                self.SE_PATH = cfg_params['USER.storage_path']
59 <            except KeyError:
60 <                msg = "Error. The [USER] section does not have 'storage_element'"
61 <                msg = msg + " and/or 'storage_path' entries, necessary to copy the output"
62 <                common.logger.message(msg)
63 <                raise CrabException(msg)
64 <        except KeyError: self.copy_data = ''
56 >            if int(self.copy_data) == 1:
57 >                try:
58 >                    self.SE = cfg_params['USER.storage_element']
59 >                    self.SE_PATH = cfg_params['USER.storage_path']
60 >                except KeyError:
61 >                    msg = "Error. The [USER] section does not have 'storage_element'"
62 >                    msg = msg + " and/or 'storage_path' entries, necessary to copy the output"
63 >                    common.logger.message(msg)
64 >                    raise CrabException(msg)
65 >        except KeyError: self.copy_data = 0
66 >
67 >        if ( int(self.return_data) == 0 and int(self.copy_data) == 0 ):
68 >           msg = 'Warning: return_data = 0 and copy_data = 0 ==> your exe output will be lost\n'
69 >           msg = msg + 'Please modify return_data and copy_data value in your crab.cfg file\n'
70 >           raise CrabException(msg)
71  
72 +        try:
73 +            self.lfc_host = cfg_params['EDG.lfc_host']
74 +        except KeyError:
75 +            msg = "Error. The [EDG] section does not have 'lfc_host' value"
76 +            msg = msg + " it's necessary to know the LFC host name"
77 +            common.logger.message(msg)
78 +            raise CrabException(msg)
79 +        try:
80 +            self.lcg_catalog_type = cfg_params['EDG.lcg_catalog_type']
81 +        except KeyError:
82 +            msg = "Error. The [EDG] section does not have 'lcg_catalog_type' value"
83 +            msg = msg + " it's necessary to know the catalog type"
84 +            common.logger.message(msg)
85 +            raise CrabException(msg)
86 +        try:
87 +            self.lfc_home = cfg_params['EDG.lfc_home']
88 +        except KeyError:
89 +            msg = "Error. The [EDG] section does not have 'lfc_home' value"
90 +            msg = msg + " it's necessary to know the home catalog dir"
91 +            common.logger.message(msg)
92 +            raise CrabException(msg)
93 +      
94          try:
95              self.register_data = cfg_params["USER.register_data"]
96 <            try:
97 <                 self.LFN = cfg_params['USER.lfn_dir']
98 <            except KeyError:
99 <                msg = "Error. The [USER] section does not have 'lfn_dir' value"
100 <                msg = msg + " it's necessary for RLS registration"
101 <                common.logger.message(msg)
102 <                raise CrabException(msg)
103 <        except KeyError: self.register_data= ''
96 >            if int(self.register_data) == 1:
97 >                try:
98 >                    self.LFN = cfg_params['USER.lfn_dir']
99 >                except KeyError:
100 >                    msg = "Error. The [USER] section does not have 'lfn_dir' value"
101 >                    msg = msg + " it's necessary for LCF registration"
102 >                    common.logger.message(msg)
103 >                    raise CrabException(msg)
104 >        except KeyError: self.register_data = 0
105 >
106 >        if ( int(self.copy_data) == 0 and int(self.register_data) == 1 ):
107 >           msg = 'Warning: register_data = 1 must be used with copy_data = 1\n'
108 >           msg = msg + 'Please modify copy_data value in your crab.cfg file\n'
109 >           common.logger.message(msg)
110 >           raise CrabException(msg)
111  
112          try: self.EDG_requirements = cfg_params['EDG.requirements']
113          except KeyError: self.EDG_requirements = ''
# Line 115 | Line 159 | class SchedulerEdg(Scheduler):
159          """
160  
161          txt = ''
162 <        if self.copy_data:
162 >        if int(self.copy_data) == 1:
163             if self.SE:
164                txt += 'export SE='+self.SE+'\n'
165                txt += 'echo "SE = $SE"\n'
# Line 124 | Line 168 | class SchedulerEdg(Scheduler):
168                txt += 'export SE_PATH='+self.SE_PATH+'\n'
169                txt += 'echo "SE_PATH = $SE_PATH"\n'
170                                                                                                                                                              
171 <        if self.register_data:
172 <           if self.VO:
173 <              txt += 'export VO='+self.VO+'\n'
174 <           if self.LFN:
175 <              txt += 'export LFN='+self.LFN+'\n'
176 <              txt += '\n'
171 >        txt += 'export VO='+self.VO+'\n'
172 >        ### FEDE: add some line for LFC catalog setting
173 >        txt += 'if [[ $LCG_CATALOG_TYPE != \''+self.lcg_catalog_type+'\' ]]; then\n'
174 >        txt += '   export LCG_CATALOG_TYPE='+self.lcg_catalog_type+'\n'
175 >        txt += 'fi\n'
176 >        txt += 'if [[ $LFC_HOST != \''+self.lfc_host+'\' ]]; then\n'
177 >        txt += 'export LFC_HOST='+self.lfc_host+'\n'
178 >        txt += 'fi\n'
179 >        txt += 'if [[ $LFC_HOME != \''+self.lfc_home+'\' ]]; then\n'
180 >        txt += 'export LFC_HOME='+self.lfc_home+'\n'
181 >        txt += 'fi\n'
182 >        #####
183 >        if int(self.register_data) == 1:
184 >           txt += 'export LFN='+self.LFN+'\n'
185 >           txt += 'lfc-ls $LFN\n'
186 >           txt += 'result=$?\n'
187 >           txt += 'echo $result\n'
188 >           ### creation of LFN dir in LFC catalog, under /grid/cms dir  
189 >           txt += 'if [ $result != 0 ]; then\n'
190 >           txt += '   lfc-mkdir $LFN\n'
191 >           txt += '   result=$?\n'
192 >           txt += '   echo $result\n'
193 >           txt += 'fi\n'
194 >           txt += '\n'
195          txt += 'CloseCEs=`edg-brokerinfo getCE`\n'
196          txt += 'echo "CloseCEs = $CloseCEs"\n'
197          txt += 'CE=`echo $CloseCEs | sed -e "s/:.*//"`\n'
198          txt += 'echo "CE = $CE"\n'
199          return txt
200  
201 +    def wsCopyInput(self):
202 +        """
203 +        Copy input data from SE to WN    
204 +        """
205 +        txt = ''
206 +        try:
207 +            self.copy_input_data = common.analisys_common_info['copy_input_data']
208 +            #print "self.copy_input_data = ", self.copy_input_data
209 +        except KeyError: self.copy_input_data = 0
210 +        if int(self.copy_input_data) == 1:
211 +           txt += '#\n'
212 +           txt += '#   Copy Input Data from SE to this WN\n'
213 +           txt += '#\n'
214 + ### changed by georgia (put a loop copying more than one input files per jobs)          
215 +           txt +='for input_file in $cur_file_list \n'
216 +           txt +='do \n'
217 +           txt +=' lcg-cp --vo $VO lfn:$input_lfn/$input_file file:`pwd`/$input_file 2>&1\n'
218 +           txt +=' copy_input_exit_status=$?\n'
219 +           txt +=' echo "COPY_INPUT_EXIT_STATUS = $copy_input_exit_status"\n'
220 +           txt +=' if [ $copy_input_exit_status -ne 0 ]; then \n'
221 +           txt +='    echo "Problems with copying to WN" \n'
222 +           txt +=' else \n'
223 +           txt +='    echo "input copied into WN" \n'
224 +           txt +=' fi \n'
225 +           txt +='done \n'
226 + ### copy a set of PU ntuples (same for each jobs -- but accessed randomly)
227 +           txt +='for file in $cur_pu_list \n'
228 +           txt +='do \n'
229 +           txt +=' lcg-cp --vo $VO lfn:$pu_lfn/$file file:`pwd`/$file 2>&1\n'
230 +           txt +=' copy_input_exit_status=$?\n'
231 +           txt +=' echo "COPY_INPUT_PU_EXIT_STATUS = $copy_input_pu_exit_status"\n'
232 +           txt +=' if [ $copy_input_pu_exit_status -ne 0 ]; then \n'
233 +           txt +='    echo "Problems with copying pu to WN" \n'
234 +           txt +=' else \n'
235 +           txt +='    echo "input pu files copied into WN" \n'
236 +           txt +=' fi \n'
237 +           txt +='done \n'
238 +           txt +='\n'
239 +           txt +='### Check SCRATCH space available on WN : \n'
240 +           txt +='df -h \n'
241 +        return txt
242 +
243      def wsCopyOutput(self):
244          """
245          Write a CopyResults part of a job script, e.g.
246          to copy produced output into a storage element.
247          """
248          txt = ''
249 <        if self.copy_data:
146 <           copy = 'globus-url-copy file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file'
249 >        if int(self.copy_data) == 1:
250             txt += '#\n'
251             txt += '#   Copy output to SE = $SE\n'
252             txt += '#\n'
253             txt += 'if [ $exe_result -eq 0 ]; then\n'
254 <           txt += '  for out_file in $file_list ; do\n'
255 <           txt += '    echo "Trying to copy output file to $SE "\n'
256 <           txt += '    echo "'+copy+'"\n'
257 <           txt += '    '+copy+' 2>&1\n'
258 <           txt += '    copy_exit_status=$?\n'
259 <           txt += '    echo "COPY_EXIT_STATUS = $copy_exit_status"\n'
260 <           txt += '    echo "STAGE_OUT = $copy_exit_status"\n'
261 <           txt += '    if [ $copy_exit_status -ne 0 ]; then \n'
262 <           txt += '       echo "Problems with SE= $SE" \n'
263 <           txt += '    else \n'
264 <           txt += '       echo "output copied into $SE/$SE_PATH directory"\n'
265 <           txt += '    fi \n'
266 <           txt += '  done\n'
267 <           txt += 'fi \n'
254 >           txt += '    for out_file in $file_list ; do\n'
255 >           txt += '        echo "Trying to copy output file to $SE "\n'
256 >           txt += '        echo "lcg-cp --vo cms -t 1200 file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n'
257 > #           txt += '        echo "globus-url-copy file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n'
258 >           txt += '        exitstring=`lcg-cp --vo cms -t 1200 file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n'
259 > #           txt += '        exitstring=`globus-url-copy file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n'
260 >           txt += '        copy_exit_status=$?\n'
261 >           txt += '        echo "COPY_EXIT_STATUS = $copy_exit_status"\n'
262 >           txt += '        echo "STAGE_OUT = $copy_exit_status"\n'
263 >           txt += '        if [ $copy_exit_status -ne 0 ]; then\n'
264 >           txt += '            echo "Problems with SE = $SE"\n'
265 >           txt += '            echo "StageOutExitStatus = 198" | tee -a $RUNTIME_AREA/$repo\n'
266 >           txt += '            echo "StageOutExitStatusReason = $exitstring" | tee -a $RUNTIME_AREA/$repo\n'
267 >           txt += '        else\n'
268 >           txt += '            echo "StageOutSE = $SE" | tee -a $RUNTIME_AREA/$repo\n'
269 >           txt += '            echo "StageOutCatalog = " | tee -a $RUNTIME_AREA/$repo\n'
270 >           txt += '            echo "output copied into $SE/$SE_PATH directory"\n'
271 >           txt += '            echo "StageOutExitStatus = 0" | tee -a $RUNTIME_AREA/$repo\n'
272 >           txt += '         fi\n'
273 >           txt += '     done\n'
274 >           txt += 'fi\n'
275          return txt
276  
277      def wsRegisterOutput(self):
# Line 170 | Line 280 | class SchedulerEdg(Scheduler):
280          """
281  
282          txt = ''
283 <        if self.register_data:
283 >        if int(self.register_data) == 1:
284             txt += '#\n'
285 <           txt += '#  Register output to RLS\n'
285 >           txt += '#  Register output to LFC\n'
286             txt += '#\n'
287             txt += 'if [[ $exe_result -eq 0 && $copy_exit_status -eq 0 ]]; then\n'
288             txt += '   for out_file in $file_list ; do\n'
289 <           txt += '      echo "Trying to register the output file into RLS"\n'
289 >           txt += '      echo "Trying to register the output file into LFC"\n'
290             txt += '      echo "lcg-rf -l $LFN/$out_file --vo $VO sfn://$SE$SE_PATH/$out_file"\n'
291             txt += '      lcg-rf -l $LFN/$out_file --vo $VO sfn://$SE$SE_PATH/$out_file 2>&1 \n'
292             txt += '      register_exit_status=$?\n'
293             txt += '      echo "REGISTER_EXIT_STATUS = $register_exit_status"\n'
294             txt += '      echo "STAGE_OUT = $register_exit_status"\n'
295             txt += '      if [ $register_exit_status -ne 0 ]; then \n'
296 <           txt += '         echo "Problems with the registration to RLS" \n'
296 >           txt += '         echo "Problems with the registration to LFC" \n'
297             txt += '         echo "Try with srm protocol" \n'
298             txt += '         echo "lcg-rf -l $LFN/$out_file --vo $VO srm://$SE$SE_PATH/$out_file"\n'
299             txt += '         lcg-rf -l $LFN/$out_file --vo $VO srm://$SE$SE_PATH/$out_file 2>&1 \n'
# Line 191 | Line 301 | class SchedulerEdg(Scheduler):
301             txt += '         echo "REGISTER_EXIT_STATUS = $register_exit_status"\n'
302             txt += '         echo "STAGE_OUT = $register_exit_status"\n'
303             txt += '         if [ $register_exit_status -ne 0 ]; then \n'
304 <           txt += '            echo "Problems with the registration into RLS" \n'
304 >           txt += '            echo "Problems with the registration into LFC" \n'
305             txt += '         fi \n'
306             txt += '      else \n'
307 <           txt += '         echo "output registered to RLS"\n'
307 >           txt += '         echo "output registered to LFC"\n'
308             txt += '      fi \n'
309 +           txt += '      echo "StageOutExitStatus = $register_exit_status" | tee -a $RUNTIME_AREA/$repo\n'
310             txt += '   done\n'
311             txt += 'elif [[ $exe_result -eq 0 && $copy_exit_status -ne 0 ]]; then \n'
312             txt += '   echo "Trying to copy output file to CloseSE"\n'
# Line 213 | Line 324 | class SchedulerEdg(Scheduler):
324             txt += '         echo "SE = $CLOSE_SE"\n'
325             txt += '         echo "LFN for the file is LFN=${LFN}/$out_file"\n'
326             txt += '      fi \n'
327 +           txt += '      echo "StageOutExitStatus = $register_exit_status" | tee -a $RUNTIME_AREA/$repo\n'
328             txt += '   done\n'
329             txt += 'else\n'
330             txt += '   echo "Problem with the executable"\n'
# Line 224 | Line 336 | class SchedulerEdg(Scheduler):
336          retrieve the logging info from logging and bookkeeping and return it
337          """
338          self.checkProxy()
227      #  id = common.jobDB.jobId(nj)
339          cmd = 'edg-job-get-logging-info -v 2 ' + id
340 <        cmd_out = os.popen(cmd)
341 <      #  cmd_out = runCommand(cmd)
340 >        #cmd_out = os.popen(cmd)
341 >        cmd_out = runCommand(cmd)
342          return cmd_out
343  
344      def listMatch(self, nj):
# Line 237 | Line 348 | class SchedulerEdg(Scheduler):
348          self.checkProxy()
349          jdl = common.job_list[nj].jdlFilename()
350          cmd = 'edg-job-list-match ' + self.configOpt_() + jdl
351 <        myCmd = os.popen(cmd)
352 <        cmd_out = myCmd.readlines()
353 <        myCmd.close()
351 >        cmd_out = runCommand(cmd,0,10)
352 >        if not cmd_out:
353 >            raise CrabException("ERROR: "+cmd+" failed!")
354 >
355          return self.parseListMatch_(cmd_out, jdl)
356  
357      def parseListMatch_(self, out, jdl):
358 <
358 >        """
359 >        Parse the f* output of edg-list-match and produce something sensible
360 >        """
361          reComment = re.compile( r'^\**$' )
362          reEmptyLine = re.compile( r'^$' )
363          reVO = re.compile( r'Selected Virtual Organisation name.*' )
364 <        reCE = re.compile( r'CEId' )
364 >        reLine = re.compile( r'.*')
365 >        reCE = re.compile( r'(.*:.*)')
366 >        reCEId = re.compile( r'CEId.*')
367          reNO = re.compile( r'No Computing Element matching' )
368          reRB = re.compile( r'Connecting to host' )
369          next = 0
370          CEs=[]
371          Match=0
372  
373 <        for line in out:
374 <            line = line.strip()
375 <            if reComment.match( line ):
376 <                next = 0
377 <                continue
378 <            if reEmptyLine.match(line):
379 <                continue
373 >        #print out
374 >        lines = reLine.findall(out)
375 >
376 >        i=0
377 >        CEs=[]
378 >        for line in lines:
379 >            string.strip(line)
380 >            #print line
381 >            if reNO.match( line ):
382 >                common.logger.debug(5,line)
383 >                return 0
384 >                pass
385              if reVO.match( line ):
386 <                VO =line.split()[-1]
387 <                common.logger.debug(5, 'VO           :'+VO)
386 >                VO =reVO.match( line ).group()
387 >                common.logger.debug(5,"VO "+VO)
388                  pass
389 +
390              if reRB.match( line ):
391 <                RB =line.split()[3]
392 <                common.logger.debug(5, 'Using RB     :'+RB)
391 >                RB = reRB.match(line).group()
392 >                common.logger.debug(5,"RB "+RB)
393                  pass
394 <            if reCE.search( line ):
395 <                next = 1
396 <                continue
397 <            if next:
398 <                CE=line.split(':')[0]
399 <                if (CEs.count(CE) > 0):
400 <                   pass
401 <                else:
280 <                   CEs.append(CE)  
281 <                   Match=Match+1
282 <                common.logger.debug(5, 'Matched CE   :'+CE)
283 <                pass
284 <            if reNO.match( line ):
285 <                common.logger.debug(5,line)
286 <                self.noMatchFound_(jdl)
287 <                Match=0
394 >
395 >            if reCEId.search( line ):
396 >                for lineCE in lines[i:-1]:
397 >                    if reCE.match( lineCE ):
398 >                        CE = string.strip(reCE.search(lineCE).group(1))
399 >                        CEs.append(CE.split(':')[0])
400 >                        pass
401 >                    pass
402                  pass
403 <        return Match
403 >            i=i+1
404 >            pass
405 >
406 >        common.logger.debug(5,"All CE :"+str(CEs))
407 >
408 >        sites = []
409 >        [sites.append(it) for it in CEs if not sites.count(it)]
410 >
411 >        common.logger.debug(5,"All Sites :"+str(sites))
412 >        return len(sites)
413  
414      def noMatchFound_(self, jdl):
415          reReq = re.compile( r'Requirements' )
# Line 324 | Line 447 | class SchedulerEdg(Scheduler):
447              pass
448          return jid
449  
450 +    def resubmit(self, nj_list):
451 +        """
452 +        Prepare jobs to be submit
453 +        """
454 +        return
455 +
456      def getExitStatus(self, id):
457          return self.getStatusAttribute_(id, 'exit_code')
458  
# Line 349 | Line 478 | class SchedulerEdg(Scheduler):
478          jobStat.getStatus(id, level)
479          err, apiMsg = jobStat.get_error()
480          if err:
352            #print 'Error caught', apiMsg
353            #common.log.message(apiMsg)
481              common.logger.debug(5,'Error caught' + apiMsg)
482              return None
483          else:
# Line 434 | Line 561 | class SchedulerEdg(Scheduler):
561          #if common.use_jam:
562          #   inp_box = inp_box+' "'+common.bin_dir+'/'+common.run_jam+'",'
563  
564 <        for addFile in jbt.additional_inbox_files:
565 <            addFile = os.path.abspath(addFile)
566 <            inp_box = inp_box+' "'+addFile+'",'
567 <            pass
564 >        # Marco (VERY TEMPORARY ML STUFF)
565 >        inp_box = inp_box+' "' + os.path.abspath(os.environ['CRABDIR']+'/python/'+'report.py') + '", "' +\
566 >                  os.path.abspath(os.environ['CRABDIR']+'/python/'+'DashboardAPI.py') + '", "'+\
567 >                  os.path.abspath(os.environ['CRABDIR']+'/python/'+'Logger.py') + '", "'+\
568 >                  os.path.abspath(os.environ['CRABDIR']+'/python/'+'ProcInfo.py') + '", "'+\
569 >                  os.path.abspath(os.environ['CRABDIR']+'/python/'+'apmon.py') + '"'
570 >        # End Marco
571 >
572 >        if (not jbt.additional_inbox_files == []):
573 >            inp_box = inp_box + ', '
574 >            for addFile in jbt.additional_inbox_files:
575 >                addFile = os.path.abspath(addFile)
576 >                inp_box = inp_box+' "'+addFile+'",'
577 >                pass
578  
579          if inp_box[-1] == ',' : inp_box = inp_box[:-1]
580          inp_box = inp_box + ' };\n'
# Line 455 | Line 592 | class SchedulerEdg(Scheduler):
592                      job.stdout() + '", "' + \
593                      job.stderr() + '", ".BrokerInfo",'
594  
595 <        if self.return_data :
595 >        if int(self.return_data) == 1:
596              if out_sandbox != None:
597                  for fl in out_sandbox:
598                      out_box = out_box + ' "' + fl + '",'
# Line 467 | Line 604 | class SchedulerEdg(Scheduler):
604          out_box = out_box + ' };'
605          jdl.write(out_box+'\n')
606  
470        ### if at least a CE exists ...
471        if common.analisys_common_info['sites']:
472            if common.analisys_common_info['sw_version']:
473                req='Requirements = '
474                req=req + 'Member("VO-cms-' + \
475                     common.analisys_common_info['sw_version'] + \
476                     '", other.GlueHostApplicationSoftwareRunTimeEnvironment)'
477            if len(common.analisys_common_info['sites'])>0:
478                req = req + ' && ('
479                for i in range(len(common.analisys_common_info['sites'])):
480                    req = req + 'other.GlueCEInfoHostName == "' \
481                         + common.analisys_common_info['sites'][i] + '"'
482                    if ( i < (int(len(common.analisys_common_info['sites']) - 1)) ):
483                        req = req + ' || '
484            req = req + ')'
607  
608 <            #### and USER REQUIREMENT
609 <            if self.EDG_requirements:
608 >        req='Requirements = '
609 >        req = req + jbt.getRequirements()
610 > #        ### if at least a CE exists ...
611 > #        if common.analisys_common_info['sites']:
612 > #           if common.analisys_common_info['sw_version']:
613 > #                req='Requirements = '
614 > #                req=req + 'Member("VO-cms-' + \
615 > #                     common.analisys_common_info['sw_version'] + \
616 > #                     '", other.GlueHostApplicationSoftwareRunTimeEnvironment)'
617 > #            if len(common.analisys_common_info['sites'])>0:
618 > #                req = req + ' && ('
619 > #                for i in range(len(common.analisys_common_info['sites'])):
620 > #                    req = req + 'other.GlueCEInfoHostName == "' \
621 > #                         + common.analisys_common_info['sites'][i] + '"'
622 > #                    if ( i < (int(len(common.analisys_common_info['sites']) - 1)) ):
623 > #                        req = req + ' || '
624 > #            req = req + ')'
625 >        #### and USER REQUIREMENT
626 >        if self.EDG_requirements:
627 >            if (req == 'Requirement = '):
628 >                req = req + self.EDG_requirements
629 >            else:
630                  req = req +  ' && ' + self.EDG_requirements
631 <            if self.EDG_clock_time:
631 >        if self.EDG_clock_time:
632 >            if (req == 'Requirement = '):
633 >                req = req + 'other.GlueCEPolicyMaxWallClockTime>='+self.EDG_clock_time
634 >            else:
635                  req = req + ' && other.GlueCEPolicyMaxWallClockTime>='+self.EDG_clock_time
636 <            if self.EDG_cpu_time:
636 >                
637 >        if self.EDG_cpu_time:
638 >            if (req == 'Requirement = '):
639 >                req = req + ' other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time
640 >            else:
641                  req = req + ' && other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time
642 +        if (req != 'Requirement = '):
643              req = req + ';\n'
644              jdl.write(req)
645                                                                                                                                                              
# Line 510 | Line 660 | class SchedulerEdg(Scheduler):
660          timeleft = -999
661          minTimeLeft=10 # in hours
662          cmd = 'grid-proxy-info -e -v '+str(minTimeLeft)+':00'
663 <        try: cmd_out = runCommand(cmd,0)
664 <        except: print cmd_out
665 <        if (cmd_out == None or cmd_out=='1'):
663 >        # SL Here I have to use os.system since the stupid command exit with >0 if no valid proxy is found
664 >        cmd_out = os.system(cmd)
665 >        if (cmd_out>0):
666              common.logger.message( "No valid proxy found or timeleft too short!\n Creating a user proxy with default length of 100h\n")
667              cmd = 'grid-proxy-init -valid 100:00'
668              try:
669 +                # SL as above: damn it!
670                  out = os.system(cmd)
671                  if (out>0): raise CrabException("Unable to create a valid proxy!\n")
672              except:
673                  msg = "Unable to create a valid proxy!\n"
674                  raise CrabException(msg)
675 <            cmd = 'grid-proxy-info -timeleft'
676 <            cmd_out = runCommand(cmd,0)
526 <            #print cmd_out, time.time()
527 <            #time.time(cms_out)
675 >            # cmd = 'grid-proxy-info -timeleft'
676 >            # cmd_out = runCommand(cmd,0,20)
677              pass
678          self.proxyValid=1
679          return

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines