Re: [web2py] Re: Rocket 1.2

2010-12-03 Thread Jonathan Lundell
On Dec 3, 2010, at 9:32 AM, Fran wrote:
 
 On Dec 3, 6:17 am, Jonathan Lundell jlund...@pobox.com wrote:
 Rocket 1.2.0 (web2py's embedded web server) is now in the trunk.
 It have various improvements, which perhaps Tim will describe. There is one 
 user-visible interface change that might affect some of you. In the previous 
 version, Rocket's min_threads and max_threads were 10 and 1024 respectively. 
 The cli (and winservice options) --numthreads option allowed the user to 
 override min_threads.
 In the new version, the Rocket defaults are 10 and 0 (meaning no upper 
 limit), and the cli options are --minthreads and --maxthreads (--numthreads 
 is provided for compatibility, meaning the same as --minthreads, but is 
 deprecated).
 If you're running CPython, my impression is that you need to do nothing, and 
 if you've been ignoring thread-count options, also do nothing. If you've 
 been patching maxthreads, the new default of 0 may work fine for you, and 
 if not you now have command-line access to it. Tim suggests increasing 
 minthreads to 64 for a production server.
 If you're running winservice, numthreads is now ignored; you must use 
 minthreads and maxthreads (assuming that you want something other than the 
 defaults).
 
 Sounds good...however my Windows service no longer starts as of this
 version:
 Traceback (most recent call last):
  File C:\Bin\web2py\gluon\winservice.py, line 46, in SvcDoRun
self.start()
  File C:\Bin\web2py\gluon\winservice.py, line 113, in start
min_threads=options.minthreads,
 AttributeError: 'module' object has no attribute 'minthreads'
 
 My options.py has numthreads = 10 still (I see options_std.py still
 just has numthreads not minthreads) but it's supposed to be backward-
 compatible anyway.
 Python 2.6.6
 
 Do I need to add --minthreads 10 to my registry (currently just has
 'web2py options')
 
 Meanwhile:
 bzr revert -r 2688

I should have mentioned that I didn't test with winservice, and I now see that 
options_std.py needs to be updated, as well as any derived options.py.

I'll send Massimo a patch to for winservice backwards compatibility, but in the 
meantime, add minthreads=None and maxthreads=None to options.py, and remove the 
numthreads line.

Re: [web2py] Re: Rocket 1.2

2010-12-03 Thread Jonathan Lundell
On Dec 3, 2010, at 9:32 AM, Fran wrote:
 
 On Dec 3, 6:17 am, Jonathan Lundell jlund...@pobox.com wrote:
 Rocket 1.2.0 (web2py's embedded web server) is now in the trunk.
 It have various improvements, which perhaps Tim will describe. There is one 
 user-visible interface change that might affect some of you. In the previous 
 version, Rocket's min_threads and max_threads were 10 and 1024 respectively. 
 The cli (and winservice options) --numthreads option allowed the user to 
 override min_threads.
 In the new version, the Rocket defaults are 10 and 0 (meaning no upper 
 limit), and the cli options are --minthreads and --maxthreads (--numthreads 
 is provided for compatibility, meaning the same as --minthreads, but is 
 deprecated).
 If you're running CPython, my impression is that you need to do nothing, and 
 if you've been ignoring thread-count options, also do nothing. If you've 
 been patching maxthreads, the new default of 0 may work fine for you, and 
 if not you now have command-line access to it. Tim suggests increasing 
 minthreads to 64 for a production server.
 If you're running winservice, numthreads is now ignored; you must use 
 minthreads and maxthreads (assuming that you want something other than the 
 defaults).
 
 Sounds good...however my Windows service no longer starts as of this
 version:
 Traceback (most recent call last):
  File C:\Bin\web2py\gluon\winservice.py, line 46, in SvcDoRun
self.start()
  File C:\Bin\web2py\gluon\winservice.py, line 113, in start
min_threads=options.minthreads,
 AttributeError: 'module' object has no attribute 'minthreads'
 
 My options.py has numthreads = 10 still (I see options_std.py still
 just has numthreads not minthreads) but it's supposed to be backward-
 compatible anyway.

I sent Massimo a patch that will retain backward compatibility.

However, users of winservice should add:

minthreads = None
maxthreads = None

to their options.py. You can leave numthreads there for compatibility with 
older versions, but it can be deleted for the new version once that 
compatibility is unneeded.

Re: [web2py] Re: Rocket 1.2

2010-12-03 Thread Jonathan Lundell
On Dec 3, 2010, at 11:20 AM, Fran wrote:
 
 On Dec 3, 6:20 pm, Jonathan Lundell jlund...@pobox.com wrote:
 I sent Massimo a patch that will retain backward compatibility.
 
 Thanks but not quite yet:
 Traceback (most recent call last):
 File C:\Bin\web2py\gluon\winservice.py, line 46, in SvcDoRun
 self.start()
 File C:\Bin\web2py\gluon\winservice.py, line 103, in start
 if options.get('numthreads') is not None and
 options.get('minthreads') is None:
 AttributeError: 'module' object has no attribute 'get'

Crap. OK, thanks; I'll take another look. If it's convenient, could you probe a 
little and tell me what exactly options is? I assumed it was a dict, but 
apparently not.

Re: [web2py] Re: Rocket 1.2

2010-12-03 Thread Jonathan Lundell
On Dec 3, 2010, at 11:27 AM, Jonathan Lundell wrote:
 
 On Dec 3, 2010, at 11:20 AM, Fran wrote:
 
 On Dec 3, 6:20 pm, Jonathan Lundell jlund...@pobox.com wrote:
 I sent Massimo a patch that will retain backward compatibility.
 
 Thanks but not quite yet:
 Traceback (most recent call last):
 File C:\Bin\web2py\gluon\winservice.py, line 46, in SvcDoRun
 self.start()
 File C:\Bin\web2py\gluon\winservice.py, line 103, in start
 if options.get('numthreads') is not None and
 options.get('minthreads') is None:
 AttributeError: 'module' object has no attribute 'get'
 
 Crap. OK, thanks; I'll take another look. If it's convenient, could you probe 
 a little and tell me what exactly options is? I assumed it was a dict, but 
 apparently not.

Never mind, I figured it out. One more patch coming.

Re: [web2py] Re: Rocket 1.2

2010-12-03 Thread Jonathan Lundell
On Dec 3, 2010, at 11:32 AM, Jonathan Lundell wrote:
 
 On Dec 3, 2010, at 11:27 AM, Jonathan Lundell wrote:
 
 On Dec 3, 2010, at 11:20 AM, Fran wrote:
 
 On Dec 3, 6:20 pm, Jonathan Lundell jlund...@pobox.com wrote:
 I sent Massimo a patch that will retain backward compatibility.
 
 Thanks but not quite yet:
 Traceback (most recent call last):
 File C:\Bin\web2py\gluon\winservice.py, line 46, in SvcDoRun
 self.start()
 File C:\Bin\web2py\gluon\winservice.py, line 103, in start
 if options.get('numthreads') is not None and
 options.get('minthreads') is None:
 AttributeError: 'module' object has no attribute 'get'
 
 Crap. OK, thanks; I'll take another look. If it's convenient, could you 
 probe a little and tell me what exactly options is? I assumed it was a dict, 
 but apparently not.
 
 Never mind, I figured it out. One more patch coming.

A patch is on its way to Massimo. In the meantime, here's the relevant section 
of winservice.py if you want to try it out. Let me know. (If you define both 
minthreads and maxthreads in options.py, you can change if True to if False 
and avoid the legacy logic altogether, but please try it first as-is.)

options = __import__(opt_mod, [], [], '')
if True: # legacy support for old options files, which have only 
(deprecated) numthreads
if hasattr(options, 'numthreads') and not hasattr(options, 
'minthreads'):
options.minthreads = options.numthreads
if not hasattr(options, 'minthreads'): options.minthreads = None
if not hasattr(options, 'maxthreads'): options.maxthreads = None
import main
self.server = main.HttpServer(
ip=options.ip,
port=options.port,
password=options.password,
pid_filename=options.pid_filename,
log_filename=options.log_filename,
profiler_filename=options.profiler_filename,
ssl_certificate=options.ssl_certificate,
ssl_private_key=options.ssl_private_key,
min_threads=options.minthreads,
max_threads=options.maxthreads,
server_name=options.server_name,
request_queue_size=options.request_queue_size,
timeout=options.timeout,
shutdown_timeout=options.shutdown_timeout,
path=options.folder
)



Re: [web2py] Re: Rocket 1.2

2010-12-03 Thread Jonathan Lundell
On Dec 3, 2010, at 1:24 PM, Fran wrote:
 
 On Dec 3, 7:39 pm, Jonathan Lundell jlund...@pobox.com wrote:
 A patch is on its way to Massimo.
 
 Works a treat :)
 No need to touch options.py - phew :)
 
 Many thanks,

Glad to help. Sorry for the initial confusion, but I suppose that's why the 
trunk isn't stable

I'd update options.py eventually, if I were you.