Skip to content

Commit

Permalink
More rst into docstrings.
Browse files Browse the repository at this point in the history
  • Loading branch information
idlesign committed Jul 3, 2017
1 parent aa1593b commit a20b7bf
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 43 deletions.
2 changes: 1 addition & 1 deletion uwsgiconf/options/main_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def set_pid_file(self, fpath, before_privileges_drop=True):
def set_naming_params(self, autonaming=None, prefix=None, postfix=None, name=None):
"""Setups processes naming parameters.
:param bool autonaming: Automatically set process name to something meaningful
:param bool autonaming: Automatically set process name to something meaningful.
Generated process names may be 'uWSGI Master', 'uWSGI Worker #', etc.
:param str prefix: Add prefix to process names.
Expand Down
8 changes: 5 additions & 3 deletions uwsgiconf/options/master_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ class MasterProcess(OptionsGroup):
uWSGI's built-in prefork+threading multi-worker management mode,
activated by flicking the master switch on.
For all practical serving deployments it's not really a good idea not to use master mode.
.. note:: For all practical serving deployments it's not really a good idea not to use master mode.
"""

Expand All @@ -26,7 +27,8 @@ def set_basic_params(self, enabled=None, name=None, no_orphans=None, as_root=Non
:param int subproc_check_interval: Set the interval (in seconds) of master checks. Default: 1
The master process makes a scan of subprocesses, etc. every N seconds.
You can increase this time if you need to, but it's DISCOURAGED.
.. warning:: You can increase this time if you need to, but it's DISCOURAGED.
"""
self._set('master', enabled, cast=bool)
Expand All @@ -49,7 +51,7 @@ def add_cron_task(self, command, weekday=None, month=None, day=None, hour=None,
* Use - (minus) to make interval:
minute='13-18' stands for `from minute 13 to 18`
NOTE: We use cron2 option available since 1.9.11.
.. note:: We use cron2 option available since 1.9.11.
:param str|unicode command: Command to execute on schedule (with or without path).
Expand Down
47 changes: 25 additions & 22 deletions uwsgiconf/options/networking.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,42 @@ class Networking(OptionsGroup):
SOCK_HTTP11 = 'http11' # Keep-Alive

SOCK_UDP = 'upd'
"""run the udp server on the specified address
"""Run the udp server on the specified address.
Mainly useful for SNMP or shared UDP logging.
.. note:: Mainly useful for SNMP or shared UDP logging.
"""
SOCK_FASTCGI = 'fastcgi'
"""Bind to the specified socket using FastCGI"""
"""Bind to the specified socket using FastCGI."""

SOCK_SCGI = 'scgi'
"""bind to the specified UNIX/TCP socket using SCGI protocol"""
"""Bind to the specified UNIX/TCP socket using SCGI protocol."""

SOCK_RAW = 'raw'
"""bind to the specified UNIX/TCP socket using RAW protocol"""
"""Bind to the specified UNIX/TCP socket using RAW protocol."""

SOCK_SHARED = 'shared'
"""Create a shared socket for advanced jailing or IPC purposes
"""Create a shared socket for advanced jailing or IPC purposes.
Allows you to create a socket early in the server's startup
and use it after privileges drop or jailing. This can be used
to bind to privileged (<1024) ports.
"""
SOCK_ZERO_MQ = 'zmq'
"""zeromq pub/sub pair"""
"""Introduce zeromq pub/sub pair."""

SOCK__MODE_SSL = '+ssl'
MODE_SSL = '+ssl'
"""Use SSL."""

SOCK__MODE_NPH = '+nph'
"""bind to the specified UNIX/TCP socket (nph mode)"""
MODE_NPH = '+nph'
"""Bind to the specified UNIX/TCP socket using nph mode."""

SOCK__MODE_PERSISTENT = '+persistent'
"""persistent uwsgi protocol (puwsgi)"""
MODE_PERSISTENT = '+persistent'
"""Use persistent uwsgi protocol (puwsgi)."""

SOCK__MODE_UNDEFERRED = '+undeferred'
"""shared socket undeferred mode"""
MODE_UNDEFERRED = '+undeferred'
"""Use shared socket undeferred mode."""

def __init__(self, *args, **kwargs):
super(Networking, self).__init__(*args, **kwargs)
Expand All @@ -60,7 +61,9 @@ def set_basic_params(self, queue_size=None, freebind=None):
:param int queue_size: Every socket has an associated queue where request will be put waiting
for a process to became ready to accept them. When this queue is full, requests will be rejected.
Default 100. The maximum value is system/kernel dependent.
Default 100.
.. note:: The maximum value is system/kernel dependent.
:param bool freebind: Put socket in freebind mode (Linux only).
Allows binding to non-existent network addresses.
Expand Down Expand Up @@ -137,7 +140,7 @@ def register_socket(self, address='127.0.0.1:8000', type=SOCK_HTTP, mode=None, b
:param str type: Socket type. See Networking.SOCK_*
:param str mode: Socket mode. See Networking.SOCK__MODE*
:param str mode: Socket mode. See Networking.MODE_*
:param str|int|list bound_workers: Map socket to specific workers.
As you can bind a uWSGI instance to multiple sockets, you can use this option to map
Expand All @@ -152,21 +155,21 @@ def register_socket(self, address='127.0.0.1:8000', type=SOCK_HTTP, mode=None, b

param_name = {
self.SOCK_UWSGI: {
self.SOCK__MODE_SSL: 'suwsgi-socket',
self.SOCK__MODE_PERSISTENT: 'puwsgi-socket',
self.MODE_SSL: 'suwsgi-socket',
self.MODE_PERSISTENT: 'puwsgi-socket',
}.get(mode, 'uwsgi-socket'), # Default: Bind to the specified socket with default protocol (see `protocol`)

self.SOCK_HTTP: 'https-socket' if mode == self.SOCK__MODE_SSL else 'http-socket',
self.SOCK_HTTP: 'https-socket' if mode == self.MODE_SSL else 'http-socket',

self.SOCK_HTTP11: 'http11-socket',

self.SOCK_FASTCGI: 'fastcgi-nph-socket' if mode == self.SOCK__MODE_NPH else 'fastcgi-socket',
self.SOCK_FASTCGI: 'fastcgi-nph-socket' if mode == self.MODE_NPH else 'fastcgi-socket',

self.SOCK_SCGI: 'scgi-nph-socket' if mode == self.SOCK__MODE_NPH else 'scgi-socket',
self.SOCK_SCGI: 'scgi-nph-socket' if mode == self.MODE_NPH else 'scgi-socket',

self.SOCK_RAW: 'raw-socket',

self.SOCK_SHARED: 'undeferred-shared-socket' if mode == self.SOCK__MODE_UNDEFERRED else 'shared-socket',
self.SOCK_SHARED: 'undeferred-shared-socket' if mode == self.MODE_UNDEFERRED else 'shared-socket',

self.SOCK_UDP: 'upd',

Expand Down
32 changes: 17 additions & 15 deletions uwsgiconf/options/plugins/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ def set_basic_params(self, version=AUTO, python_home=None, enable_threads=None,
:param str|unicode|int version: Python version plugin supports.
Example:
3 - version 3
<empty> - version 2
<default> - version deduced by uwsgiconf
* 3 - version 3
* <empty> - version 2
* <default> - version deduced by uwsgiconf
:param str|unicode python_home: Set python executable directory - PYTHONHOME/virtualenv.
:param str|unicode search_path: Add directory (or an .egg or a glob) to the Python search path.
This can be specified up to 64 times.
.. note:: This can be specified up to 64 times.
:param str|unicode python_binary: Set python program name.
Expand All @@ -36,8 +37,9 @@ def set_basic_params(self, version=AUTO, python_home=None, enable_threads=None,
:param bool enable_threads: Enable threads in the embedded languages.
This will allow to spawn threads in your app.
Threads will simply *not work* if this option is not enabled. There will likely be no error,
just no execution of your thread code.
.. warning:: Threads will simply *not work* if this option is not enabled.
There will likely be no error, just no execution of your thread code.
"""
self.name = self.get_name(version)
Expand Down Expand Up @@ -69,7 +71,8 @@ def get_name(self, version):
def set_app_args(self, *args):
"""Sets ``sys.argv`` for python apps.
pyargv="one two three" will set ``sys.argv`` to ``('one', 'two', 'three')``.
Examples:
* pyargv="one two three" will set ``sys.argv`` to ``('one', 'two', 'three')``.
:param args:
"""
Expand All @@ -84,11 +87,12 @@ def set_wsgi_params(self, module=None, callable_name=None):
:param str|unicode module:
* load .wsgi file as the Python application
* load a WSGI module as the application.
The module (sans ``.py``) must be importable, ie. be in ``PYTHONPATH``.
Example:
mypackage.my_wsgi_module -- read from `application` attr of mypackage/my_wsgi_module.py
mypackage.my_wsgi_module:my_app -- read from `my_app` attr of mypackage/my_wsgi_module.py
.. note:: The module (sans ``.py``) must be importable, ie. be in ``PYTHONPATH``.
Examples:
* mypackage.my_wsgi_module -- read from `application` attr of mypackage/my_wsgi_module.py
* mypackage.my_wsgi_module:my_app -- read from `my_app` attr of mypackage/my_wsgi_module.py
:param str|unicode callable_name: Set WSGI callable name. Default: application.
Expand Down Expand Up @@ -117,11 +121,9 @@ def eval_wsgi_entrypoint(self, code):
def set_autoreload_params(self, scan_interval=None, ignore_modules=None):
"""Sets autoreload related parameters.
:param int scan_interval: Monitor Python modules' modification times to trigger reload.
WARNING: Use only in development!
:param int scan_interval: Seconds. Monitor Python modules' modification times to trigger reload.
Modification scan interval given in seconds.
.. warning:: Use only in development.
:param list|st|unicode ignore_modules: Ignore the specified module during auto-reload scan.
Expand Down
7 changes: 5 additions & 2 deletions uwsgiconf/options/workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,11 @@ def set_thread_params(self, enable_threads=None, per_worker=None, stack_size=Non
just no execution of your thread code.
:param int per_worker: Run each worker in prethreaded mode with the specified number
of threads per worker.\n\nDo not use with ``gevent``.
NOTE: Enables threads automatically.
of threads per worker.
.. warning:: Do not use with ``gevent``.
.. note:: Enables threads automatically.
:param int stack_size: Set threads stacksize.
Expand Down

0 comments on commit a20b7bf

Please sign in to comment.