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.24 by fanzago, Tue Nov 8 14:34:35 2005 UTC vs.
Revision 1.29 by fanzago, Fri Nov 18 15:50:23 2005 UTC

# Line 147 | Line 147 | class SchedulerEdg(Scheduler):
147             txt += '#\n'
148             txt += '#   Copy output to SE = $SE\n'
149             txt += '#\n'
150           #### per orca l'exit_status non e' affidabile.....
151           #txt += 'if [ $executable_exit_status -eq 0 ]; then\n'
150             txt += 'if [ $exe_result -eq 0 ]; then\n'
151             txt += '  for out_file in $file_list ; do\n'
152             txt += '    echo "Trying to copy output file to $SE "\n'
# Line 176 | Line 174 | class SchedulerEdg(Scheduler):
174             txt += '#\n'
175             txt += '#  Register output to RLS\n'
176             txt += '#\n'
179           ### analogo
180           #txt += 'if [[ $executable_exit_status -eq 0 && $copy_exit_status -eq 0 ]]; then\n'
177             txt += 'if [[ $exe_result -eq 0 && $copy_exit_status -eq 0 ]]; then\n'
178             txt += '   for out_file in $file_list ; do\n'
179             txt += '      echo "Trying to register the output file into RLS"\n'
# Line 205 | Line 201 | class SchedulerEdg(Scheduler):
201             txt += '   echo "Trying to copy output file to CloseSE"\n'
202             txt += '   CLOSE_SE=`edg-brokerinfo getCloseSEs | head -1`\n'
203             txt += '   for out_file in $file_list ; do\n'
204 <           txt += '      echo "lcg-cr -v -l lfn:${LFN}/$out_file -d $SE -P $LFN/$out_file --vo $VO file://`pwd`/$out_file" \n'
205 <           txt += '      lcg-cr -v -l lfn:${LFN}/$out_file -d $SE -P $LFN/$out_file --vo $VO file://`pwd`/$out_file 2>&1 \n'
204 >           txt += '      echo "lcg-cr -v -l lfn:${LFN}/$out_file -d $CLOSE_SE -P $LFN/$out_file --vo $VO file://`pwd`/$out_file" \n'
205 >           txt += '      lcg-cr -v -l lfn:${LFN}/$out_file -d $CLOSE_SE -P $LFN/$out_file --vo $VO file://`pwd`/$out_file 2>&1 \n'
206             txt += '      register_exit_status=$?\n'
207             txt += '      echo "REGISTER_EXIT_STATUS = $register_exit_status"\n'
208             txt += '      echo "STAGE_OUT = $register_exit_status"\n'
# Line 222 | Line 218 | class SchedulerEdg(Scheduler):
218             txt += '   echo "Problem with the executable"\n'
219             txt += 'fi \n'
220          return txt
225        #####################
221  
222      def loggingInfo(self, id):
223          """
# Line 231 | Line 226 | class SchedulerEdg(Scheduler):
226          self.checkProxy()
227        #  id = common.jobDB.jobId(nj)
228          cmd = 'edg-job-get-logging-info -v 2 ' + id
229 <        cmd_out = runCommand(cmd)
230 <        print cmd_out
229 >        cmd_out = os.popen(cmd)
230 >      #  cmd_out = runCommand(cmd)
231          return cmd_out
232  
233      def listMatch(self, nj):
# Line 242 | Line 237 | class SchedulerEdg(Scheduler):
237          self.checkProxy()
238          jdl = common.job_list[nj].jdlFilename()
239          cmd = 'edg-job-list-match ' + self.configOpt_() + jdl
240 <        cmd_out = runCommand(cmd)
240 >        myCmd = os.popen(cmd)
241 >        cmd_out = myCmd.readlines()
242 >        myCmd.close()
243          return self.parseListMatch_(cmd_out, jdl)
244  
245      def parseListMatch_(self, out, jdl):
246 +
247          reComment = re.compile( r'^\**$' )
248          reEmptyLine = re.compile( r'^$' )
249          reVO = re.compile( r'Selected Virtual Organisation name.*' )
250 <        reCE = re.compile( r'CEId.*\n((.*:.*)\n)*' )
250 >        reCE = re.compile( r'CEId' )
251          reNO = re.compile( r'No Computing Element matching' )
252          reRB = re.compile( r'Connecting to host' )
253          next = 0
254          CEs=[]
255          Match=0
256  
257 <        if reNO.match( out ):
258 <            common.logger.debug(5,out)
259 <            self.noMatchFound_(jdl)
260 <            Match=0
261 <            pass
262 <        if reVO.match( out ):
263 <            VO =reVO.match( out ).group()
264 <            common.logger.debug(5, 'VO           :'+VO)
265 <            pass
266 <
267 <        if reRB.match( out ):
268 <            RB =reRB.match(out).group()
269 <            common.logger.debug(5, 'Using RB     :'+RB)
270 <            pass
271 <
272 <        if reCE.search( out ):
273 <            groups=reCE.search(out).groups()
274 <            for CE in groups:
275 <                tmp = string.strip(CE)
276 <                CEs.append(tmp)
277 <                common.logger.debug(5, 'Matched CE   :'+tmp)
278 <                Match=Match+1
279 <            pass
280 <
257 >        for line in out:
258 >            line = line.strip()
259 >            if reComment.match( line ):
260 >                next = 0
261 >                continue
262 >            if reEmptyLine.match(line):
263 >                continue
264 >            if reVO.match( line ):
265 >                VO =line.split()[-1]
266 >                common.logger.debug(5, 'VO           :'+VO)
267 >                pass
268 >            if reRB.match( line ):
269 >                RB =line.split()[3]
270 >                common.logger.debug(5, 'Using RB     :'+RB)
271 >                pass
272 >            if reCE.search( line ):
273 >                next = 1
274 >                continue
275 >            if next:
276 >                CE=line.split(':')[0]
277 >                if (CEs.count(CE) > 0):
278 >                   pass
279 >                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
288 >                pass
289          return Match
290  
291      def noMatchFound_(self, jdl):
# Line 343 | Line 349 | class SchedulerEdg(Scheduler):
349          jobStat.getStatus(id, level)
350          err, apiMsg = jobStat.get_error()
351          if err:
352 <            print 'Error caught', apiMsg
353 <            common.log.message(apiMsg)
352 >            #print 'Error caught', apiMsg
353 >            #common.log.message(apiMsg)
354 >            common.logger.debug(5,'Error caught' + apiMsg)
355              return None
356          else:
357              for i in range(len(self.states)):

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines