If possible use a function based on inspect.signature to calculate the
arity. If inspect.signature is not available fall back to getargspec. The
version based on inspect.signature looks like more code but is actually a
subset of what inspect.getfullargspec does.
html.escape is preferred over cgi.escape primarily because it defaults quote
to True. For this reason pass quote=True to cgi.escape when used.
The current documentation makes a reader believe that the setting is ignored if the worker type is not Gthread. That is not the case since if the worker is `sync`, a `threads` setting of > 1 sets the worker type to `gthread`.
I know this was probably done to support running gunicorn as `gunicorn --threads=4` and actually have threads even though the default worker is `sync`, but it can be confusing if running `gunicorn --worker-class sync --threads 4` and expecting the parameter will be ignored.
https://pypi.python.org/pypi/vulture
In particular the removal of `get_maxfd()` means the `resource` module
is no longer required (which is not available on Windows) and so helps
with #524.
Currently, gunicorn automatically uses the preferred reloader (inotify
if present with fallback to polling). However, it would be useful in
some scenarios if users could force polling.
The solution for this is to add a new configuration option called
'reload_engine' which takes one of three options: ['auto', 'poll',
'inotify'].
Fixes#1459
This is similar to worker_exit() in that it is called just after a
worker has terminated, but it's called in the Gunicorn *master* process,
not the *child* process.
* Fix validate_reload by returning the validated value
When '--reload=RELOADER_TYPE' was implemented, `validate_reload()` was
added but in one of the last refactorings, it lost the return statement
at the end of the function. As a result, the '--reload' config value was
totally broken.
This resolves the issue by adding the missing return.
* Fix tests by changing --reload to always require an argument
- '--reload' always requires an argument now
- Added 'auto' as the default value for '--reload'
--reload = Runs the reloader with inotify if available and falls back on
FS polling.
--reload=inotify = Forces the reloader to run with inotify
--reload=poll = Forces the reloader to use FS polling
Currently, '--reload' uses FS polling to find out when files have
changed. For some time, the Linux kernel has had a feature called
inotify that allows applications to monitor for FS events without
polling.
This commit adds a new 'use-inotify' configuration option that will
cause gunicorn to use the new 'InotifyReloader' instead of the default
'Reloader' when 'reload' is enabled.
Using inotify can result in lower CPU consumption by gunicorn especially
when working with virtualized filesystems or environments with a large
number of watched files / directories.