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.21 by slacapra, Fri Nov 4 13:48:10 2005 UTC vs.
Revision 1.22 by slacapra, Sat Nov 5 11:44:32 2005 UTC

# Line 231 | Line 231 | class SchedulerEdg(Scheduler):
231          self.checkProxy()
232          id = common.jobDB.jobId(nj)
233          cmd = 'edg-job-get-logging-info -v 2 ' + self.configOpt_() + id
234 <        myCmd = os.popen(cmd)
235 <        cmd_out = myCmd.readlines()
236 <        myCmd.close()
234 >        cmd_out = runCommand(cmd)
235          return cmd_out
236  
237      def listMatch(self, nj):
# Line 243 | Line 241 | class SchedulerEdg(Scheduler):
241          self.checkProxy()
242          jdl = common.job_list[nj].jdlFilename()
243          cmd = 'edg-job-list-match ' + self.configOpt_() + jdl
244 <        myCmd = os.popen(cmd)
247 <        cmd_out = myCmd.readlines()
248 <        myCmd.close()
244 >        cmd_out = runCommand(cmd)
245          return self.parseListMatch_(cmd_out, jdl)
246  
247      def parseListMatch_(self, out, jdl):
248          reComment = re.compile( r'^\**$' )
249          reEmptyLine = re.compile( r'^$' )
250          reVO = re.compile( r'Selected Virtual Organisation name.*' )
251 <        reCE = re.compile( r'CEId' )
251 >        reCE = re.compile( r'CEId.*\n((.*:.*)\n)*' )
252          reNO = re.compile( r'No Computing Element matching' )
253          reRB = re.compile( r'Connecting to host' )
254          next = 0
255          CEs=[]
256          Match=0
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 <                CEs.append(CE)
278 <                common.logger.debug(5, 'Matched CE   :'+CE)
257 >
258 >        if reNO.match( out ):
259 >            common.logger.debug(5,out)
260 >            self.noMatchFound_(jdl)
261 >            Match=0
262 >            pass
263 >        if reVO.match( out ):
264 >            VO =reVO.match( out ).group()
265 >            common.logger.debug(5, 'VO           :'+VO)
266 >            pass
267 >
268 >        if reRB.match( out ):
269 >            RB =reRB.match(out).group()
270 >            common.logger.debug(5, 'Using RB     :'+RB)
271 >            pass
272 >
273 >        if reCE.search( out ):
274 >            groups=reCE.search(out).groups()
275 >            for CE in groups:
276 >                tmp = string.strip(CE)
277 >                CEs.append(tmp)
278 >                common.logger.debug(5, 'Matched CE   :'+tmp)
279                  Match=Match+1
280 <                pass
281 <            if reNO.match( line ):
286 <                common.logger.debug(5,line)
287 <                self.noMatchFound_(jdl)
288 <                Match=0
289 <                pass
280 >            pass
281 >
282          return Match
283  
284      def noMatchFound_(self, jdl):

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines