sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
def set_idle_params(self, timeout=None, exit=None): """Activate idle mode - put uWSGI in cheap mode after inactivity timeout. :param int timeout: Inactivity timeout in seconds. :param bool exit: Shutdown uWSGI when idle. """ self._set('idle', timeout) self._set('die-on...
Activate idle mode - put uWSGI in cheap mode after inactivity timeout. :param int timeout: Inactivity timeout in seconds. :param bool exit: Shutdown uWSGI when idle.
entailment
def set_reload_params(self, mercy=None, exit=None): """Set reload related params. :param int mercy: Set the maximum time (in seconds) we wait for workers and other processes to die during reload/shutdown. :param bool exit: Force exit even if a reload is requested. """ ...
Set reload related params. :param int mercy: Set the maximum time (in seconds) we wait for workers and other processes to die during reload/shutdown. :param bool exit: Force exit even if a reload is requested.
entailment
def add_cron_task( self, command, weekday=None, month=None, day=None, hour=None, minute=None, legion=None, unique=None, harakiri=None): """Adds a cron task running the given command on the given schedule. http://uwsgi.readthedocs.io/en/latest/Cron.html HINTS: ...
Adds a cron task running the given command on the given schedule. http://uwsgi.readthedocs.io/en/latest/Cron.html HINTS: * Use negative values to say `every`: hour=-3 stands for `every 3 hours` * Use - (minus) to make interval: minute='13-18' s...
entailment
def attach_process_classic(self, command_or_pid_path, background, control=False, for_legion=False): """Attaches a command/daemon to the master process optionally managed by a pidfile. This will allow the uWSGI master to control/monitor/respawn this process. .. note:: This uses old classic uWSG...
Attaches a command/daemon to the master process optionally managed by a pidfile. This will allow the uWSGI master to control/monitor/respawn this process. .. note:: This uses old classic uWSGI means of process attaching To have more control use ``.attach_process()`` method (requires uWSGI...
entailment
def attach_process( self, command, for_legion=False, broken_counter=None, pidfile=None, control=None, daemonize=None, touch_reload=None, signal_stop=None, signal_reload=None, honour_stdin=None, uid=None, gid=None, new_pid_ns=None, change_dir=None): """Attaches a command/daemo...
Attaches a command/daemon to the master process. This will allow the uWSGI master to control/monitor/respawn this process. http://uwsgi-docs.readthedocs.io/en/latest/AttachingDaemons.html :param str|unicode command: The command line to execute. :param bool for_legion: Legion daemons ...
entailment
def set_basic_params( self, check_interval_busy=None, busy_max=None, busy_min=None, idle_cycles_max=None, idle_cycles_penalty=None, verbose=None): """ :param int check_interval_busy: Interval (sec) to check worker busyness. :param int busy_max: Ma...
:param int check_interval_busy: Interval (sec) to check worker busyness. :param int busy_max: Maximum busyness (percents). Every time the calculated busyness is higher than this value, uWSGI will spawn new workers. Default: 50. :param int busy_min: Minimum busyness (percents). If busyness ...
entailment
def set_emergency_params( self, workers_step=None, idle_cycles_max=None, queue_size=None, queue_nonzero_delay=None): """Sets busyness algorithm emergency workers related params. Emergency workers could be spawned depending upon uWSGI backlog state. .. note:: These options are Linux...
Sets busyness algorithm emergency workers related params. Emergency workers could be spawned depending upon uWSGI backlog state. .. note:: These options are Linux only. :param int workers_step: Number of emergency workers to spawn. Default: 1. :param int idle_cycles_max: Idle cycles ...
entailment
def set_basic_params( self, spawn_on_request=None, cheaper_algo=None, workers_min=None, workers_startup=None, workers_step=None): """ :param bool spawn_on_request: Spawn workers only after the first request. :param Algo cheaper_algo: The algorithm object to be used used ...
:param bool spawn_on_request: Spawn workers only after the first request. :param Algo cheaper_algo: The algorithm object to be used used for adaptive process spawning. Default: ``spare``. See ``.algorithms``. :param int workers_min: Minimal workers count. Enables cheaper mode (adaptive pro...
entailment
def set_memory_limits(self, rss_soft=None, rss_hard=None): """Sets worker memory limits for cheapening. :param int rss_soft: Don't spawn new workers if total resident memory usage of all workers is higher than this limit in bytes. .. warning:: This option expects me...
Sets worker memory limits for cheapening. :param int rss_soft: Don't spawn new workers if total resident memory usage of all workers is higher than this limit in bytes. .. warning:: This option expects memory reporting enabled: ``.logging.set_basic_params(me...
entailment
def get_version(self, as_tuple=False): """Returns uWSGI version string or tuple. :param bool as_tuple: :rtype: str|tuple """ if as_tuple: return uwsgi.version_info return decode(uwsgi.version)
Returns uWSGI version string or tuple. :param bool as_tuple: :rtype: str|tuple
entailment
def register_route(self, route_rules, label=None): """Registers a routing rule. :param RouteRule|list[RouteRule] route_rules: :param str|unicode label: Label to mark the given set of rules. This can be used in conjunction with ``do_goto`` rule action. * http://uwsgi.re...
Registers a routing rule. :param RouteRule|list[RouteRule] route_rules: :param str|unicode label: Label to mark the given set of rules. This can be used in conjunction with ``do_goto`` rule action. * http://uwsgi.readthedocs.io/en/latest/InternalRouting.html#goto
entailment
def set_error_page(self, status, html_fpath): """Add an error page (html) for managed 403, 404, 500 response. :param int status: HTTP status code. :param str|unicode html_fpath: HTML page file path. """ statuses = [403, 404, 500] status = int(status) if statu...
Add an error page (html) for managed 403, 404, 500 response. :param int status: HTTP status code. :param str|unicode html_fpath: HTML page file path.
entailment
def set_error_pages(self, codes_map=None, common_prefix=None): """Add an error pages for managed 403, 404, 500 responses. Shortcut for ``.set_error_page()``. :param dict codes_map: Status code mapped into an html filepath or just a filename if common_prefix is used. If...
Add an error pages for managed 403, 404, 500 responses. Shortcut for ``.set_error_page()``. :param dict codes_map: Status code mapped into an html filepath or just a filename if common_prefix is used. If not set, filename containing status code is presumed: 400.html, 500.html,...
entailment
def set_geoip_params(self, db_country=None, db_city=None): """Sets GeoIP parameters. * http://uwsgi.readthedocs.io/en/latest/GeoIP.html :param str|unicode db_country: Country database file path. :param str|unicode db_city: City database file path. Example: ``GeoLiteCity.dat``. ...
Sets GeoIP parameters. * http://uwsgi.readthedocs.io/en/latest/GeoIP.html :param str|unicode db_country: Country database file path. :param str|unicode db_city: City database file path. Example: ``GeoLiteCity.dat``.
entailment
def header_add(self, name, value): """Automatically add HTTP headers to response. :param str|unicode name: :param str|unicode value: """ self._set('add-header', '%s: %s' % (name, value), multi=True) return self._section
Automatically add HTTP headers to response. :param str|unicode name: :param str|unicode value:
entailment
def header_remove(self, value): """Automatically remove specified HTTP header from the response. :param str|unicode value: """ self._set('del-header', value, multi=True) return self._section
Automatically remove specified HTTP header from the response. :param str|unicode value:
entailment
def header_collect(self, name, target_var, pull=False): """Store the specified response header in a request var (optionally removing it from the response). :param str|unicode name: :param str|unicode target_var: :param bool pull: Whether to remove header from response. ...
Store the specified response header in a request var (optionally removing it from the response). :param str|unicode name: :param str|unicode target_var: :param bool pull: Whether to remove header from response.
entailment
def register_static_map(self, mountpoint, target, retain_resource_path=False, safe_target=False): """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: ...
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...
entailment
def add_expiration_rule(self, criterion, value, timeout, use_mod_time=False): """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: Va...
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. ...
entailment
def set_paths_caching_params(self, timeout=None, cache_name=None): """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 resolve...
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...
entailment
def set_socket_params( self, send_timeout=None, keep_alive=None, no_defer_accept=None, buffer_send=None, buffer_receive=None): """Sets common socket params. :param int send_timeout: Send (write) timeout in seconds. :param bool keep_alive: Enable TCP KEEPALIVEs. ...
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...
entailment
def set_unix_socket_params(self, abstract=None, permissions=None, owner=None, umask=None): """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 permiss...
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...
entailment
def set_bsd_socket_params(self, port_reuse=None): """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). """ self._set('reuse-port', port_reuse, cast=bool) ret...
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).
entailment
def register_socket(self, socket): """Registers the given socket(s) for further use. :param Socket|list[Socket] socket: Socket type object. See ``.sockets``. """ sockets = self._sockets for socket in listify(socket): uses_shared = isinstance(socket.address, Socket...
Registers the given socket(s) for further use. :param Socket|list[Socket] socket: Socket type object. See ``.sockets``.
entailment
def set_sni_params(self, name, cert, key, ciphers=None, client_ca=None, wildcard=False): """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|uni...
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|...
entailment
def set_sni_dir_params(self, dir, ciphers=None): """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 ...
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...
entailment
def enable(self, size, block_size=None, store=None, store_sync_interval=None): """Enables shared queue of the given size. :param int size: Queue size. :param int block_size: Block size in bytes. Default: 8 KiB. :param str|unicode store: Persist the queue into file. :param int...
Enables shared queue of the given size. :param int size: Queue size. :param int block_size: Block size in bytes. Default: 8 KiB. :param str|unicode store: Persist the queue into file. :param int store_sync_interval: Store sync interval in master cycles (usually seconds).
entailment
def set_basic_params(self, count=None, thunder_lock=None, lock_engine=None): """ :param int count: Create the specified number of shared locks. :param bool thunder_lock: Serialize accept() usage (if possible) Could improve performance on Linux with robust pthread mutexes. ...
:param int count: Create the specified number of shared locks. :param bool thunder_lock: Serialize accept() usage (if possible) Could improve performance on Linux with robust pthread mutexes. http://uwsgi.readthedocs.io/en/latest/articles/SerializingAccept.html :param str|unic...
entailment
def set_ipcsem_params(self, ftok=None, persistent=None): """Sets ipcsem lock engine params. :param str|unicode ftok: Set the ipcsem key via ftok() for avoiding duplicates. :param bool persistent: Do not remove ipcsem's on shutdown. """ self._set('ftok', ftok) self._set...
Sets ipcsem lock engine params. :param str|unicode ftok: Set the ipcsem key via ftok() for avoiding duplicates. :param bool persistent: Do not remove ipcsem's on shutdown.
entailment
def lock_file(self, fpath, after_setup=False, wait=False): """Locks the specified file. :param str|unicode fpath: File path. :param bool after_setup: True - after logging/daemon setup False - before starting :param bool wait: True - wait if locked...
Locks the specified file. :param str|unicode fpath: File path. :param bool after_setup: True - after logging/daemon setup False - before starting :param bool wait: True - wait if locked False - exit if locked
entailment
def register_rpc(name=None): """Decorator. Allows registering a function for RPC. * http://uwsgi.readthedocs.io/en/latest/RPC.html Example: .. code-block:: python @register_rpc() def expose_me(): do() :param str|unicode name: RPC function name to ass...
Decorator. Allows registering a function for RPC. * http://uwsgi.readthedocs.io/en/latest/RPC.html Example: .. code-block:: python @register_rpc() def expose_me(): do() :param str|unicode name: RPC function name to associate with decorated functi...
entailment
def make_rpc_call(func_name, args=None, remote=None): """Performs an RPC function call (local or remote) with the given arguments. :param str|unicode func_name: RPC function name to call. :param Iterable args: Function arguments. :param str|unicode remote: :rtype: bytes|str :raises ValueErr...
Performs an RPC function call (local or remote) with the given arguments. :param str|unicode func_name: RPC function name to call. :param Iterable args: Function arguments. :param str|unicode remote: :rtype: bytes|str :raises ValueError: If unable to call RPC function.
entailment
def set_emperor_command_params( self, command_socket=None, wait_for_command=None, wait_for_command_exclude=None): """Emperor commands related parameters. * http://uwsgi-docs.readthedocs.io/en/latest/tutorials/EmperorSubscriptions.html :param str|unicode command_socket: ...
Emperor commands related parameters. * http://uwsgi-docs.readthedocs.io/en/latest/tutorials/EmperorSubscriptions.html :param str|unicode command_socket: Enable the Emperor command socket. It is a channel allowing external process to govern vassals. :param bool wait_for_command: Al...
entailment
def set_vassals_wrapper_params(self, wrapper=None, overrides=None, fallbacks=None): """Binary wrapper for vassals parameters. :param str|unicode wrapper: Set a binary wrapper for vassals. :param str|unicode|list[str|unicode] overrides: Set a binary wrapper for vassals to try before the default...
Binary wrapper for vassals parameters. :param str|unicode wrapper: Set a binary wrapper for vassals. :param str|unicode|list[str|unicode] overrides: Set a binary wrapper for vassals to try before the default one :param str|unicode|list[str|unicode] fallbacks: Set a binary wrapper for vassals ...
entailment
def set_throttle_params(self, level=None, level_max=None): """Throttling options. * http://uwsgi-docs.readthedocs.io/en/latest/Emperor.html#throttling * http://uwsgi-docs.readthedocs.io/en/latest/Emperor.html#loyalty :param int level: Set throttling level (in milliseconds) for bad beha...
Throttling options. * http://uwsgi-docs.readthedocs.io/en/latest/Emperor.html#throttling * http://uwsgi-docs.readthedocs.io/en/latest/Emperor.html#loyalty :param int level: Set throttling level (in milliseconds) for bad behaving vassals. Default: 1000. :param int level_max: Set maximu...
entailment
def set_tolerance_params(self, for_heartbeat=None, for_cursed_vassals=None): """Various tolerance options. :param int for_heartbeat: Set the Emperor tolerance about heartbeats. * http://uwsgi-docs.readthedocs.io/en/latest/Emperor.html#heartbeat-system :param int for_cursed_vassals...
Various tolerance options. :param int for_heartbeat: Set the Emperor tolerance about heartbeats. * http://uwsgi-docs.readthedocs.io/en/latest/Emperor.html#heartbeat-system :param int for_cursed_vassals: Set the Emperor tolerance about cursed vassals. * http://uwsgi-docs.readt...
entailment
def set_mode_tyrant_params(self, enable=None, links_no_follow=None, use_initgroups=None): """Tyrant mode (secure multi-user hosting). In Tyrant mode the Emperor will run the vassal using the UID/GID of the vassal configuration file. * http://uwsgi-docs.readthedocs.io/en/latest/Emperor....
Tyrant mode (secure multi-user hosting). In Tyrant mode the Emperor will run the vassal using the UID/GID of the vassal configuration file. * http://uwsgi-docs.readthedocs.io/en/latest/Emperor.html#tyrant-mode-secure-multi-user-hosting :param enable: Puts the Emperor in Tyrant mode. ...
entailment
def set_mode_broodlord_params( self, zerg_count=None, vassal_overload_sos_interval=None, vassal_queue_items_sos=None): """This mode is a way for a vassal to ask for reinforcements to the Emperor. Reinforcements are new vassals spawned on demand generally bound on the same socket...
This mode is a way for a vassal to ask for reinforcements to the Emperor. Reinforcements are new vassals spawned on demand generally bound on the same socket. .. warning:: If you are looking for a way to dynamically adapt the number of workers of an instance, check the Cheaper subsystem - ...
entailment
def run_command_as_worker(self, command, after_post_fork_hook=False): """Run the specified command as worker. :param str|unicode command: :param bool after_post_fork_hook: Whether to run it after `post_fork` hook. """ self._set('worker-exec2' if after_post_fork_hook else 'work...
Run the specified command as worker. :param str|unicode command: :param bool after_post_fork_hook: Whether to run it after `post_fork` hook.
entailment
def set_count_auto(self, count=None): """Sets workers count. By default sets it to detected number of available cores :param int count: """ count = count or self._section.vars.CPU_CORES self._set('workers', count) return self._section
Sets workers count. By default sets it to detected number of available cores :param int count:
entailment
def set_thread_params( self, enable=None, count=None, count_offload=None, stack_size=None, no_wait=None): """Sets threads related params. :param bool enable: Enable threads in the embedded languages. This will allow to spawn threads in your app. .. warning:: Threads...
Sets threads related params. :param bool enable: Enable threads in the embedded languages. This will allow to spawn threads in your app. .. warning:: Threads will simply *not work* if this option is not enabled. There will likely be no error, just no execution of your t...
entailment
def set_mules_params( self, mules=None, touch_reload=None, harakiri_timeout=None, farms=None, reload_mercy=None, msg_buffer=None, msg_buffer_recv=None): """Sets mules related params. http://uwsgi.readthedocs.io/en/latest/Mules.html Mules are worker processes living in t...
Sets mules related params. http://uwsgi.readthedocs.io/en/latest/Mules.html Mules are worker processes living in the uWSGI stack but not reachable via socket connections, that can be used as a generic subsystem to offload tasks. :param int|list mules: Add the specified mules or number...
entailment
def set_reload_params( self, min_lifetime=None, max_lifetime=None, max_requests=None, max_requests_delta=None, max_addr_space=None, max_rss=None, max_uss=None, max_pss=None, max_addr_space_forced=None, max_rss_forced=None, watch_interval_forced=None, mercy=Non...
Sets workers reload parameters. :param int min_lifetime: A worker cannot be destroyed/reloaded unless it has been alive for N seconds (default 60). This is an anti-fork-bomb measure. Since 1.9 :param int max_lifetime: Reload workers after this many seconds. Disabled by default....
entailment
def set_reload_on_exception_params(self, do_reload=None, etype=None, evalue=None, erepr=None): """Sets workers reload on exceptions parameters. :param bool do_reload: Reload a worker when an exception is raised. :param str etype: Reload a worker when a specific exception type is raised. ...
Sets workers reload on exceptions parameters. :param bool do_reload: Reload a worker when an exception is raised. :param str etype: Reload a worker when a specific exception type is raised. :param str evalue: Reload a worker when a specific exception value is raised. :param str erepr...
entailment
def set_harakiri_params(self, timeout=None, verbose=None, disable_for_arh=None): """Sets workers harakiri parameters. :param int timeout: Harakiri timeout in seconds. Every request that will take longer than the seconds specified in the harakiri timeout will be dropped and the c...
Sets workers harakiri parameters. :param int timeout: Harakiri timeout in seconds. Every request that will take longer than the seconds specified in the harakiri timeout will be dropped and the corresponding worker is thereafter recycled. :param bool verbose: Haraki...
entailment
def set_zerg_server_params(self, socket, clients_socket_pool=None): """Zerg mode. Zerg server params. When your site load is variable, it would be nice to be able to add workers dynamically. Enabling Zerg mode you can allow zerg clients to attach to your already running server and help ...
Zerg mode. Zerg server params. When your site load is variable, it would be nice to be able to add workers dynamically. Enabling Zerg mode you can allow zerg clients to attach to your already running server and help it in the work. * http://uwsgi-docs.readthedocs.io/en/latest/Zerg.html...
entailment
def set_zerg_client_params(self, server_sockets, use_fallback_socket=None): """Zerg mode. Zergs params. :param str|unicode|list[str|unicode] server_sockets: Attaches zerg to a zerg server. :param bool use_fallback_socket: Fallback to normal sockets if the zerg server is not available ...
Zerg mode. Zergs params. :param str|unicode|list[str|unicode] server_sockets: Attaches zerg to a zerg server. :param bool use_fallback_socket: Fallback to normal sockets if the zerg server is not available
entailment
def format_print_text(text, color_fg=None, color_bg=None): """Format given text using ANSI formatting escape sequences. Could be useful gfor print command. :param str|unicode text: :param str|unicode color_fg: text (foreground) color :param str|unicode color_bg: text (background) color :rtype:...
Format given text using ANSI formatting escape sequences. Could be useful gfor print command. :param str|unicode text: :param str|unicode color_fg: text (foreground) color :param str|unicode color_bg: text (background) color :rtype: str|unicode
entailment
def iter_options(self): """Iterates configuration sections groups options.""" for section in self.sections: name = str(section) for key, value in section._get_options(): yield name, key, value
Iterates configuration sections groups options.
entailment
def set_memory_params(self, ksm_interval=None, no_swap=None): """Set memory related parameters. :param int ksm_interval: Kernel Samepage Merging frequency option, that can reduce memory usage. Accepts a number of requests (or master process cycles) to run page scanner after. .....
Set memory related parameters. :param int ksm_interval: Kernel Samepage Merging frequency option, that can reduce memory usage. Accepts a number of requests (or master process cycles) to run page scanner after. .. note:: Linux only. * http://uwsgi.readthedocs.io/en/latest/...
entailment
def daemonize(self, log_into, after_app_loading=False): """Daemonize uWSGI. :param str|unicode log_into: Logging destination: * File: /tmp/mylog.log * UPD: 192.168.1.2:1717 .. note:: This will require an UDP server to manage log messages. U...
Daemonize uWSGI. :param str|unicode log_into: Logging destination: * File: /tmp/mylog.log * UPD: 192.168.1.2:1717 .. note:: This will require an UDP server to manage log messages. Use ``networking.register_socket('192.168.1.2:1717, type=networking....
entailment
def change_dir(self, to, after_app_loading=False): """Chdir to specified directory before or after apps loading. :param str|unicode to: Target directory. :param bool after_app_loading: *True* - after load *False* - before load """ self._set('chd...
Chdir to specified directory before or after apps loading. :param str|unicode to: Target directory. :param bool after_app_loading: *True* - after load *False* - before load
entailment
def set_owner_params(self, uid=None, gid=None, add_gids=None, set_asap=False): """Set process owner params - user, group. :param str|unicode|int uid: Set uid to the specified username or uid. :param str|unicode|int gid: Set gid to the specified groupname or gid. :param list|str|unicod...
Set process owner params - user, group. :param str|unicode|int uid: Set uid to the specified username or uid. :param str|unicode|int gid: Set gid to the specified groupname or gid. :param list|str|unicode|int add_gids: Add the specified group id to the process credentials. This op...
entailment
def get_owner(self, default=True): """Return (User ID, Group ID) tuple :param bool default: Whether to return default if not set. :rtype: tuple[int, int] """ uid, gid = self.owner if not uid and default: uid = os.getuid() if not gid and default: ...
Return (User ID, Group ID) tuple :param bool default: Whether to return default if not set. :rtype: tuple[int, int]
entailment
def set_hook(self, phase, action): """Allows setting hooks (attaching actions) for various uWSGI phases. :param str|unicode phase: See constants in ``.phases``. :param str|unicode|list|HookAction|list[HookAction] action: """ self._set('hook-%s' % phase, action, multi=True) ...
Allows setting hooks (attaching actions) for various uWSGI phases. :param str|unicode phase: See constants in ``.phases``. :param str|unicode|list|HookAction|list[HookAction] action:
entailment
def set_hook_touch(self, fpath, action): """Allows running certain action when the specified file is touched. :param str|unicode fpath: File path. :param str|unicode|list|HookAction|list[HookAction] action: """ self._set('hook-touch', '%s %s' % (fpath, action), multi=True) ...
Allows running certain action when the specified file is touched. :param str|unicode fpath: File path. :param str|unicode|list|HookAction|list[HookAction] action:
entailment
def set_hook_after_request(self, func): """Run the specified function/symbol (C level) after each request. :param str|unicode func: """ self._set('after-request-hook', func, multi=True) return self._section
Run the specified function/symbol (C level) after each request. :param str|unicode func:
entailment
def set_on_exit_params(self, skip_hooks=None, skip_teardown=None): """Set params related to process exit procedure. :param bool skip_hooks: Skip ``EXIT`` phase hook. .. note:: Ignored by the master. :param bool skip_teardown: Allows skipping teardown (finalization) processes for s...
Set params related to process exit procedure. :param bool skip_hooks: Skip ``EXIT`` phase hook. .. note:: Ignored by the master. :param bool skip_teardown: Allows skipping teardown (finalization) processes for some plugins. .. note:: Ignored by the master. Suppor...
entailment
def run_command_on_event(self, command, phase=phases.ASAP): """Run the given command on a given phase. :param str|unicode command: :param str|unicode phase: See constants in ``Phases`` class. """ self._set('exec-%s' % phase, command, multi=True) return self._section
Run the given command on a given phase. :param str|unicode command: :param str|unicode phase: See constants in ``Phases`` class.
entailment
def run_command_on_touch(self, command, target): """Run command when the specified file is modified/touched. :param str|unicode command: :param str|unicode target: File path. """ self._set('touch-exec', '%s %s' % (target, command), multi=True) return self._section
Run command when the specified file is modified/touched. :param str|unicode command: :param str|unicode target: File path.
entailment
def set_pid_file(self, fpath, before_priv_drop=True, safe=False): """Creates pidfile before or after privileges drop. :param str|unicode fpath: File path. :param bool before_priv_drop: Whether to create pidfile before privileges are dropped. .. note:: Vacuum is made after privileg...
Creates pidfile before or after privileges drop. :param str|unicode fpath: File path. :param bool before_priv_drop: Whether to create pidfile before privileges are dropped. .. note:: Vacuum is made after privileges drop, so it may not be able to delete PID file if it was c...
entailment
def set_naming_params(self, autonaming=None, prefix=None, suffix=None, name=None): """Setups processes naming parameters. :param bool autonaming: Automatically set process name to something meaningful. Generated process names may be 'uWSGI Master', 'uWSGI Worker #', etc. :param str...
Setups processes naming parameters. :param bool autonaming: Automatically set process name to something meaningful. Generated process names may be 'uWSGI Master', 'uWSGI Worker #', etc. :param str|unicode prefix: Add prefix to process names. :param str|unicode suffix: Append strin...
entailment
def errorprint(): """Print out descriptions from ConfigurationError.""" try: yield except ConfigurationError as e: click.secho('%s' % e, err=True, fg='red') sys.exit(1)
Print out descriptions from ConfigurationError.
entailment
def run(conf, only): """Runs uWSGI passing to it using the default or another `uwsgiconf` configuration module. """ with errorprint(): config = ConfModule(conf) spawned = config.spawn_uwsgi(only) for alias, pid in spawned: click.secho("Spawned uWSGI for configuration al...
Runs uWSGI passing to it using the default or another `uwsgiconf` configuration module.
entailment
def compile(conf): """Compiles classic uWSGI configuration file using the default or given `uwsgiconf` configuration module. """ with errorprint(): config = ConfModule(conf) for conf in config.configurations: conf.format(do_print=True)
Compiles classic uWSGI configuration file using the default or given `uwsgiconf` configuration module.
entailment
def sysinit(systype, conf, project): """Outputs configuration for system initialization subsystem.""" click.secho(get_config( systype, conf=ConfModule(conf).configurations[0], conf_path=conf, project_name=project, ))
Outputs configuration for system initialization subsystem.
entailment
def probe_plugins(): """Runs uWSGI to determine what plugins are available and prints them out. Generic plugins come first then after blank line follow request plugins. """ plugins = UwsgiRunner().get_plugins() for plugin in sorted(plugins.generic): click.secho(plugin) click.secho(''...
Runs uWSGI to determine what plugins are available and prints them out. Generic plugins come first then after blank line follow request plugins.
entailment
def register_handler(self, target=None): """Decorator for a function to be used as a signal handler. :param str|unicode target: Where this signal will be delivered to. Default: ``worker``. * ``workers`` - run the signal handler on all the workers * ``workerN`` - run the signal...
Decorator for a function to be used as a signal handler. :param str|unicode target: Where this signal will be delivered to. Default: ``worker``. * ``workers`` - run the signal handler on all the workers * ``workerN`` - run the signal handler only on worker N * ``worker``/`...
entailment
def add(self, work_dir, external=False): """Run a spooler on the specified directory. :param str|unicode work_dir: .. note:: Placeholders can be used to build paths, e.g.: {project_runtime_dir}/spool/ See ``Section.project_name`` and ``Section.runtime_dir``. :param b...
Run a spooler on the specified directory. :param str|unicode work_dir: .. note:: Placeholders can be used to build paths, e.g.: {project_runtime_dir}/spool/ See ``Section.project_name`` and ``Section.runtime_dir``. :param bool external: map spoolers requests to a spooler dir...
entailment
def configure(self): """Configures broodlord mode and returns emperor and zerg sections. :rtype: tuple """ section_emperor = self.section_emperor section_zerg = self.section_zerg socket = self.socket section_emperor.workers.set_zerg_server_params(socket=socket)...
Configures broodlord mode and returns emperor and zerg sections. :rtype: tuple
entailment
def get_log_format_default(self): """Returns default log message format. .. note:: Some params may be missing. """ vars = self.logging.vars format_default = ( '[pid: %s|app: %s|req: %s/%s] %s (%s) {%s vars in %s bytes} [%s] %s %s => ' 'generated %s byte...
Returns default log message format. .. note:: Some params may be missing.
entailment
def configure_owner(self, owner='www-data'): """Shortcut to set process owner data. :param str|unicode owner: Sets user and group. Default: ``www-data``. """ if owner is not None: self.main_process.set_owner_params(uid=owner, gid=owner) return self
Shortcut to set process owner data. :param str|unicode owner: Sets user and group. Default: ``www-data``.
entailment
def set_basic_params(self, msg_size=None, cheap=None, anti_loop_timeout=None): """ :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 i...
: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.
entailment
def register_alarm(self, alarm): """Register (create) an alarm. :param AlarmType|list[AlarmType] alarm: Alarm. """ for alarm in listify(alarm): if alarm not in self._alarms: self._set('alarm', alarm, multi=True) self._alarms.append(alarm) ...
Register (create) an alarm. :param AlarmType|list[AlarmType] alarm: Alarm.
entailment
def alarm_on_log(self, alarm, matcher, skip=False): """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: """ ...
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:
entailment
def alarm_on_fd_ready(self, alarm, fd, message, byte_count=None): """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://u...
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...
entailment
def alarm_on_segfault(self, alarm): """Raise the specified alarm when the segmentation fault handler is executed. Sends a backtrace. :param AlarmType|list[AlarmType] alarm: Alarm. """ self.register_alarm(alarm) for alarm in listify(alarm): self._set('alarm-...
Raise the specified alarm when the segmentation fault handler is executed. Sends a backtrace. :param AlarmType|list[AlarmType] alarm: Alarm.
entailment
def get_config(systype, conf, conf_path, runner=None, project_name=None): """Returns init system configuration file contents. :param str|unicode systype: System type alias, e.g. systemd, upstart :param Section|Configuration conf: Configuration/Section object. :param str|unicode conf_path: File path to ...
Returns init system configuration file contents. :param str|unicode systype: System type alias, e.g. systemd, upstart :param Section|Configuration conf: Configuration/Section object. :param str|unicode conf_path: File path to a configuration file or a command producing such a configuration. :param str|...
entailment
def app_1(env, start_response): """This is simple WSGI application that will be served by uWSGI.""" from uwsgiconf.runtime.environ import uwsgi_env start_response('200 OK', [('Content-Type','text/html')]) data = [ '<h1>uwsgiconf demo: one file</h1>', '<div>uWSGI version: %s</div>' % ...
This is simple WSGI application that will be served by uWSGI.
entailment
def app_2(env, start_response): """This is another simple WSGI application that will be served by uWSGI.""" import random start_response('200 OK', [('Content-Type','text/html')]) data = [ '<h1>uwsgiconf demo: one file second app</h1>', '<div>Some random number for you: %s</div>' % ra...
This is another simple WSGI application that will be served by uWSGI.
entailment
def configure(): """Configure uWSGI. This returns several configuration objects, which will be used to spawn several uWSGI processes. Applications are on 127.0.0.1 on ports starting from 8000. """ import os from uwsgiconf.presets.nice import PythonSection FILE = os.path.abspath(__fil...
Configure uWSGI. This returns several configuration objects, which will be used to spawn several uWSGI processes. Applications are on 127.0.0.1 on ports starting from 8000.
entailment
def headers_raw_to_dict(headers_raw): r""" Convert raw headers (single multi-line bytestring) to a dictionary. For example: >>> from copyheaders import headers_raw_to_dict >>> headers_raw_to_dict(b"Content-type: text/html\n\rAccept: gzip\n\n") # doctest: +SKIP {'Content-type': ['text/htm...
r""" Convert raw headers (single multi-line bytestring) to a dictionary. For example: >>> from copyheaders import headers_raw_to_dict >>> headers_raw_to_dict(b"Content-type: text/html\n\rAccept: gzip\n\n") # doctest: +SKIP {'Content-type': ['text/html'], 'Accept': ['gzip']} Incorrect in...
entailment
def log_into(self, target, before_priv_drop=True): """Simple file or UDP logging. .. note:: This doesn't require any Logger plugin and can be used if no log routing is required. :param str|unicode target: Filepath or UDP address. :param bool before_priv_drop: Whether to lo...
Simple file or UDP logging. .. note:: This doesn't require any Logger plugin and can be used if no log routing is required. :param str|unicode target: Filepath or UDP address. :param bool before_priv_drop: Whether to log data before or after privileges drop.
entailment
def set_file_params( self, reopen_on_reload=None, trucate_on_statup=None, max_size=None, rotation_fname=None, touch_reopen=None, touch_rotate=None, owner=None, mode=None): """Set various parameters related to file logging. :param bool reopen_on_reload: Reopen log after reload. ...
Set various parameters related to file logging. :param bool reopen_on_reload: Reopen log after reload. :param bool trucate_on_statup: Truncate log on startup. :param int max_size: Set maximum logfile size in bytes after which log should be rotated. :param str|unicode rotation_fname: ...
entailment
def set_filters(self, include=None, exclude=None, write_errors=None, write_errors_tolerance=None, sigpipe=None): """Set various log data filters. :param str|unicode|list include: Show only log lines matching the specified regexp. .. note:: Requires enabled PCRE support. :param str...
Set various log data filters. :param str|unicode|list include: Show only log lines matching the specified regexp. .. note:: Requires enabled PCRE support. :param str|unicode|list exclude: Do not show log lines matching the specified regexp. .. note:: Requires enabled PCRE sup...
entailment
def set_requests_filters( self, slower=None, bigger=None, status_4xx=None, status_5xx=None, no_body=None, sendfile=None, io_errors=None): """Set various log data filters. :param int slower: Log requests slower than the specified number of milliseconds. :param int bigger...
Set various log data filters. :param int slower: Log requests slower than the specified number of milliseconds. :param int bigger: Log requests bigger than the specified size in bytes. :param status_4xx: Log requests with a 4xx response. :param status_5xx: Log requests with a 5xx res...
entailment
def set_master_logging_params( self, enable=None, dedicate_thread=None, buffer=None, sock_stream=None, sock_stream_requests_only=None): """Sets logging params for delegating logging to master process. :param bool enable: Delegate logging to master process. Delegate t...
Sets logging params for delegating logging to master process. :param bool enable: Delegate logging to master process. Delegate the write of the logs to the master process (this will put all of the logging I/O to a single process). Useful for system with advanced I/O schedule...
entailment
def add_logger(self, logger, requests_only=False, for_single_worker=False): """Set/add a common logger or a request requests only. :param str|unicode|list|Logger|list[Logger] logger: :param bool requests_only: Logger used only for requests information messages. :param bool for_single_...
Set/add a common logger or a request requests only. :param str|unicode|list|Logger|list[Logger] logger: :param bool requests_only: Logger used only for requests information messages. :param bool for_single_worker: Logger to be used in single-worker setup.
entailment
def add_logger_route(self, logger, matcher, requests_only=False): """Log to the specified named logger if regexp applied on log item matches. :param str|unicode|list|Logger|list[Logger] logger: Logger to associate route with. :param str|unicode matcher: Regular expression to apply to log item....
Log to the specified named logger if regexp applied on log item matches. :param str|unicode|list|Logger|list[Logger] logger: Logger to associate route with. :param str|unicode matcher: Regular expression to apply to log item. :param bool requests_only: Matching should be used only for request...
entailment
def add_logger_encoder(self, encoder, logger=None, requests_only=False, for_single_worker=False): """Add an item in the log encoder or request encoder chain. * http://uwsgi-docs.readthedocs.io/en/latest/LogEncoders.html .. note:: Encoders automatically enable master log handling (see ``.se...
Add an item in the log encoder or request encoder chain. * http://uwsgi-docs.readthedocs.io/en/latest/LogEncoders.html .. note:: Encoders automatically enable master log handling (see ``.set_master_logging_params()``). .. note:: For best performance consider allocating a thread ...
entailment
def _compiler_type(): """ Gets the compiler type from distutils. On Windows with MSVC it will be "msvc". On macOS and linux it is "unix". Borrowed from https://github.com/pyca/cryptography/blob\ /05b34433fccdc2fec0bb014c3668068169d769fd/src/_cffi_src/utils.py#L78 """ dist = dist...
Gets the compiler type from distutils. On Windows with MSVC it will be "msvc". On macOS and linux it is "unix". Borrowed from https://github.com/pyca/cryptography/blob\ /05b34433fccdc2fec0bb014c3668068169d769fd/src/_cffi_src/utils.py#L78
entailment
def set_metrics_params(self, enable=None, store_dir=None, restore=None, no_cores=None): """Sets basic Metrics subsystem params. uWSGI metrics subsystem allows you to manage "numbers" from your apps. When enabled, the subsystem configures a vast amount of metrics (like requests per-core...
Sets basic Metrics subsystem params. uWSGI metrics subsystem allows you to manage "numbers" from your apps. When enabled, the subsystem configures a vast amount of metrics (like requests per-core, memory usage, etc) but, in addition to this, you can configure your own metrics, such as ...
entailment
def set_metrics_threshold(self, name, value, check_interval=None, reset_to=None, alarm=None, alarm_message=None): """Sets metric threshold parameters. :param str|unicode name: Metric name. :param int value: Threshold value. :param int reset_to: Reset value to when threshold is reached...
Sets metric threshold parameters. :param str|unicode name: Metric name. :param int value: Threshold value. :param int reset_to: Reset value to when threshold is reached. :param int check_interval: Threshold check interval in seconds. :param str|unicode|AlarmType alarm: Alarm...
entailment
def set_stats_params( self, address=None, enable_http=None, minify=None, no_cores=None, no_metrics=None, push_interval=None): """Enables stats server on the specified address. * http://uwsgi.readthedocs.io/en/latest/StatsServer.html :param str|unicode address: Address/s...
Enables stats server on the specified address. * http://uwsgi.readthedocs.io/en/latest/StatsServer.html :param str|unicode address: Address/socket to make stats available on. Examples: * 127.0.0.1:1717 * /tmp/statsock * :5050 :param...
entailment
def register_stats_pusher(self, pusher): """Registers a pusher to be used for pushing statistics to various remotes/locals. :param Pusher|list[Pusher] pusher: """ for pusher in listify(pusher): self._set('stats-push', pusher, multi=True) return self._section
Registers a pusher to be used for pushing statistics to various remotes/locals. :param Pusher|list[Pusher] pusher:
entailment
def enable_snmp(self, address, community_string): """Enables SNMP. uWSGI server embeds a tiny SNMP server that you can use to integrate your web apps with your monitoring infrastructure. * http://uwsgi.readthedocs.io/en/latest/SNMP.html .. note:: SNMP server is started in the ...
Enables SNMP. uWSGI server embeds a tiny SNMP server that you can use to integrate your web apps with your monitoring infrastructure. * http://uwsgi.readthedocs.io/en/latest/SNMP.html .. note:: SNMP server is started in the master process after dropping the privileges. If ...
entailment
def mount(self, mountpoint, app, into_worker=False): """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...
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...
entailment
def switch_into_lazy_mode(self, affect_master=None): """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 ...
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...
entailment
def set_basic_params( self, workers=None, zerg_server=None, fallback_node=None, concurrent_events=None, cheap_mode=None, stats_server=None, quiet=None, buffer_size=None, keepalive=None, resubscribe_addresses=None): """ :param int workers: Number of worker processes to...
:param int workers: Number of worker processes to spawn. :param str|unicode zerg_server: Attach the router to a zerg server. :param str|unicode fallback_node: Fallback to the specified node in case of error. :param int concurrent_events: Set the maximum number of concurrent events router can ...
entailment
def set_connections_params( self, harakiri=None, timeout_socket=None, retry_delay=None, timeout_headers=None, timeout_backend=None): """Sets connection-related parameters. :param int harakiri: Set gateway harakiri timeout (seconds). :param int timeout_socket: Node socket timeout (s...
Sets connection-related parameters. :param int harakiri: Set gateway harakiri timeout (seconds). :param int timeout_socket: Node socket timeout (seconds). Used to set the SPDY timeout. This is the maximum amount of inactivity after the SPDY connection is closed. De...
entailment