Changeset 14:38fc972c06c7

Show
Ignore:
Timestamp:
05/18/05 12:59:02 (3 years ago)
Author:
Allan Saddi <allan@saddi.com>
branch:
default
convert_revision:
svn:46762da8-4eb7-0310-94e9-d918b60927c8/flup/trunk@1786
Message:

Change threaded servers so wsgi.multiprocess is False by default.
Allow it to be changed by keyword argument.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ChangeLog

    r13 r14  
    112005-05-18  Allan Saddi  <asaddi@ganymede.saddi.net> 
    22 
     3        * Change threaded servers so wsgi.multiprocess is False by default. 
     4          Allow it to be changed by keyword argument. 
    35        * Fix wsgi.multiprocess for scgi_fork. (Set to True.) 
    46 
  • flup/server/ajp.py

    r2 r14  
    102102    """ 
    103103    def __init__(self, application, scriptName='', environ=None, 
    104                  multithreaded=True, 
     104                 multithreaded=True, multiprocess=False, 
    105105                 bindAddress=('localhost', 8009), allowedServers=None, 
    106106                 loggingLevel=logging.INFO, **kw): 
     
    129129                               environ=environ, 
    130130                               multithreaded=multithreaded, 
     131                               multiprocess=multiprocess, 
    131132                               bindAddress=bindAddress, 
    132133                               allowedServers=allowedServers, 
  • flup/server/ajp_base.py

    r2 r14  
    758758 
    759759    def __init__(self, application, scriptName='', environ=None, 
    760                  multithreaded=True, 
     760                 multithreaded=True, multiprocess=False, 
    761761                 bindAddress=('localhost', 8009), allowedServers=None, 
    762762                 loggingLevel=logging.INFO): 
     
    772772        Set multithreaded to False if your application is not thread-safe. 
    773773 
     774        Set multiprocess to True to explicitly set wsgi.multiprocess to 
     775        True. (Only makes sense with threaded servers.) 
     776 
    774777        bindAddress is the address to bind to, which must be a tuple of 
    775778        length 2. The first element is a string, which is the host name 
     
    790793        self.environ = environ 
    791794        self.multithreaded = multithreaded 
     795        self.multiprocess = multiprocess 
    792796        self._bindAddress = bindAddress 
    793797        self._allowedServers = allowedServers 
     
    830834        environ['wsgi.errors'] = sys.stderr 
    831835        environ['wsgi.multithread'] = self.multithreaded 
    832         environ['wsgi.multiprocess'] = True 
     836        environ['wsgi.multiprocess'] = self.multiprocess 
    833837        environ['wsgi.run_once'] = False 
    834838 
  • flup/server/ajp_fork.py

    r2 r14  
    128128                               environ=environ, 
    129129                               multithreaded=False, 
     130                               multiprocess=True, 
    130131                               bindAddress=bindAddress, 
    131132                               allowedServers=allowedServers, 
    132133                               loggingLevel=loggingLevel) 
    133         for key in ('multithreaded', 'jobClass', 'jobArgs'): 
     134        for key in ('multithreaded', 'multiprocess', 'jobClass', 'jobArgs'): 
    134135            if kw.has_key(key): 
    135136                del kw[key] 
  • flup/server/fcgi.py

    r7 r14  
    6363    """ 
    6464    def __init__(self, application, environ=None, 
    65                  multithreaded=True, 
     65                 multithreaded=True, multiprocess=False, 
    6666                 bindAddress=None, multiplexed=False, **kw): 
    6767        """ 
     
    8282                                environ=environ, 
    8383                                multithreaded=multithreaded, 
     84                                multiprocess=multiprocess, 
    8485                                bindAddress=bindAddress, 
    8586                                multiplexed=multiplexed) 
  • flup/server/fcgi_base.py

    r2 r14  
    883883    inputStreamShrinkThreshold = 102400 - 8192 
    884884 
    885     def __init__(self, application, environ=None, multithreaded=True, 
     885    def __init__(self, application, environ=None, 
     886                 multithreaded=True, multiprocess=False, 
    886887                 bindAddress=None, multiplexed=False): 
    887888        """ 
     
    908909        self.environ = environ 
    909910        self.multithreaded = multithreaded 
     911        self.multiprocess = multiprocess 
    910912 
    911913        self._bindAddress = bindAddress 
     
    10101012        environ['wsgi.multithread'] = not isinstance(req, CGIRequest) and \ 
    10111013                                      thread_available and self.multithreaded 
    1012         # Rationale for the following: If started by the web server 
    1013         # (self._bindAddress is None) in either FastCGI or CGI mode, the 
    1014         # possibility of being spawned multiple times simultaneously is quite 
    1015         # real. And, if started as an external server, multiple copies may be 
    1016         # spawned for load-balancing/redundancy. (Though I don't think 
    1017         # mod_fastcgi supports this?) 
    1018         environ['wsgi.multiprocess'] = True 
     1014        environ['wsgi.multiprocess'] = isinstance(req, CGIRequest) or \ 
     1015                                       self.multiprocess 
    10191016        environ['wsgi.run_once'] = isinstance(req, CGIRequest) 
    10201017 
  • flup/server/fcgi_fork.py

    r7 r14  
    8282                                environ=environ, 
    8383                                multithreaded=False, 
     84                                multiprocess=True, 
    8485                                bindAddress=bindAddress, 
    8586                                multiplexed=multiplexed) 
    86         for key in ('multithreaded', 'jobClass', 'jobArgs'): 
     87        for key in ('multithreaded', 'multiprocess', 'jobClass', 'jobArgs'): 
    8788            if kw.has_key(key): 
    8889                del kw[key] 
  • flup/server/scgi.py

    r9 r14  
    8989    """ 
    9090    def __init__(self, application, scriptName='', environ=None, 
    91                  multithreaded=True, 
     91                 multithreaded=True, multiprocess=False, 
    9292                 bindAddress=('localhost', 4000), allowedServers=None, 
    9393                 loggingLevel=logging.INFO, **kw): 
     
    116116                                environ=environ, 
    117117                                multithreaded=multithreaded, 
     118                                multiprocess=multiprocess, 
    118119                                bindAddress=bindAddress, 
    119120                                allowedServers=allowedServers, 
  • flup/server/scgi_base.py

    r13 r14  
    268268    requestClass = Request 
    269269 
    270     # AFAIK, the current mod_scgi does not do load-balancing/fail-over. 
    271     # So a single application deployment will only run in one process 
    272     # at a time, on this server (when using a threaded server, of course). 
    273     _multiprocess = False 
    274  
    275270    def __init__(self, application, scriptName='', environ=None, 
    276                  multithreaded=True, 
     271                 multithreaded=True, multiprocess=False, 
    277272                 bindAddress=('localhost', 4000), allowedServers=None, 
    278273                 loggingLevel=logging.INFO): 
     
    288283        Set multithreaded to False if your application is not thread-safe. 
    289284 
     285        Set multiprocess to True to explicitly set wsgi.multiprocess to 
     286        True. (Only makes sense with threaded servers.) 
     287 
    290288        bindAddress is the address to bind to, which must be a tuple of 
    291289        length 2. The first element is a string, which is the host name 
     
    306304        self.environ = environ 
    307305        self.multithreaded = multithreaded 
     306        self.multiprocess = multiprocess 
    308307        self._bindAddress = bindAddress 
    309308        self._allowedServers = allowedServers 
     
    346345        environ['wsgi.errors'] = sys.stderr 
    347346        environ['wsgi.multithread'] = self.multithreaded 
    348         environ['wsgi.multiprocess'] = self._multiprocess 
     347        environ['wsgi.multiprocess'] = self.multiprocess 
    349348        environ['wsgi.run_once'] = False 
    350349 
  • flup/server/scgi_fork.py

    r13 r14  
    7373 
    7474class WSGIServer(BaseSCGIServer, PreforkServer): 
    75     _multiprocess = True 
    76  
    7775    """ 
    7876    SCGI/WSGI server. For information about SCGI (Simple Common Gateway 
     
    117115                                environ=environ, 
    118116                                multithreaded=False, 
     117                                multiprocess=True, 
    119118                                bindAddress=bindAddress, 
    120119                                allowedServers=allowedServers, 
    121120                                loggingLevel=loggingLevel) 
    122         for key in ('multithreaded', 'jobClass', 'jobArgs'): 
     121        for key in ('multithreaded', 'multiprocess', 'jobClass', 'jobArgs'): 
    123122            if kw.has_key(key): 
    124123                del kw[key]