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

Comparing COMP/CRAB/python/SubmitterServer.py (file contents):
Revision 1.89 by mcinquil, Tue Oct 27 13:49:04 2009 UTC vs.
Revision 1.90 by farinafa, Thu Oct 29 18:01:48 2009 UTC

# Line 5 | Line 5 | from ApmonIf import ApmonIf
5  
6   import os, errno, time, sys, re
7   import commands, traceback
8 < import zlib
8 > import zlib, base64
9  
10   from Submitter import Submitter
11   from ServerCommunicator import ServerCommunicator
# Line 230 | Line 230 | class SubmitterServer( Submitter ):
230          return
231  
232  
233 +    def checkIfDrained(self, csCommunicator):
234 +        isDrained = False
235 +
236 +        try:
237 +            drainStatus = csCommunicator.checkDrainMode(self.taskuuid)
238 +            drainStatus += "="*( len(drainStatus)%8 )
239 +            drainStatus = zlib.decompress( base64.urlsafe_b64decode(drainStatus) )
240 +            isDrained = ( drainStatus == "true")
241 +        except Exception, e:
242 +            common.logger.debug("Problem while checking server drain mode. The server will be assumed as available.")
243 +            common.logger.debug( traceback.format_exc() )
244 +            isDrained = False
245 +
246 +        if isDrained == True:
247 +           msg = "Server is in Drain mode. Unable to submit new tasks."
248 +           raise CrabException(msg)
249 +
250 +        return isDrained
251 +
252      def manageCredential(self):
253          """
254          Prepare configuration and Call credential API
# Line 291 | Line 310 | class SubmitterServer( Submitter ):
310          self.cfg_params['CRAB.se_remote_dir'] = self.remotedir
311  
312          if firstSubmission==True:
313 +            # check if the server is in drain mode
314 +            if self.checkIfDrained(csCommunicator)==True:
315 +                return
316  
317              TotJob = common._db.nJobs()
318              # move the sandbox

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines