signature
stringlengths
8
3.44k
body
stringlengths
0
1.41M
docstring
stringlengths
1
122k
id
stringlengths
5
17
def __init__(self, timeout):
super(ActionSetHarakiri, self).__init__(timeout)<EOL>
:param int timeout:
f13051:c29:m0
def __init__(self, dir):
super(ActionDirChange, self).__init__(dir)<EOL>
:param str|unicode dir: Directory to change into.
f13051:c30:m0
def __init__(self, app):
super(ActionSetVarUwsgiAppid, self).__init__(app)<EOL>
:param str|unicode app: Application ID.
f13051:c31:m0
def __init__(self, user):
super(ActionSetVarRemoteUser, self).__init__(user)<EOL>
:param str|unicode user: Username.
f13051:c32:m0
def __init__(self, dir):
super(ActionSetVarUwsgiHome, self).__init__(dir)<EOL>
:param str|unicode dir: Directory to make a new home.
f13051:c33:m0
def __init__(self, value):
super(ActionSetVarUwsgiScheme, self).__init__(value)<EOL>
:param str|unicode value:
f13051:c34:m0
def __init__(self, name):
super(ActionSetVarScriptName, self).__init__(name)<EOL>
:param str|unicode name: Script name
f13051:c35:m0
def __init__(self, name):
super(ActionSetVarRequestMethod, self).__init__(name)<EOL>
:param str|unicode name: Method name.
f13051:c36:m0
def __init__(self, value):
super(ActionSetVarRequestUri, self).__init__(value)<EOL>
:param str|unicode value: URI
f13051:c37:m0
def __init__(self, value):
super(ActionSetVarRemoteAddr, self).__init__(value)<EOL>
:param str|unicode value: Address.
f13051:c38:m0
def __init__(self, value):
super(ActionSetVarPathInfo, self).__init__(value)<EOL>
:param str|unicode value: New info.
f13051:c39:m0
def __init__(self, value):
super(ActionSetVarDocumentRoot, self).__init__(value)<EOL>
:param str|unicode value:
f13051:c40:m0
def __init__(self, name):
super(ActionSetUwsgiProcessName, self).__init__(name)<EOL>
:param str|unicode name: New process name.
f13051:c41:m0
def __init__(self, fpath):
super(ActionSetScriptFile, self).__init__(fpath)<EOL>
:param str|unicode fpath: File path.
f13051:c43:m0
def __init__(self, subject, negate=False):
self._subject = subject<EOL>self.negate = negate<EOL>super(SubjectCustom, self).__init__()<EOL>
:param Var|str|unicode subject: Handwritten subject or a Var heir representing it. :param bool negate: Use to negate subject for rule. .. note:: You can also use tilde (~) instead of this argument for nagation.
f13052:c1:m0
def exists(self):
return self._setup('<STR_LIT>')<EOL>
Check if the subject exists in the filesystem.
f13052:c1:m3
def isfile(self):
return self._setup('<STR_LIT>')<EOL>
Check if the subject is a file.
f13052:c1:m4
def isdir(self):
return self._setup('<STR_LIT>')<EOL>
Check if the subject is a directory.
f13052:c1:m5
def islink(self):
return self._setup('<STR_LIT>')<EOL>
Check if the subject is a link.
f13052:c1:m6
def isexec(self):
return self._setup('<STR_LIT>')<EOL>
Check if the subject is an executable file.
f13052:c1:m7
def islord(self):
return self._setup('<STR_LIT>')<EOL>
Check if the subject is a Legion Lord.
f13052:c1:m8
def contains_ipv4(self):
return self._setup('<STR_LIT>')<EOL>
Check if the subject is ip v4.
f13052:c1:m9
def contains_ipv6(self):
return self._setup('<STR_LIT>')<EOL>
Check if the subject is ip v6.
f13052:c1:m10
def eq(self, val):
return self._setup('<STR_LIT>', val)<EOL>
Check if the subject is equal to the specified pattern.
f13052:c1:m11
def ge(self, val):
return self._setup('<STR_LIT>', val)<EOL>
Check if the subject is greater than or equal to the specified pattern.
f13052:c1:m12
def le(self, val):
return self._setup('<STR_LIT>', val)<EOL>
Check if the subject is less than or equal to the specified pattern.
f13052:c1:m13
def gt(self, val):
return self._setup('<STR_LIT>', val)<EOL>
Check if the subject is greater than the specified pattern.
f13052:c1:m14
def lt(self, val):
return self._setup('<STR_LIT>', val)<EOL>
Check if the subject is less than the specified pattern.
f13052:c1:m15
def startswith(self, val):
return self._setup('<STR_LIT>', val)<EOL>
Check if the subject starts with the specified pattern.
f13052:c1:m16
def endswith(self, val):
return self._setup('<STR_LIT>', val)<EOL>
Check if the subject ends with the specified pattern.
f13052:c1:m17
def matches(self, regexp):
return self._setup('<STR_LIT>', regexp)<EOL>
Check if the subject matches the specified regexp.
f13052:c1:m18
def isempty(self):
return self._setup('<STR_LIT>')<EOL>
Check if the subject is empty.
f13052:c1:m19
def contains(self, val):
return self._setup('<STR_LIT>', val)<EOL>
Check if the subject contains the specified pattern.
f13052:c1:m20
def __init__(self, address, bound_workers=None, modifier=None):
self.address = address<EOL>self.bound_workers = listify(bound_workers or [])<EOL>self._make_section_like()<EOL>if modifier:<EOL><INDENT>self._set('<STR_LIT>' % self.name, modifier.code)<EOL>submod = modifier.submod<EOL>if submod:<EOL><INDENT>self._set('<STR_LIT>' % self.name, modifier.submod)<EOL><DEDENT><DEDENT>super(...
:param str|unicode|SocketShared address: Address ([host]:port or socket file) to bind socket to. :param str|unicode|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 specific workers to specific sockets to implement a s...
f13053:c0:m0
def __init__(self, address, http11=False, bound_workers=None, modifier=None):
if http11:<EOL><INDENT>self.name = '<STR_LIT>'<EOL><DEDENT>super(SocketHttp, self).__init__(address, bound_workers=bound_workers, modifier=modifier)<EOL>
:param str|unicode|SocketShared address: Address ([host]:port or socket file) to bind socket to. :param bool http11: Keep-Alive support. If set the server will try to maintain the connection opened if a bunch of rules are respected. This is not a smart http 1.1 parser (to avoid parsing the whole response) ...
f13053:c2:m0
def __init__(self, address, cert, key, ciphers=None, client_ca=None, bound_workers=None, modifier=None):
super(SocketHttps, self).__init__(address, bound_workers=bound_workers, modifier=modifier)<EOL>args = [cert, key]<EOL>if ciphers or client_ca:<EOL><INDENT>args.extend([ciphers or '<STR_LIT>', client_ca or '<STR_LIT>'])<EOL><DEDENT>self.args.extend(args)<EOL>
:param str|unicode|SocketShared address: Address ([host]:port or socket file) to bind socket to. :param str|unicode cert: Certificate file. :param str|unicode key: Private key file. :param str|unicode ciphers: Ciphers [alias] string. Example: * DEFAULT * HIGH * DHE, EDH * https://ww...
f13053:c3:m0
def __init__(self, address, persistent=False, bound_workers=None, modifier=None):
if persistent:<EOL><INDENT>self.name = '<STR_LIT>'<EOL><DEDENT>super(SocketUwsgi, self).__init__(address, bound_workers=bound_workers, modifier=modifier)<EOL>
:param str|unicode|SocketShared address: Address ([host]:port or socket file) to bind socket to. :param bool persistent: Use persistent uwsgi protocol (puwsgi). :param str|unicode|int|list bound_workers: Map socket to specific workers. As you can bind a uWSGI instance to multiple sockets, you can use this option...
f13053:c4:m0
def __init__(self, address, nph=False, bound_workers=None, modifier=None):
if nph:<EOL><INDENT>self.name = '<STR_LIT>'<EOL><DEDENT>super(SocketFastcgi, self).__init__(address, bound_workers=bound_workers, modifier=modifier)<EOL>
:param str|unicode|SocketShared address: Address ([host]:port or socket file) to bind socket to. :param bool nph: Use NPH mode ("no-parsed-header" - bypass the server completely by sending the complete HTTP header directly to the browser). :param str|unicode|int|list bound_workers: Map socket to specific workers...
f13053:c7:m0
def __init__(self, address, nph=False, bound_workers=None, modifier=None):
if nph:<EOL><INDENT>self.name = '<STR_LIT>'<EOL><DEDENT>super(SocketScgi, self).__init__(address, bound_workers=bound_workers, modifier=modifier)<EOL>
:param str|unicode|SocketShared address: Address ([host]:port or socket file) to bind socket to. :param bool nph: Use NPH mode ("no-parsed-header" - bypass the server completely by sending the complete HTTP header directly to the browser). :param str|unicode|int|list bound_workers: Map socket to specific workers...
f13053:c8:m0
def __init__(self, address, undeferred=False, bound_workers=None, modifier=None):
if undeferred:<EOL><INDENT>self.name = '<STR_LIT>'<EOL><DEDENT>super(SocketShared, self).__init__(address, bound_workers=bound_workers, modifier=modifier)<EOL>
:param str|unicode address: Address ([host]:port or socket file) to bind socket to. :param bool undeferred: Use shared socket undeferred mode. :param str|unicode|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 specif...
f13053:c10:m0
@classmethod<EOL><INDENT>def _get_code_str(cls, src):<DEDENT>
return str(src) if src is not None else '<STR_LIT>'<EOL>
:param src: :rtype: str|unicode
f13054:c0:m1
@submod.getter<EOL><INDENT>def submod(self):<DEDENT>
return self._get_code_str(self._submod)<EOL>
Modifier 2 value. :rtype: str|unicode
f13054:c0:m3
def register_metric(self, metric):
for metric in listify(metric):<EOL><INDENT>self._set('<STR_LIT>', metric, multi=True)<EOL><DEDENT>return self._section<EOL>
Officially Registered Metrics: * ``worker`` 3 - exports information about workers. Example: worker.1.requests **[or 3.1.1]** reports the number of requests served by worker 1. * ``plugin`` 4 - namespace for metrics automatically added by plugins. Example: plugins.foo.bar * ``core`` 5 - ...
f13056:c0:m0
def set_metrics_params(self, enable=None, store_dir=None, restore=None, no_cores=None):
self._set('<STR_LIT>', enable, cast=bool)<EOL>self._set('<STR_LIT>', self._section.replace_placeholders(store_dir))<EOL>self._set('<STR_LIT>', restore, cast=bool)<EOL>self._set('<STR_LIT>', no_cores, cast=bool)<EOL>return self._section<EOL>
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 ...
f13056:c0:m1
def set_metrics_threshold(self, name, value, check_interval=None, reset_to=None, alarm=None, alarm_message=None):
if alarm is not None and isinstance(alarm, AlarmType):<EOL><INDENT>self._section.alarms.register_alarm(alarm)<EOL>alarm = alarm.alias<EOL><DEDENT>value = KeyValue(<EOL>locals(),<EOL>aliases={<EOL>'<STR_LIT:name>': '<STR_LIT:key>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',...
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...
f13056:c0:m2
def set_stats_params(<EOL>self, address=None, enable_http=None,<EOL>minify=None, no_cores=None, no_metrics=None, push_interval=None):
self._set('<STR_LIT>', address)<EOL>self._set('<STR_LIT>', enable_http, cast=bool)<EOL>self._set('<STR_LIT>', minify, cast=bool)<EOL>self._set('<STR_LIT>', no_cores, cast=bool)<EOL>self._set('<STR_LIT>', no_metrics, cast=bool)<EOL>self._set('<STR_LIT>', push_interval)<EOL>return self._section<EOL>
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...
f13056:c0:m3
def register_stats_pusher(self, pusher):
for pusher in listify(pusher):<EOL><INDENT>self._set('<STR_LIT>', pusher, multi=True)<EOL><DEDENT>return self._section<EOL>
Registers a pusher to be used for pushing statistics to various remotes/locals. :param Pusher|list[Pusher] pusher:
f13056:c0:m4
def enable_snmp(self, address, community_string):
self._set('<STR_LIT>', address)<EOL>self._set('<STR_LIT>', community_string)<EOL>return self._section<EOL>
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 ...
f13056:c0:m5
def set_basic_params(self, count=None, thunder_lock=None, lock_engine=None):
self._set('<STR_LIT>', thunder_lock, cast=bool)<EOL>self._set('<STR_LIT>', lock_engine)<EOL>self._set('<STR_LIT>', count)<EOL>return self._section<EOL>
: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|unicode lock_engine: Set the lock en...
f13057:c0:m0
def set_ipcsem_params(self, ftok=None, persistent=None):
self._set('<STR_LIT>', ftok)<EOL>self._set('<STR_LIT>', persistent, cast=bool)<EOL>return self._section<EOL>
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.
f13057:c0:m1
def lock_file(self, fpath, after_setup=False, wait=False):
command = '<STR_LIT>' if wait else '<STR_LIT>'<EOL>if after_setup:<EOL><INDENT>command = '<STR_LIT>' % command<EOL><DEDENT>self._set(command, fpath)<EOL>return self._section<EOL>
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
f13057:c0:m2
def set_basic_params(<EOL>self, enable=None, name=None, no_orphans=None, as_root=None,<EOL>subproc_check_interval=None, fifo_file=None):
self._set('<STR_LIT>', enable, cast=bool)<EOL>self._set('<STR_LIT>', name)<EOL>self._set('<STR_LIT>', no_orphans)<EOL>self._set('<STR_LIT>', as_root)<EOL>self._set('<STR_LIT>', subproc_check_interval)<EOL>self._set('<STR_LIT>', self._section.replace_placeholders(fifo_file), multi=True)<EOL>return self._section<EOL>
:param bool enable: Enable uWSGI master process. :param str|unicode master_enabled: Set master process name to given value. :param bool no_orphans: Automatically kill workers if master dies (can be dangerous for availability). :param bool as_root: Leave master process running as root. :param int subproc_check_inter...
f13058:c0:m0
def set_exit_events(self, no_workers=None, idle=None, reload=None, sig_term=None):
self._set('<STR_LIT>', no_workers, cast=bool)<EOL>self._set('<STR_LIT>', reload, cast=bool)<EOL>self._set('<STR_LIT>', sig_term, cast=bool)<EOL>self.set_idle_params(exit=idle)<EOL>return self._section<EOL>
Do exit on certain events :param bool no_workers: Shutdown uWSGI when no workers are running. :param bool idle: Shutdown uWSGI when idle. :param bool reload: Force exit even if a reload is requested. :param bool sig_term: Exit on SIGTERM instead of brutal workers reload. ...
f13058:c0:m1
def set_exception_handling_params(self, handler=None, catch=None, no_write_exception=None):
self._set('<STR_LIT>', handler, multi=True)<EOL>self._set('<STR_LIT>', catch, cast=bool)<EOL>self._set('<STR_LIT>', no_write_exception, cast=bool)<EOL>return self._section<EOL>
Exception handling related params. :param str|unicode|list[str|unicode] handler: Register one or more exception handling C-functions. :param bool catch: Catch exceptions and report them as http output (including stack trace and env params). .. warning:: Use only for testing purposes. ...
f13058:c0:m2
def set_idle_params(self, timeout=None, exit=None):
self._set('<STR_LIT>', timeout)<EOL>self._set('<STR_LIT>', exit, cast=bool)<EOL>return self._section<EOL>
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.
f13058:c0:m3
def set_reload_params(self, mercy=None, exit=None):
self._set('<STR_LIT>', mercy)<EOL>self.set_exit_events(reload=exit)<EOL>return self._section<EOL>
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.
f13058:c0:m4
def add_cron_task(<EOL>self, command, weekday=None, month=None, day=None, hour=None, minute=None,<EOL>legion=None, unique=None, harakiri=None):
rule = KeyValue(<EOL>locals(),<EOL>keys=['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'],<EOL>aliases={'<STR_LIT>': '<STR_LIT>'},<EOL>bool_keys=['<STR_LIT>'],<EOL>)<EOL>self._set('<STR_LIT>', ('<STR_LIT>' % (rule, command)).strip(), multi=True)<EOL>return self._se...
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...
f13058:c0:m5
def attach_process_classic(self, command_or_pid_path, background, control=False, for_legion=False):
prefix = '<STR_LIT>' if for_legion else '<STR_LIT>'<EOL>if '<STR_LIT>' in command_or_pid_path:<EOL><INDENT>if background:<EOL><INDENT>self._set(prefix + '<STR_LIT>', command_or_pid_path, multi=True)<EOL><DEDENT>else:<EOL><INDENT>self._set(prefix + '<STR_LIT>', command_or_pid_path, multi=True)<EOL><DEDENT><DEDENT>else:<...
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...
f13058:c0:m6
def attach_process(<EOL>self, command, for_legion=False, broken_counter=None, pidfile=None, control=None, daemonize=None,<EOL>touch_reload=None, signal_stop=None, signal_reload=None, honour_stdin=None,<EOL>uid=None, gid=None, new_pid_ns=None, change_dir=None):
rule = KeyValue(<EOL>locals(),<EOL>keys=[<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>],<EOL>aliases={<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>':...
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 ...
f13058:c0:m7
def set_basic_params(<EOL>self, touch_reload=None, priority=None, vacuum=None, binary_path=None, honour_stdin=None):
self._set('<STR_LIT>', touch_reload, multi=True)<EOL>self._set('<STR_LIT>', priority)<EOL>self._set('<STR_LIT>', vacuum, cast=bool)<EOL>self._set('<STR_LIT>', binary_path)<EOL>self._set('<STR_LIT>', honour_stdin, cast=bool)<EOL>return self._section<EOL>
:param str|list touch_reload: Reload uWSGI if the specified file or directory is modified/touched. :param int priority: Set processes/threads priority (``nice``) value. :param bool vacuum: Try to remove all of the generated files/sockets (UNIX sockets and pidfiles) upon exit. :param str|unicode binary_path: Forc...
f13061:c0:m1
def set_memory_params(self, ksm_interval=None, no_swap=None):
self._set('<STR_LIT>', ksm_interval)<EOL>self._set('<STR_LIT>', no_swap, cast=bool)<EOL>return self._section<EOL>
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/...
f13061:c0:m2
def daemonize(self, log_into, after_app_loading=False):
self._set('<STR_LIT>' if after_app_loading else '<STR_LIT>', log_into)<EOL>return self._section<EOL>
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....
f13061:c0:m3
def change_dir(self, to, after_app_loading=False):
self._set('<STR_LIT>' if after_app_loading else '<STR_LIT>', to)<EOL>return self._section<EOL>
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
f13061:c0:m4
def set_owner_params(self, uid=None, gid=None, add_gids=None, set_asap=False):
prefix = '<STR_LIT>' if set_asap else '<STR_LIT>'<EOL>self._set(prefix + '<STR_LIT>', uid)<EOL>self._set(prefix + '<STR_LIT>', gid)<EOL>self._set('<STR_LIT>', add_gids, multi=True)<EOL>self.owner = [uid, gid]<EOL>return self._section<EOL>
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...
f13061:c0:m5
def get_owner(self, default=True):
uid, gid = self.owner<EOL>if not uid and default:<EOL><INDENT>uid = os.getuid()<EOL><DEDENT>if not gid and default:<EOL><INDENT>gid = os.getgid()<EOL><DEDENT>return uid, gid<EOL>
Return (User ID, Group ID) tuple :param bool default: Whether to return default if not set. :rtype: tuple[int, int]
f13061:c0:m6
def set_hook(self, phase, action):
self._set('<STR_LIT>' % phase, action, multi=True)<EOL>return self._section<EOL>
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:
f13061:c0:m7
def set_hook_touch(self, fpath, action):
self._set('<STR_LIT>', '<STR_LIT>' % (fpath, action), multi=True)<EOL>return self._section<EOL>
Allows running certain action when the specified file is touched. :param str|unicode fpath: File path. :param str|unicode|list|HookAction|list[HookAction] action:
f13061:c0:m8
def set_hook_after_request(self, func):
self._set('<STR_LIT>', func, multi=True)<EOL>return self._section<EOL>
Run the specified function/symbol (C level) after each request. :param str|unicode func:
f13061:c0:m9
def set_on_exit_params(self, skip_hooks=None, skip_teardown=None):
self._set('<STR_LIT>', skip_hooks, cast=bool)<EOL>self._set('<STR_LIT>', skip_teardown, cast=bool)<EOL>return self._section<EOL>
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...
f13061:c0:m10
def run_command_on_event(self, command, phase=phases.ASAP):
self._set('<STR_LIT>' % phase, command, multi=True)<EOL>return self._section<EOL>
Run the given command on a given phase. :param str|unicode command: :param str|unicode phase: See constants in ``Phases`` class.
f13061:c0:m11
def run_command_on_touch(self, command, target):
self._set('<STR_LIT>', '<STR_LIT>' % (target, command), multi=True)<EOL>return self._section<EOL>
Run command when the specified file is modified/touched. :param str|unicode command: :param str|unicode target: File path.
f13061:c0:m12
def set_pid_file(self, fpath, before_priv_drop=True, safe=False):
command = '<STR_LIT>'<EOL>if not before_priv_drop:<EOL><INDENT>command += '<STR_LIT:2>'<EOL><DEDENT>if safe:<EOL><INDENT>command = '<STR_LIT>' + command<EOL><DEDENT>self._set(command, fpath)<EOL>return self._section<EOL>
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...
f13061:c0:m13
def set_naming_params(self, autonaming=None, prefix=None, suffix=None, name=None):
self._set('<STR_LIT>', autonaming, cast=bool)<EOL>self._set('<STR_LIT>' % ('<STR_LIT>' if prefix and prefix.endswith('<STR_LIT:U+0020>') else '<STR_LIT>'), prefix)<EOL>self._set('<STR_LIT>', suffix)<EOL>self._set('<STR_LIT>', name)<EOL>return self._section<EOL>
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...
f13061:c0:m14
def __init__(self, on=None):
self._make_section_like()<EOL>command = self.on_command or self.alias<EOL>self._set(command, on)<EOL>super(RouterBase, self).__init__()<EOL>
:param SocketShared|str|unicode on: Activates the router on the given address.
f13062:c0:m1
def set_basic_params(<EOL>self, workers=None, zerg_server=None, fallback_node=None, concurrent_events=None,<EOL>cheap_mode=None, stats_server=None):
self._set_aliased('<STR_LIT>', workers)<EOL>self._set_aliased('<STR_LIT>', zerg_server)<EOL>self._set_aliased('<STR_LIT>', fallback_node)<EOL>self._set_aliased('<STR_LIT>', concurrent_events)<EOL>self._set_aliased('<STR_LIT>', cheap_mode, cast=bool)<EOL>self._set_aliased('<STR_LIT>', stats_server)<EOL>return self<EOL>
: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 manage. Default: sy...
f13062:c1:m0
def set_connections_params(self, harakiri=None, timeout_socket=None, retry_delay=None):
self._set_aliased('<STR_LIT>', harakiri)<EOL>self._set_aliased('<STR_LIT>', timeout_socket)<EOL>self._set_aliased('<STR_LIT>', retry_delay)<EOL>return self<EOL>
Sets connection-related parameters. :param int harakiri: Set gateway harakiri timeout (seconds). :param int timeout_socket: Node socket timeout (seconds). Default: 60. :param int retry_delay: Retry connections to dead static nodes after the specified amount of seconds. Default: 30...
f13062:c1:m1
def __init__(self, sockets_dir):
if '<STR_LIT:%s>' in sockets_dir:<EOL><INDENT>self.name = '<STR_LIT>'<EOL><DEDENT>super(ForwarderPath, self).__init__(sockets_dir)<EOL>
:param str|unicode sockets_dir: UNIX sockets directory. Allows %s to denote key (domain).
f13062:c3:m0
def __init__(self, script, func, modifier=None):
modifier = modifier or ModifierWsgi<EOL>super(ForwarderCode, self).__init__(modifier.code, script, func)<EOL>
:param str|unicode script: Script (module for Python) name to get function from. :param str|unicode func: Function name. :param Modifier modifier: Routing modifier.
f13062:c4:m0
def __init__(self, cache_name=None):
super(ForwarderCache, self).__init__(cache_name)<EOL>
:param str|unicode cache_name: Cache name to use.
f13062:c5:m0
def __init__(self, socket):
super(ForwarderSocket, self).__init__(socket)<EOL>
:param str|unicode socket: Socket filepath.
f13062:c6:m0
def __init__(self, address):
super(ForwarderSubscriptionServer, self).__init__(address)<EOL>
:param str|unicode address: Address (including port) to run the subscription server on.
f13062:c7:m0
def __init__(self, on=None, forward_to=None):
super(_RouterWithForwarders, self).__init__(on)<EOL>if forward_to is not None:<EOL><INDENT>if isinstance(forward_to, Forwarder):<EOL><INDENT>value = '<STR_LIT:%s>' % forward_to<EOL>self._set_aliased(forward_to.name, value, multi=True)<EOL><DEDENT>else:<EOL><INDENT>self._set_aliased('<STR_LIT:to>', forward_to, multi=Tru...
Activates the router on the given address. :param SocketShared|str|unicode on: Activates the router on the given address. :param Forwarder|str|unicode|list[str|unicode] forward_to: Where to forward requests. Expects a forwarder instance or one or more node names.
f13062:c8:m0
def set_basic_params(<EOL>self, workers=None, zerg_server=None, fallback_node=None, concurrent_events=None,<EOL>cheap_mode=None, stats_server=None, quiet=None, buffer_size=None):
super(_RouterWithForwarders, self).set_basic_params(**filter_locals(locals(), drop=[<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>]))<EOL>self._set_aliased('<STR_LIT>', quiet, cast=bool)<EOL>self._set_aliased('<STR_LIT>', buffer_size)<EOL>return self<EOL>
: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 manage. Default: sy...
f13062:c8:m1
def set_basic_params(<EOL>self, workers=None, zerg_server=None, fallback_node=None, concurrent_events=None,<EOL>cheap_mode=None, stats_server=None, quiet=None, buffer_size=None,<EOL>keepalive=None, resubscribe_addresses=None):
super(RouterHttp, self).set_basic_params(**filter_locals(locals(), drop=[<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>]))<EOL>self._set_aliased('<STR_LIT>', keepalive)<EOL>self._set_aliased('<STR_LIT>', resubscribe_addresses, multi=True)<EOL>return self<EOL>
: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 manage. Default: sy...
f13062:c9:m0
def set_connections_params(<EOL>self, harakiri=None, timeout_socket=None, retry_delay=None, timeout_headers=None, timeout_backend=None):
super(RouterHttp, self).set_connections_params(<EOL>**filter_locals(locals(), ['<STR_LIT>', '<STR_LIT>']))<EOL>self._set_aliased('<STR_LIT>', timeout_headers)<EOL>self._set_aliased('<STR_LIT>', timeout_backend)<EOL>return self<EOL>
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...
f13062:c9:m1
def set_manage_params(<EOL>self, chunked_input=None, chunked_output=None, gzip=None, websockets=None, source_method=None,<EOL>rtsp=None, proxy_protocol=None):
self._set_aliased('<STR_LIT>', chunked_input, cast=bool)<EOL>self._set_aliased('<STR_LIT>', chunked_output, cast=bool)<EOL>self._set_aliased('<STR_LIT>', gzip, cast=bool)<EOL>self._set_aliased('<STR_LIT>', websockets, cast=bool)<EOL>self._set_aliased('<STR_LIT>', source_method, cast=bool)<EOL>self._set_aliased('<STR_LI...
Allows enabling various automatic management mechanics. * http://uwsgi.readthedocs.io/en/latest/Changelog-1.9.html#http-router-keepalive-auto-chunking-auto-gzip-and-transparent-websockets :param bool chunked_input: Automatically detect chunked input requests and put the session in raw mode. :...
f13062:c9:m2
def set_owner_params(self, uid=None, gid=None):
self._set_aliased('<STR_LIT>', uid)<EOL>self._set_aliased('<STR_LIT>', gid)<EOL>return self<EOL>
Drop http router privileges to specified user and 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.
f13062:c9:m3
def __init__(<EOL>self, on, cert, key, ciphers=None, client_ca=None, session_context=None, use_spdy=None,<EOL>export_cert_var=None):
on = KeyValue(<EOL>filter_locals(locals(), drop=['<STR_LIT>']),<EOL>aliases={'<STR_LIT>': '<STR_LIT>', '<STR_LIT>': '<STR_LIT>'},<EOL>bool_keys=['<STR_LIT>'],<EOL>)<EOL>super(_RouterWithForwarders, self).__init__(on)<EOL>self._set_aliased('<STR_LIT>', session_context)<EOL>
Binds https router to run on the given address. :param SocketShared|str|unicode on: Activates the router on the given address. :param str|unicode cert: Certificate file. :param str|unicode key: Private key file. :param str|unicode ciphers: Ciphers [alias] string. Example...
f13062:c10:m0
def __init__(self, on, cert, key, forward_to=None, ciphers=None, client_ca=None, session_context=None, use_sni=None):
on = KeyValue(<EOL>filter_locals(locals(), drop=['<STR_LIT>', '<STR_LIT>']),<EOL>aliases={'<STR_LIT>': '<STR_LIT>'},<EOL>)<EOL>self._set_aliased('<STR_LIT>', session_context)<EOL>self._set_aliased('<STR_LIT>', use_sni, cast=bool)<EOL>super(RouterSsl, self).__init__(on, forward_to)<EOL>
Activates the router on the given address. :param SocketShared|str|unicode on: Activates the router on the given address. :param str|unicode cert: Certificate file. :param str|unicode key: Private key file. :param Forwarder|str|unicode|list[str|unicode] forward_to: Where to forward r...
f13062:c11:m0
def set_connections_params(self, harakiri=None, timeout_socket=None, retry_delay=None, retry_max=None):
super(RouterSsl, self).set_connections_params(**filter_locals(locals(), ['<STR_LIT>']))<EOL>self._set_aliased('<STR_LIT>', retry_max)<EOL>return self<EOL>
Sets connection-related parameters. :param int harakiri: Set gateway harakiri timeout (seconds). :param int timeout_socket: Node socket timeout (seconds). Default: 60. :param int retry_delay: Retry connections to dead static nodes after the specified amount of seconds. Default: 30...
f13062:c11:m1
def set_basic_params(<EOL>self, workers=None, zerg_server=None, fallback_node=None, concurrent_events=None,<EOL>cheap_mode=None, stats_server=None, quiet=None, buffer_size=None,<EOL>fallback_nokey=None, subscription_key=None, emperor_command_socket=None):
super(RouterFast, self).set_basic_params(**filter_locals(locals(), [<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>]))<EOL>self._set_aliased('<STR_LIT>', fallback_nokey, cast=bool)<EOL>self._set_aliased('<STR_LIT>', subscription_key)<EOL>self._set_aliased('<STR_LIT>', emperor_command_socket)<EOL>return self<EO...
: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 manage. Default: sy...
f13062:c12:m0
def set_resubscription_params(self, addresses=None, bind_to=None):
self._set_aliased('<STR_LIT>', addresses, multi=True)<EOL>self._set_aliased('<STR_LIT>', bind_to)<EOL>return self<EOL>
You can specify a dgram address (udp or unix) on which all of the subscriptions request will be forwarded to (obviously changing the node address to the router one). The system could be useful to build 'federated' setup. * http://uwsgi.readthedocs.io/en/latest/Changelog-2.0.1.html#resubscripti...
f13062:c12:m1
def set_connections_params(self, harakiri=None, timeout_socket=None, retry_delay=None, retry_max=None, defer=None):
super(RouterFast, self).set_connections_params(**filter_locals(locals(), ['<STR_LIT>', '<STR_LIT>']))<EOL>self._set_aliased('<STR_LIT>', retry_max)<EOL>self._set_aliased('<STR_LIT>', defer)<EOL>return self<EOL>
Sets connection-related parameters. :param int harakiri: Set gateway harakiri timeout (seconds). :param int timeout_socket: Node socket timeout (seconds). Default: 60. :param int retry_delay: Retry connections to dead static nodes after the specified amount of seconds. Default: 3...
f13062:c12:m2
def set_postbuffering_params(self, size=None, store_dir=None):
self._set_aliased('<STR_LIT>', size)<EOL>self._set_aliased('<STR_LIT>', store_dir)<EOL>return self<EOL>
Sets buffering params. Web-proxies like nginx are "buffered", so they wait til the whole request (and its body) has been read, and then it sends it to the backends. :param int size: The size (in bytes) of the request body after which the body will be stored to disk (as a temporary ...
f13062:c12:m3
def set_owner_params(self, uid=None, gid=None):
self._set_aliased('<STR_LIT>', uid)<EOL>self._set_aliased('<STR_LIT>', gid)<EOL>return self<EOL>
Drop http router privileges to specified user and 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.
f13062:c12:m4
def set_connections_params(<EOL>self, harakiri=None, timeout_socket=None, retry_delay=None, retry_max=None, use_xclient=None):
super(RouterRaw, self).set_connections_params(**filter_locals(locals(), ['<STR_LIT>', '<STR_LIT>']))<EOL>self._set_aliased('<STR_LIT>', retry_max)<EOL>self._set_aliased('<STR_LIT>', use_xclient)<EOL>return self<EOL>
Sets connection-related parameters. :param int harakiri: Set gateway harakiri timeout (seconds). :param int timeout_socket: Node socket timeout (seconds). Default: 60. :param int retry_delay: Retry connections to dead static nodes after the specified amount of seconds. Default: 3...
f13062:c13:m0
def __init__(self, on=None, undeferred=False):
router_name = self.alias<EOL>if undeferred:<EOL><INDENT>router_name = '<STR_LIT>'<EOL><DEDENT>self.on_command = router_name<EOL>super(RouterForkPty, self).__init__(on)<EOL>
Binds router to run on the given address. :param SocketShared|str|unicode on: Activates the router on the given address. :param bool undeferred: Run router in undeferred mode.
f13062:c14:m0
def set_basic_params(<EOL>self, workers=None, zerg_server=None, fallback_node=None, concurrent_events=None,<EOL>cheap_mode=None, stats_server=None, run_command=None):
super(RouterForkPty, self).set_basic_params(**filter_locals(locals(), ['<STR_LIT>']))<EOL>self._set_aliased('<STR_LIT>', run_command)<EOL>return self<EOL>
: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 manage. Default: sy...
f13062:c14:m1
def set_connections_params(self, harakiri=None, timeout_socket=None):
self._set_aliased('<STR_LIT>', harakiri)<EOL>self._set_aliased('<STR_LIT>', timeout_socket)<EOL>return self<EOL>
Sets connection-related parameters. :param int harakiri: Set gateway harakiri timeout (seconds). :param int timeout_socket: Node socket timeout (seconds). Default: 60.
f13062:c14:m2
def set_window_params(self, cols=None, rows=None):
self._set_aliased('<STR_LIT>', cols)<EOL>self._set_aliased('<STR_LIT>', rows)<EOL>return self<EOL>
Sets pty window params. :param int cols: :param int rows:
f13062:c14:m3