vendor/zasync/1.1

changeset 2:54ec7753fe28 1.1-nux

Removed trailing whitespaces
author rspivak
date Tue, 10 Jan 2006 02:03:01 +0000
parents b6ca95992327
children 488e78888a0e
files client/zasync/client.py
diffstat 1 files changed, 25 insertions(+), 25 deletions(-) [+]
line diff
     1.1 --- a/client/zasync/client.py
     1.2 +++ b/client/zasync/client.py
     1.3 @@ -17,7 +17,7 @@
     1.4  
     1.5  # To do:
     1.6  # - on an exit (keyboard or system), try to stop polling but finish
     1.7 -#   processing remaining zope deferreds, if possible, at least just timing 
     1.8 +#   processing remaining zope deferreds, if possible, at least just timing
     1.9  #   out
    1.10  # - try to modify to use twistd so tools such as manhole work easily
    1.11  # - catch POSKeyErrors too; what the heck.
    1.12 @@ -71,13 +71,13 @@
    1.13  
    1.14  ### end configured
    1.15  
    1.16 -server_retries = [] # calls that need to be resumed once the ZEO server is 
    1.17 +server_retries = [] # calls that need to be resumed once the ZEO server is
    1.18                      # back
    1.19  
    1.20  tool_retries = {} # calls that need to be resumed once a tool is back ({tool
    1.21                    # path: [calls]})
    1.22  
    1.23 -active = {} # {zope deferred id: (original timeout, zasync deferred)} of calls 
    1.24 +active = {} # {zope deferred id: (original timeout, zasync deferred)} of calls
    1.25              # currently in process
    1.26  
    1.27  server_retry_start = None
    1.28 @@ -130,7 +130,7 @@
    1.29          logging.getLogger('zasync').critical(
    1.30              'disconnected from ZEO server; retrying.')
    1.31          # starting up a new backoff
    1.32 -        reactor.callLater(initial_retry_delay, 
    1.33 +        reactor.callLater(initial_retry_delay,
    1.34                            retryServer, initial_retry_delay)
    1.35  def is_connected():
    1.36      global DB
    1.37 @@ -164,7 +164,7 @@
    1.38              raise SystemExit('ZEO server unreachable')
    1.39          else:
    1.40              logging.getLogger('zasync').critical(
    1.41 -                'disconnected from ZEO server for %d seconds; retrying.', 
    1.42 +                'disconnected from ZEO server for %d seconds; retrying.',
    1.43                  seconds)
    1.44              reactor.callLater(delay, retryServer, delay)
    1.45  
    1.46 @@ -200,7 +200,7 @@
    1.47              transaction.commit()
    1.48          except ConflictError:
    1.49              logging.getLogger('zasync').info(
    1.50 -                'Received ConflictError while trying to retry tool; retrying.', 
    1.51 +                'Received ConflictError while trying to retry tool; retrying.',
    1.52                  exc_info=True)
    1.53              transaction.abort()
    1.54              reactor.callLater(delay, retryTool, path, delay)
    1.55 @@ -294,7 +294,7 @@
    1.56                          zopeDeferred.__of__(tool).errback(
    1.57                              failure.Failure(KeyError(name)))
    1.58                          continue
    1.59 -                    log.debug('got call for plugin %s (args %r; kwargs %r)', 
    1.60 +                    log.debug('got call for plugin %s (args %r; kwargs %r)',
    1.61                                name, args, kwargs)
    1.62                      zopeDeferredId = zopeDeferred.key
    1.63                      timeout = zopeDeferred.timeout
    1.64 @@ -302,8 +302,8 @@
    1.65                      if timeout is None or calltimeout < timeout:
    1.66                          zopeDeferred.timeout = calltimeout
    1.67                      reactor.callLater(
    1.68 -                        delay, makeCall, 
    1.69 -                        path, zopeDeferredId, name, args, kwargs, 
    1.70 +                        delay, makeCall,
    1.71 +                        path, zopeDeferredId, name, args, kwargs,
    1.72                          remainingSeconds, timeout)
    1.73                      delay += interval
    1.74                  bad = []
    1.75 @@ -311,7 +311,7 @@
    1.76                      zopeDeferred = tool.getDeferred(zopeDeferredId)
    1.77                      if zopeDeferred is None:
    1.78                          bad.append(zopeDeferredId)
    1.79 -                    elif (zopeDeferred.timeout < oldTimeout and 
    1.80 +                    elif (zopeDeferred.timeout < oldTimeout and
    1.81                          deferred.timeoutCall.active()):
    1.82                          deferred.timeoutCall.reset(
    1.83                              max(zopeDeferred.remainingSeconds(), 0))
    1.84 @@ -323,7 +323,7 @@
    1.85                  return
    1.86              except ConflictError:
    1.87                  transaction.abort()
    1.88 -                log.warning('ZODB ConflictError in pollZope.  Never give up.', 
    1.89 +                log.warning('ZODB ConflictError in pollZope.  Never give up.',
    1.90                              exc_info=True)
    1.91                  reactor.callLater(1, pollZope, path) # never give up
    1.92                  return
    1.93 @@ -345,7 +345,7 @@
    1.94      if isinstance(value, failure.Failure):
    1.95          cleanFailure(value)
    1.96      log = logging.getLogger('zasync')
    1.97 -    log.debug('returnResult got value for %s (%s):\n\n%r', 
    1.98 +    log.debug('returnResult got value for %s (%s):\n\n%r',
    1.99                zopeDeferredId, path, value)
   1.100      try:
   1.101          del active[zopeDeferredId]
   1.102 @@ -360,7 +360,7 @@
   1.103                      tool = getRequestApp(application).unrestrictedTraverse(path)
   1.104                  except (AttributeError, LookupError):
   1.105                      scheduleToolRetry(
   1.106 -                        path, returnResult, value, path, zopeDeferredId, 
   1.107 +                        path, returnResult, value, path, zopeDeferredId,
   1.108                          error, count)
   1.109                      return value
   1.110                  zopeDeferred = tool.getDeferred(zopeDeferredId)
   1.111 @@ -377,7 +377,7 @@
   1.112                  transaction.abort()
   1.113                  if count < max_conflict_resolution_attempts:
   1.114                      reactor.callLater(
   1.115 -                        count, returnResult, value, path, zopeDeferredId, 
   1.116 +                        count, returnResult, value, path, zopeDeferredId,
   1.117                          error, count+1)
   1.118                  else:
   1.119                      res = failure.Failure()
   1.120 @@ -388,7 +388,7 @@
   1.121                          'giving up.\n\n%s', out.getvalue())
   1.122              except ClientDisconnected:
   1.123                  scheduleServerRetry(
   1.124 -                    returnResult, value, path, zopeDeferredId, 
   1.125 +                    returnResult, value, path, zopeDeferredId,
   1.126                      error, count)
   1.127                  res = value
   1.128              except (KeyboardInterrupt, SystemExit):
   1.129 @@ -429,15 +429,15 @@
   1.130                  transaction.commit() # just in case plugin touched Zope:
   1.131                  # please do not!  Use zope_exec, or follow that pattern...
   1.132                  # If you do, and you start a conflict error, it may throw
   1.133 -                # the timeout check off.  Just don't, and regard this as 
   1.134 +                # the timeout check off.  Just don't, and regard this as
   1.135                  # paranoia.
   1.136              except ConflictError:
   1.137                  log.warning('ZODB ConflictError in makeCall', exc_info=True)
   1.138                  transaction.abort()
   1.139                  if count < max_conflict_resolution_attempts:
   1.140                      reactor.callLater(
   1.141 -                        count, makeCall, path, zopeDeferredId, 
   1.142 -                        name, args, kwargs, remainingSeconds, timeout, 
   1.143 +                        count, makeCall, path, zopeDeferredId,
   1.144 +                        name, args, kwargs, remainingSeconds, timeout,
   1.145                          returnResult, count+1)
   1.146                      return
   1.147                  else:
   1.148 @@ -450,7 +450,7 @@
   1.149                      # now we use that res (Failure)
   1.150              except ClientDisconnected:
   1.151                  scheduleServerRetry(
   1.152 -                    makeCall, path, zopeDeferredId, name, args, kwargs, 
   1.153 +                    makeCall, path, zopeDeferredId, name, args, kwargs,
   1.154                      remainingSeconds, timeout, returnResult, count)
   1.155                  return
   1.156              except (KeyboardInterrupt, SystemExit):
   1.157 @@ -460,7 +460,7 @@
   1.158                  res = failure.Failure()
   1.159          if isinstance(res, defer.Deferred):
   1.160              res.timeoutCall = reactor.callLater(
   1.161 -                max(remainingSeconds, 0), 
   1.162 +                max(remainingSeconds, 0),
   1.163                  timeoutErrback, res)
   1.164              res.addBoth(cancelDelayedCall, res.timeoutCall)
   1.165              active[zopeDeferredId] = (timeout, res)
   1.166 @@ -475,7 +475,7 @@
   1.167              reactor.callLater(0, returnResult, res, path, zopeDeferredId)
   1.168      else:
   1.169          scheduleServerRetry(
   1.170 -            makeCall, path, zopeDeferredId, name, args, kwargs, 
   1.171 +            makeCall, path, zopeDeferredId, name, args, kwargs,
   1.172              remainingSeconds, timeout, returnResult, count)
   1.173  
   1.174  def stop(ignored=None):
   1.175 @@ -540,15 +540,15 @@
   1.176                  scheduleToolRetry(path, handlePastCalls, path, count)
   1.177                  return
   1.178              else:
   1.179 -                info = [(d.getSignature(), d.key, 
   1.180 -                         d.remainingSeconds(), d.timeout) for d in 
   1.181 +                info = [(d.getSignature(), d.key,
   1.182 +                         d.remainingSeconds(), d.timeout) for d in
   1.183                          tool.getAcceptedCalls()]
   1.184                  transaction.commit()
   1.185          except ConflictError:
   1.186              transaction.abort()
   1.187              if count==max_conflict_resolution_attempts-1:
   1.188                  log.critical(
   1.189 -                    "Too many conflicts trying to handlePastCalls!", 
   1.190 +                    "Too many conflicts trying to handlePastCalls!",
   1.191                      exc_info=True)
   1.192                  raise SystemExit("Too many conflicts trying to handlePastCalls")
   1.193              else:
   1.194 @@ -579,7 +579,7 @@
   1.195                  else:
   1.196                      reactor.callLater(
   1.197                          0,
   1.198 -                        returnResult, 
   1.199 +                        returnResult,
   1.200                          failure.Failure(
   1.201                              defer.TimeoutError(
   1.202                                  'zasync was disconnected (now reconnected)')),