signature
stringlengths
8
3.44k
body
stringlengths
0
1.41M
docstring
stringlengths
1
122k
id
stringlengths
5
17
def __init__(self, on=None, device=None, stats_server=None, gateway=None):
super(RouterTunTap, self).__init__()<EOL>if on is not None:<EOL><INDENT>value = [device or '<STR_LIT>', on]<EOL>if stats_server:<EOL><INDENT>value.append(stats_server)<EOL>if gateway:<EOL><INDENT>value.append(gateway)<EOL><DEDENT><DEDENT>self._set_aliased('<STR_LIT>', '<STR_LIT:U+0020>'.join(value), multi=True)<EOL><DE...
Passing params will create a router device. :param str|unicode on: Socket file. :param str|unicode device: Device name. :param str|unicode stats_server: Router stats server address to run at. :param str|unicode gateway: Gateway address.
f13062:c15:m0
def set_basic_params(self, use_credentials=None, stats_server=None):
self._set_aliased('<STR_LIT>', use_credentials)<EOL>self._set_aliased('<STR_LIT>', stats_server)<EOL>return self<EOL>
:param str|unicode use_credentials: Enable check of SCM_CREDENTIALS for tuntap client/server. :param str|unicode stats_server: Router stats server address to run at.
f13062:c15:m1
def register_route(self, src, dst, gateway):
self._set_aliased('<STR_LIT>', '<STR_LIT:U+0020>'.join((src, dst, gateway)), multi=True)<EOL>return self<EOL>
Adds a routing rule to the tuntap router. :param str|unicode src: Source/mask. :param str|unicode dst: Destination/mask. :param str|unicode gateway: Gateway address.
f13062:c15:m2
def device_connect(self, socket, device_name):
self._set_aliased('<STR_LIT>', '<STR_LIT>' % (device_name, socket))<EOL>return self<EOL>
Add a tuntap device to the instance. To be used in a vassal. :param str|unicode socket: Router socket. Example: `/run/tuntap_router.socket`. :param str|unicode device_name: Device. Example: `uwsgi0`.
f13062:c15:m3
def device_add_rule(self, direction, action, src, dst, target=None):
value = [direction, src, dst, action]<EOL>if target:<EOL><INDENT>value.append(target)<EOL><DEDENT>self._set_aliased('<STR_LIT>', '<STR_LIT:U+0020>'.join(value), multi=True)<EOL>return self<EOL>
Adds a tuntap device rule. To be used in a vassal. :param str|unicode direction: Direction: * in * out. :param str|unicode action: Action: * allow * deny * route * gateway. :param str|unicode src: Source/mask. ...
f13062:c15:m4
def add_firewall_rule(self, direction, action, src=None, dst=None):
value = [action]<EOL>if src:<EOL><INDENT>value.extend((src, dst))<EOL><DEDENT>self._set_aliased('<STR_LIT>' % direction.lower(), '<STR_LIT:U+0020>'.join(value), multi=True)<EOL>return self<EOL>
Adds a firewall rule to the router. The TunTap router includes a very simple firewall for governing vassal's traffic. The first matching rule stops the chain, if no rule applies, the policy is "allow". :param str|unicode direction: Direction: * in * out :param...
f13062:c15:m5
def set_basic_params(<EOL>self, version=AUTO, python_home=None, enable_threads=None, search_path=None,<EOL>python_binary=None, tracebacker_path=None, plugin_dir=None, os_env_reload=None,<EOL>optimization_level=None):
self._set_name(version)<EOL>self._section.workers.set_thread_params(enable=enable_threads)<EOL>self._set('<STR_LIT>', tracebacker_path)<EOL>self._set('<STR_LIT>', python_binary)<EOL>self._set('<STR_LIT>', python_home)<EOL>self._set('<STR_LIT>', search_path, multi=True)<EOL>self._set('<STR_LIT>', os_env_reload, cast=boo...
:param str|unicode|int version: Python version plugin supports. Example: * 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 ...
f13063:c0:m0
def _set_name(self, version=AUTO):
name = '<STR_LIT>'<EOL>if version:<EOL><INDENT>if version is AUTO:<EOL><INDENT>version = sys.version_info[<NUM_LIT:0>]<EOL>if version == <NUM_LIT:2>:<EOL><INDENT>version = '<STR_LIT>'<EOL><DEDENT><DEDENT>name = '<STR_LIT>' % (name, version)<EOL><DEDENT>self.name = name<EOL>
Returns plugin name.
f13063:c0:m1
def set_app_args(self, *args):
if args:<EOL><INDENT>self._set('<STR_LIT>', '<STR_LIT:U+0020>'.join(args))<EOL><DEDENT>return self._section<EOL>
Sets ``sys.argv`` for python apps. Examples: * pyargv="one two three" will set ``sys.argv`` to ``('one', 'two', 'three')``. :param args:
f13063:c0:m3
def set_wsgi_params(self, module=None, callable_name=None, env_strategy=None):
module = module or '<STR_LIT>'<EOL>if '<STR_LIT:/>' in module:<EOL><INDENT>self._set('<STR_LIT>', module, condition=module)<EOL><DEDENT>else:<EOL><INDENT>self._set('<STR_LIT>', module, condition=module)<EOL><DEDENT>self._set('<STR_LIT>', callable_name)<EOL>self._set('<STR_LIT>', env_strategy)<EOL>return self._section<E...
Set wsgi related parameters. :param str|unicode module: * load .wsgi file as the Python application * load a WSGI module as the application. .. note:: The module (sans ``.py``) must be importable, ie. be in ``PYTHONPATH``. Examples: * mypackage....
f13063:c0:m4
def eval_wsgi_entrypoint(self, code):
self._set('<STR_LIT>', code)<EOL>return self._section<EOL>
Evaluates Python code as WSGI entry point. :param str|unicode code:
f13063:c0:m5
def set_autoreload_params(self, scan_interval=None, ignore_modules=None):
self._set('<STR_LIT>', scan_interval)<EOL>self._set('<STR_LIT>', ignore_modules, multi=True)<EOL>return self._section<EOL>
Sets autoreload related parameters. :param int scan_interval: Seconds. Monitor Python modules' modification times to trigger reload. .. warning:: Use only in development. :param list|st|unicode ignore_modules: Ignore the specified module during auto-reload scan.
f13063:c0:m6
def register_module_alias(self, alias, module_path, after_init=False):
command = '<STR_LIT>' if after_init else '<STR_LIT>'<EOL>self._set(command, '<STR_LIT>' % (alias, module_path), multi=True)<EOL>return self._section<EOL>
Adds an alias for a module. http://uwsgi-docs.readthedocs.io/en/latest/PythonModuleAlias.html :param str|unicode alias: :param str|unicode module_path: :param bool after_init: add a python module alias after uwsgi module initialization
f13063:c0:m7
def import_module(self, modules, shared=False, into_spooler=False):
if all((shared, into_spooler)):<EOL><INDENT>raise ConfigurationError('<STR_LIT>')<EOL><DEDENT>if into_spooler:<EOL><INDENT>command = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>command = '<STR_LIT>' if shared else '<STR_LIT>'<EOL><DEDENT>self._set(command, modules, multi=True)<EOL>return self._section<EOL>
Imports a python module. :param list|str|unicode modules: :param bool shared: Import a python module in all of the processes. This is done after fork but before request processing. :param bool into_spooler: Import a python module in the spooler. http://uwsgi-docs.readt...
f13063:c0:m8
def run_module(self, module):
self._set('<STR_LIT>', module)<EOL>return self._section<EOL>
Runs a Python script in the uWSGI environment. :param str|unicode module:
f13063:c0:m9
def set_basic_params(<EOL>self, exit_if_none=None, max_per_worker=None, single_interpreter=None, no_default=None,<EOL>manage_script_name=None):
self._set('<STR_LIT>', exit_if_none, cast=bool)<EOL>self._set('<STR_LIT>', max_per_worker)<EOL>self._set('<STR_LIT>', single_interpreter, cast=bool)<EOL>self._set('<STR_LIT>', no_default, cast=bool)<EOL>self._set('<STR_LIT>', manage_script_name, cast=bool)<EOL>return self._section<EOL>
:param bool exit_if_none: Exit if no app can be loaded. :param int max_per_worker: Set the maximum number of per-worker applications. :param bool single_interpreter: Do not use multiple interpreters (where available). Some of the supported languages (such as Python) have the concept of "multiple interpreters". ...
f13064:c0:m0
def mount(self, mountpoint, app, into_worker=False):
<EOL>self._set('<STR_LIT>' if into_worker else '<STR_LIT>', '<STR_LIT>' % (mountpoint, app), multi=True)<EOL>return self._section<EOL>
Load application under mountpoint. Example: * .mount('', 'app0.py') -- Root URL part * .mount('/app1', 'app1.py') -- URL part * .mount('/pinax/here', '/var/www/pinax/deploy/pinax.wsgi') * .mount('the_app3', 'app3.py') -- Variable value: application alias (can be...
f13064:c0:m1
def switch_into_lazy_mode(self, affect_master=None):
self._set('<STR_LIT>' if affect_master else '<STR_LIT>', True, cast=bool)<EOL>return self._section<EOL>
Load apps in workers instead of master. This option may have memory usage implications as Copy-on-Write semantics can not be used. .. note:: Consider using ``touch_chain_reload`` option in ``workers`` basic params for lazy apps reloading. :param bool affect_master: If **Tr...
f13064:c0:m2
def set_basic_params(self, queue_size=None, freebind=None, default_socket_type=None):
self._set('<STR_LIT>', queue_size)<EOL>self._set('<STR_LIT>', freebind, cast=bool)<EOL>self._set('<STR_LIT>', default_socket_type)<EOL>return self._section<EOL>
:param int queue_size: Also known as a backlog. 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 (an average value chosen by the maximum value allowed by default by yo...
f13065:c0:m1
def set_socket_params(<EOL>self, send_timeout=None, keep_alive=None, no_defer_accept=None,<EOL>buffer_send=None, buffer_receive=None):
self._set('<STR_LIT>', send_timeout)<EOL>self._set('<STR_LIT>', keep_alive, cast=bool)<EOL>self._set('<STR_LIT>', no_defer_accept, cast=bool)<EOL>self._set('<STR_LIT>', buffer_send)<EOL>self._set('<STR_LIT>', buffer_receive)<EOL>return self._section<EOL>
Sets common socket params. :param int send_timeout: Send (write) timeout in seconds. :param bool keep_alive: Enable TCP KEEPALIVEs. :param bool no_defer_accept: Disable deferred ``accept()`` on sockets by default (where available) uWSGI will defer the accept() of requests until so...
f13065:c0:m2
def set_unix_socket_params(self, abstract=None, permissions=None, owner=None, umask=None):
self._set('<STR_LIT>', abstract, cast=bool)<EOL>self._set('<STR_LIT>', permissions)<EOL>self._set('<STR_LIT>', owner)<EOL>self._set('<STR_LIT>', umask)<EOL>return self._section<EOL>
Sets Unix-socket related params. :param bool abstract: Force UNIX socket into abstract mode (Linux only). :param str permissions: UNIX sockets are filesystem objects that obey UNIX permissions like any other filesystem object. You can set the UNIX sockets' permissions with thi...
f13065:c0:m3
def set_bsd_socket_params(self, port_reuse=None):
self._set('<STR_LIT>', port_reuse, cast=bool)<EOL>return self._section<EOL>
Sets BSD-sockets related params. :param bool port_reuse: Enable REUSE_PORT flag on socket to allow multiple instances binding on the same address (BSD only).
f13065:c0:m4
def register_socket(self, socket):
sockets = self._sockets<EOL>for socket in listify(socket):<EOL><INDENT>uses_shared = isinstance(socket.address, SocketShared)<EOL>if uses_shared:<EOL><INDENT>shared_socket = socket.address <EOL>if shared_socket not in sockets:<EOL><INDENT>self.register_socket(shared_socket)<EOL><DEDENT>socket.address = self._get_share...
Registers the given socket(s) for further use. :param Socket|list[Socket] socket: Socket type object. See ``.sockets``.
f13065:c0:m6
def set_ssl_params(<EOL>self, verbose_errors=None,<EOL>sessions_cache=None, sessions_timeout=None, session_context=None,<EOL>raw_options=None, dir_tmp=None, client_cert_var=None):
self._set('<STR_LIT>', verbose_errors, cast=bool)<EOL>self._set('<STR_LIT>', sessions_cache, cast=bool if isinstance(sessions_cache, bool) else None)<EOL>self._set('<STR_LIT>', sessions_timeout)<EOL>for option in listify(raw_options):<EOL><INDENT>self._set('<STR_LIT>', option, multi=True)<EOL><DEDENT>self._set('<STR_LI...
:param bool verbose_errors: Be verbose about SSL errors. :param str|unicode|bool sessions_cache: Use uWSGI cache for ssl sessions storage. Accepts either bool or cache name string. * http://uwsgi.readthedocs.io/en/latest/SSLScaling.html .. warning:: Please be sure to configure cache before setting this....
f13065:c0:m7
def set_sni_params(self, name, cert, key, ciphers=None, client_ca=None, wildcard=False):
command = '<STR_LIT>'<EOL>if wildcard:<EOL><INDENT>command += '<STR_LIT>'<EOL><DEDENT>args = [item for item in (cert, key, ciphers, client_ca) if item is not None]<EOL>self._set(command, '<STR_LIT>' % (name, '<STR_LIT:U+002C>'.join(args)))<EOL>return self._section<EOL>
Allows setting Server Name Identification (virtual hosting for SSL nodes) params. * http://uwsgi.readthedocs.io/en/latest/SNI.html :param str|unicode name: Node/server/host name. :param str|unicode cert: Certificate file. :param str|unicode key: Private key file. :param str|...
f13065:c0:m8
def set_sni_dir_params(self, dir, ciphers=None):
self._set('<STR_LIT>', dir)<EOL>self._set('<STR_LIT>', ciphers)<EOL>return self._section<EOL>
Enable checking for cert/key/client_ca file in the specified directory and create a sni/ssl context on demand. Expected filenames: * <sni-name>.crt * <sni-name>.key * <sni-name>.ca - this file is optional * http://uwsgi.readthedocs.io/en/latest/SNI.html#mass...
f13065:c0:m9
def set_basic_params(self, no_expire=None, expire_scan_interval=None, report_freed=None):
self._set('<STR_LIT>', no_expire, cast=bool)<EOL>self._set('<STR_LIT>', report_freed, cast=bool)<EOL>self._set('<STR_LIT>', expire_scan_interval)<EOL>return self._section<EOL>
:param bool no_expire: Disable auto sweep of expired items. Since uWSGI 1.2, cache item expiration is managed by a thread in the master process, to reduce the risk of deadlock. This thread can be disabled (making item expiry a no-op) with the this option. :param int expire_scan_interval: Set the frequency ...
f13066:c0:m0
def add_item(self, key, value, cache_name=None):
cache_name = cache_name or '<STR_LIT>'<EOL>value = '<STR_LIT>' % (cache_name, key, value)<EOL>self._set('<STR_LIT>', value.strip(), multi=True)<EOL>return self._section<EOL>
Add an item into the given cache. This is a commodity option (mainly useful for testing) allowing you to store an item in a uWSGI cache during startup. :param str|unicode key: :param value: :param str|unicode cache_name: If not set, default will be used.
f13066:c0:m1
def add_file(self, filepath, gzip=False, cache_name=None):
command = '<STR_LIT>'<EOL>if gzip:<EOL><INDENT>command += '<STR_LIT>'<EOL><DEDENT>cache_name = cache_name or '<STR_LIT>'<EOL>value = '<STR_LIT>' % (cache_name, filepath)<EOL>self._set(command, value.strip(), multi=True)<EOL>return self._section<EOL>
Load a static file in the cache. .. note:: Items are stored with the filepath as is (relative or absolute) as the key. :param str|unicode filepath: :param bool gzip: Use gzip compression. :param str|unicode cache_name: If not set, default will be used.
f13066:c0:m2
def add_cache(<EOL>self, name, max_items, expires=None, store=None, store_sync_interval=None, store_delete=None,<EOL>hash_algo=None, hash_size=None, key_size=None, udp_clients=None, udp_servers=None,<EOL>block_size=None, block_count=None, sync_from=None, mode_bitmap=None, use_lastmod=None,<EOL>full_silent=None, full_pu...
value = KeyValue(<EOL>locals(),<EOL>keys=[<EOL>'<STR_LIT:name>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT:store>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>',<EOL>],<EOL>alias...
Creates cache. Default mode: single block. .. note:: This uses new generation ``cache2`` option available since uWSGI 1.9. .. note:: When at least one cache is configured without ``full_purge_lru`` and the master is enabled a thread named "the cache sweeper" is started. Its mai...
f13066:c0:m3
def set_basic_params(<EOL>self, static_dir=None, index_file=None, mime_file=None, skip_ext=None, transfer_mode=None):
if static_dir == self.DIR_DOCUMENT_ROOT:<EOL><INDENT>self._set('<STR_LIT>', True, cast=bool)<EOL><DEDENT>else:<EOL><INDENT>self._set('<STR_LIT>', static_dir, multi=True)<EOL><DEDENT>self._set('<STR_LIT>', index_file, multi=True)<EOL>self._set('<STR_LIT>', mime_file, multi=True)<EOL>self._set('<STR_LIT>', skip_ext, mult...
:param str|unicode|list[str|unicode] static_dir: Check for static files in the specified directory. .. note:: Use ``DIR_DOCUMENT_ROOT`` constant to serve files under ``DOCUMENT_ROOT``. :param str|unicode|list[str|unicode] index_file: Search for specified file if a directory is requested. Example: ``index.htm...
f13067:c0:m0
def register_static_map(self, mountpoint, target, retain_resource_path=False, safe_target=False):
command = '<STR_LIT>'<EOL>if retain_resource_path:<EOL><INDENT>command += '<STR_LIT:2>'<EOL><DEDENT>self._set(command, '<STR_LIT>' % (mountpoint, target), multi=True)<EOL>if safe_target:<EOL><INDENT>self._set('<STR_LIT>', target, multi=True)<EOL><DEDENT>return self._section<EOL>
Allows mapping mountpoint to a static directory (or file). * http://uwsgi.readthedocs.io/en/latest/StaticFiles.html#mode-3-using-static-file-mount-points :param str|unicode mountpoint: :param str|unicode target: :param bool retain_resource_path: Append the requested resource to the d...
f13067:c0:m1
def add_expiration_rule(self, criterion, value, timeout, use_mod_time=False):
command = '<STR_LIT>'<EOL>separator = '<STR_LIT:U+0020>'<EOL>if criterion != self.expiration_criteria.FILENAME:<EOL><INDENT>command += '<STR_LIT>' % criterion<EOL><DEDENT>if criterion == self.expiration_criteria.MIME_TYPE:<EOL><INDENT>separator = '<STR_LIT:=>'<EOL><DEDENT>if use_mod_time:<EOL><INDENT>command += '<STR_L...
Adds statics expiration rule based on a criterion. :param str|unicode criterion: Criterion (subject) to base expiration on. See ``.expiration_criteria``. :param str|unicode|list[str|unicode] value: Value to test criteria upon. .. note:: Usually a regular expression. ...
f13067:c0:m2
def set_paths_caching_params(self, timeout=None, cache_name=None):
self._set('<STR_LIT>', timeout)<EOL>self._set('<STR_LIT>', cache_name)<EOL>return self._section<EOL>
Use the uWSGI caching subsystem to store mappings from URI to filesystem paths. * http://uwsgi.readthedocs.io/en/latest/StaticFiles.html#caching-paths-mappings-resolutions :param int timeout: Amount of seconds to put resolved paths in the uWSGI cache. :param str|unicode cache_name: Cache name...
f13067:c0:m3
def set_basic_params(self, msg_size=None, cheap=None, anti_loop_timeout=None):
self._set('<STR_LIT>', msg_size)<EOL>self._set('<STR_LIT>', cheap, cast=bool)<EOL>self._set('<STR_LIT>', anti_loop_timeout)<EOL>return self._section<EOL>
:param int msg_size: Set the max size of an alarm message in bytes. Default: 8192. :param bool cheap: Use main alarm thread rather than create dedicated threads for curl-based alarms :param int anti_loop_timeout: Tune the anti-loop alarm system. Default: 3 seconds.
f13069:c0:m1
def print_alarms(self):
self._set('<STR_LIT>', True, cast=bool)<EOL>return self._section<EOL>
Print out enabled alarms.
f13069:c0:m2
def register_alarm(self, alarm):
for alarm in listify(alarm):<EOL><INDENT>if alarm not in self._alarms:<EOL><INDENT>self._set('<STR_LIT>', alarm, multi=True)<EOL>self._alarms.append(alarm)<EOL><DEDENT><DEDENT>return self._section<EOL>
Register (create) an alarm. :param AlarmType|list[AlarmType] alarm: Alarm.
f13069:c0:m3
def alarm_on_log(self, alarm, matcher, skip=False):
self.register_alarm(alarm)<EOL>value = '<STR_LIT>' % (<EOL>'<STR_LIT:U+002C>'.join(map(attrgetter('<STR_LIT>'), listify(alarm))),<EOL>matcher)<EOL>self._set('<STR_LIT>' if skip else '<STR_LIT>', value)<EOL>return self._section<EOL>
Raise (or skip) the specified alarm when a log line matches the specified regexp. :param AlarmType|list[AlarmType] alarm: Alarm. :param str|unicode matcher: Regular expression to match log line. :param bool skip:
f13069:c0:m4
def alarm_on_fd_ready(self, alarm, fd, message, byte_count=None):
self.register_alarm(alarm)<EOL>value = fd<EOL>if byte_count:<EOL><INDENT>value += '<STR_LIT>' % byte_count<EOL><DEDENT>value += '<STR_LIT>' % message<EOL>for alarm in listify(alarm):<EOL><INDENT>self._set('<STR_LIT>', '<STR_LIT>' % (alarm.alias, value), multi=True)<EOL><DEDENT>return self._section<EOL>
Triggers the alarm when the specified file descriptor is ready for read. This is really useful for integration with the Linux eventfd() facility. Pretty low-level and the basis of most of the alarm plugins. * http://uwsgi-docs.readthedocs.io/en/latest/Changelog-1.9.7.html#alarm-fd :pa...
f13069:c0:m5
def alarm_on_queue_full(self, alarm):
self.register_alarm(alarm)<EOL>for alarm in listify(alarm):<EOL><INDENT>self._set('<STR_LIT>', alarm.alias, multi=True)<EOL><DEDENT>return self._section<EOL>
Raise the specified alarm when the socket backlog queue is full. :param AlarmType|list[AlarmType] alarm: Alarm.
f13069:c0:m6
def alarm_on_segfault(self, alarm):
self.register_alarm(alarm)<EOL>for alarm in listify(alarm):<EOL><INDENT>self._set('<STR_LIT>', alarm.alias, multi=True)<EOL><DEDENT>return self._section<EOL>
Raise the specified alarm when the segmentation fault handler is executed. Sends a backtrace. :param AlarmType|list[AlarmType] alarm: Alarm.
f13069:c0:m7
def __init__(<EOL>self, name, oid=None, alias_for=None, collector=None,<EOL>initial_value=None, collect_interval=None, reset_after_push=None):
self.name = name<EOL>if alias_for:<EOL><INDENT>self.type_str = MetricTypeAlias.type_str<EOL>self.type_id = MetricTypeAlias.type_id<EOL>if isinstance(alias_for, Metric):<EOL><INDENT>alias_for = alias_for.name<EOL><DEDENT><DEDENT>if self.type_id == MetricTypeAlias.type_id and not alias_for:<EOL><INDENT>raise Configuratio...
:param str|unicode name: Metric name. .. note:: Only numbers, letters, underscores, dashes and dots. :param str|unicode alias_for: If set metric will be a simple alias for the specified one. :param str|unicode oid: Metric OID. Required for SNMP. * http://uwsgi-docs.readthedocs.io/en/latest/Metrics.html...
f13070:c0:m0
def accepting():
Called to notify the master that the worker is accepting requests, this is required for ``touch_chain_reload`` to work. :rtype: None
f13072:m0
def add_cron(signal, minute, hour, day, month, weekday):
Adds cron. The interface to the uWSGI signal cron facility. The syntax is .. note:: The last 5 arguments work similarly to a standard crontab, but instead of "*", use -1, and instead of "/2", "/3", etc. use -2 and -3, etc. :param int signal: Signal to raise. :param int minute: Minute 0-59. Defaul...
f13072:m1
def add_file_monitor(signal, filename):
Maps a specific file/directory modification event to a signal. :param int signal: Signal to raise. :param str|unicode filename: File or a directory to watch for its modification. :rtype: None :raises ValueError: If unable to register monitor.
f13072:m2
def add_ms_timer(signal, period):
Add a microsecond resolution timer. :param int signal: Signal to raise. :param int period: The interval (microseconds) at which to raise the signal. :rtype: None :raises ValueError: If unable to add timer.
f13072:m3
def add_rb_timer(signal, period, repeat=<NUM_LIT:0>):
Add a red-black timer. :param int signal: Signal to raise. :param int period: The interval (seconds) at which the signal is raised. :param int repeat: How many times to repeat. Default: 0 - infinitely. :rtype: None :raises ValueError: If unable to add timer.
f13072:m4
def add_timer(signal, period):
Add timer. :param int signal: Signal to raise. :param int period: The interval (seconds) at which to raise the signal. :rtype: None :raises ValueError: If unable to add timer.
f13072:m5
def add_var(name, value):
Registers custom request variable. Can be used for better integration with the internal routing subsystem. :param str|unicode name: :param str|unicode value: :rtype: bool :raises ValueError: If buffer size is not enough.
f13072:m6
def alarm(name, message):
Issues the given alarm with the given message. :param str|unicode name: :param str|unicode message: Message to pass to alarm. :rtype: None
f13072:m7
def async_connect(socket):
Issues socket connection. And returns a file descriptor. * http://uwsgi.readthedocs.io/en/latest/Async.html :param str|unicode socket: :rtype: int
f13072:m8
def async_sleep(seconds):
Suspends handling the current request and passes control to the next async core. * http://uwsgi.readthedocs.io/en/latest/Async.html :param seconds: Sleep time, in seconds. :rtype None:
f13072:m9
def cache_clear(cache):
Clears cache with the given name. :param str|unicode cache: Cache name with optional address (if @-syntax is used). :rtype: None
f13072:m10
def cache_dec(key, value=<NUM_LIT:1>, expires=None, cache=None):
Decrements the specified key value by the specified value. * http://uwsgi.readthedocs.io/en/latest/Changelog-1.9.9.html#math-for-cache :param str|unicode key: :param int value: :param int expires: Expire timeout (seconds). :param str|unicode cache: Cache name with optional address (if @-syntax ...
f13072:m11
def cache_del(key, cache=None):
Deletes the given cached key from the cache. :param str|unicode key: The cache key to delete. :param str|unicode cache: Cache name with optional address (if @-syntax is used). :rtype: None
f13072:m12
def cache_div(key, value=<NUM_LIT:2>, expires=None, cache=None):
Divides the specified key value by the specified value. * http://uwsgi.readthedocs.io/en/latest/Changelog-1.9.9.html#math-for-cache :param str|unicode key: :param int value: :param int expires: Expire timeout (seconds). :param str|unicode cache: Cache name with optional address (if @-syntax is ...
f13072:m13
def cache_exists(key, cache=None):
Checks whether there is a value in the cache associated with the given key. :param str|unicode key: The cache key to check. :param str|unicode cache: Cache name with optional address (if @-syntax is used). :rtype: bool
f13072:m14
def cache_get(key, cache=None):
Gets a value from the cache. .. warning:: Bytes are returned for Python 3. :param str|unicode key: The cache key to get value for. :param str|unicode cache: Cache name with optional address (if @-syntax is used). :rtype: bytes|str
f13072:m15
def cache_inc(key, value=<NUM_LIT:1>, expires=None, cache=None):
Increments the specified key value by the specified value. * http://uwsgi.readthedocs.io/en/latest/Changelog-1.9.9.html#math-for-cache :param str|unicode key: :param int value: :param int expires: Expire timeout (seconds). :param str|unicode cache: Cache name with optional address (if @-syntax ...
f13072:m16
def cache_keys(cache=None):
Returns a list of keys available in cache. :param str|unicode cache: Cache name with optional address (if @-syntax is used). :rtype: list :raises ValueError: If cache is unavailable.
f13072:m17
def cache_mul(key, value=<NUM_LIT:2>, expires=None, cache=None):
Multiplies the specified key value by the specified value. * http://uwsgi.readthedocs.io/en/latest/Changelog-1.9.9.html#math-for-cache :param str|unicode key: :param int value: :param int expires: Expire timeout (seconds). :param str|unicode cache: Cache name with optional address (if @-syntax ...
f13072:m18
def cache_num(key, cache=None):
Gets the 64bit number from the specified item. * http://uwsgi.readthedocs.io/en/latest/Changelog-1.9.9.html#math-for-cache :param str|unicode key: The cache key to get value for. :param str|unicode cache: Cache name with optional address (if @-syntax is used). :rtype: int|long
f13072:m19
def cache_set(key, value, expires=None, cache=None):
Sets the specified key value. :param str|unicode key: :param int value: :param int expires: Expire timeout (seconds). :param str|unicode cache: Cache name with optional address (if @-syntax is used). :rtype: bool
f13072:m20
def cache_update(key, value, expires=None, cache=None):
Updates the specified key value. :param str|unicode key: :param int value: :param int expires: Expire timeout (seconds). :param str|unicode cache: Cache name with optional address (if @-syntax is used). :rtype: bool
f13072:m21
def call(func_name, *args):
Performs an [RPC] function call with the given arguments. .. warning:: Bytes are returned for Python 3. :param str|unicode func_name: Function name to call with optional address (if @-syntax is used). :param list[str|bytes] args: :rtype: bytes|str
f13072:m22
def chunked_read(timeout):
Reads chunked input. .. warning:: Bytes are returned for Python 3. * http://uwsgi.readthedocs.io/en/latest/Chunked.html * http://uwsgi.readthedocs.io/en/latest/Changelog-1.9.13.html#chunked-input-api :param int timeout: Wait timeout (seconds). :rtype: bytes|str :raises IOError: If unable to...
f13072:m23
def chunked_read_nb():
Reads chunked input without blocking. .. warning:: Bytes are returned for Python 3. * http://uwsgi.readthedocs.io/en/latest/Chunked.html * http://uwsgi.readthedocs.io/en/latest/Changelog-1.9.13.html#chunked-input-api :rtype: bytes|str :raises IOError: If unable to receive chunked part.
f13072:m24
def cl():
Returns current post content length. :rtype: int|long
f13072:m25
def close(fd):
Closes the given file descriptor. :param int fd: File descriptor. :rtype: None
f13072:m26
def connect(socket, timeout=<NUM_LIT:0>):
Connects to the socket. :param str|unicode socket: Socket name. :param int timeout: Timeout (seconds). :rtype: int
f13072:m27
def connection_fd():
Returns current request file descriptor. :rtype: int
f13072:m28
def disconnect():
Drops current connection. :rtype: None
f13072:m29
def embedded_data(symbol_name):
Reads a symbol from the uWSGI binary image. * http://uwsgi.readthedocs.io/en/latest/Embed.html .. warning:: Bytes are returned for Python 3. :param str|unicode symbol_name: The symbol name to extract. :rtype: bytes|str :raises ValueError: If symbol is unavailable.
f13072:m30
def extract(fname):
Extracts file contents. .. warning:: Bytes are returned for Python 3. :param str|unicode fname: :rtype: bytes|str
f13072:m31
def farm_get_msg():
Reads a mule farm message. * http://uwsgi.readthedocs.io/en/latest/Embed.html .. warning:: Bytes are returned for Python 3. :rtype: bytes|str|None :raises ValueError: If not in a mule
f13072:m32
def farm_msg(farm, message):
Sends a message to the given farm. :param str|unicode farm: Farm name to send message to. :param str|unicode message: :rtype: None
f13072:m33
def get_logvar(name):
Return user-defined log variable contents. * http://uwsgi.readthedocs.io/en/latest/LogFormat.html#user-defined-logvars .. warning:: Bytes are returned for Python 3. :param str|unicode name: :rtype: bytes|str
f13072:m34
def green_schedule():
Switches to another green thread. .. note:: Alias for ``suspend``. * http://uwsgi.readthedocs.io/en/latest/Async.html#suspend-resume :type: bool
f13072:m35
def suspend():
Suspends handling of current coroutine/green thread and passes control to the next async core. * http://uwsgi.readthedocs.io/en/latest/Async.html#suspend-resume :type: bool
f13072:m36
def i_am_the_lord(legion_name):
Returns flag indicating whether you are the lord of the given legion. * http://uwsgi.readthedocs.io/en/latest/Legion.html#legion-api :param str|unicode legion_name: :rtype: bool
f13072:m37
def i_am_the_spooler():
Returns flag indicating whether you are the Spooler. :rtype: bool
f13072:m38
def in_farm(name):
Returns flag indicating whether you are (mule) belong to the given farm. :param str|unicode name: Farm name. :rtype: bool
f13072:m39
def is_a_reload():
Returns flag indicating whether reloading mechanics is used. :rtype: bool
f13072:m40
def is_connected(fd):
Checks the given file descriptor. :param int fd: File descriptor :rtype: bool
f13072:m41
def is_locked(lock_num=<NUM_LIT:0>):
Checks for the given lock. .. note:: Lock 0 is always available. :param int lock_num: Lock number. :rtype: bool :raises ValueError: For Spooler or invalid lock number
f13072:m42
def listen_queue(socket_num):
Returns listen queue (backlog size) of the given socket. :param int socket_num: Socket number. :rtype: bool :raises ValueError: If socket is not found
f13072:m43
def lock(lock_num=<NUM_LIT:0>):
Sets the given lock. .. note:: Lock 0 is always available. :param int lock_num: Lock number. :rtype: None :raises ValueError: For Spooler or invalid lock number
f13072:m44
def log(message):
Logs a message. :param str|unicode message: :rtype: bool
f13072:m45
def log_this_request():
Instructs uWSGI to log current request data. :rtype: None
f13072:m46
def logsize():
Returns current log size. :rtype|long
f13072:m47
def loop():
Returns current event loop name or None if loop is not set. :rtype: st|unicode|None
f13072:m48
def lord_scroll(legion_name):
Returns a Lord scroll for the Legion. * http://uwsgi.readthedocs.io/en/latest/Legion.html#lord-scroll-coming-soon :param str|unicode legion_name: :rtype: bool
f13072:m49
def masterpid():
Return the process identifier (PID) of the uWSGI master process. :rtype: int
f13072:m50
def mem():
Returns memory usage tuple of ints: (rss, vsz). :rtype: tuple
f13072:m51
def metric_dec(key, value=<NUM_LIT:1>):
Decrements the specified metric key value by the specified value. :param str|unicode key: :param int value: :rtype: bool
f13072:m52
def metric_div(key, value=<NUM_LIT:1>):
Divides the specified metric key value by the specified value. :param str|unicode key: :param int value: :rtype: bool
f13072:m53
def metric_inc(key, value=<NUM_LIT:1>):
Increments the specified metric key value by the specified value. :param str|unicode key: :param int value: :rtype: bool
f13072:m54
def metric_mul(key, value=<NUM_LIT:1>):
Multiplies the specified metric key value by the specified value. :param str|unicode key: :param int value: :rtype: bool
f13072:m55
def metric_get(key):
Returns metric value by key. :param str|unicode key: :rtype: int|long
f13072:m56
def metric_set(key, value):
Sets metric value. :param str|unicode key: :param int|long value: :rtype: bool
f13072:m57