Master process¶
Classes¶
MasterProcess¶
Master process is a separate process offering mentoring capabilities for other processes. Only one master process per uWSGI instance.
uWSGI's built-in prefork+threading multi-worker management mode, activated by flicking the master switch on.
Note
For all practical serving deployments it's not really a good idea not to use master mode.
add_cron_task¶
-
Command to execute on schedule (with or without path).
-
Day of the week number. Defaults to
each. 0 - Sunday 1 - Monday 2 - Tuesday 3 - Wednesday 4 - Thursday 5 - Friday 6 - Saturday -
Month number 1-12. Defaults to
each. -
Day of the month number 1-31. Defaults to
each. -
Hour 0-23. Defaults to
each. -
Minute 0-59. Defaults to
each. -
Set legion (cluster) name to use this cron command against. Such commands are only executed by legion lord node.
-
Marks command as unique. Default to not unique. Some commands can take a long time to finish or just hang doing their thing. Sometimes this is okay, but there are also cases when running multiple instances of the same command can be dangerous.
-
Enforce a time limit (in seconds) on executed commands. If a command is taking longer it will be killed.
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
1 2 | |
Note
We use cron2 option available since 1.9.11.
attach_process¶
-
The command line to execute.
-
Legion daemons will be executed only on the legion lord node, so there will always be a single daemon instance running in each legion. Once the lord dies a daemon will be spawned on another node.
-
Maximum attempts before considering a daemon "broken".
-
The pidfile path to check (enable smart mode).
-
If True, the daemon becomes a
controlone: if it dies the whole uWSGI instance dies. -
Daemonize the process (enable smart2 mode).
-
List of files to check: whenever they are 'touched', the daemon is restarted
-
The signal number to send to the daemon when uWSGI is stopped.
-
The signal number to send to the daemon when uWSGI is reloaded.
-
The signal number to send to the daemon when uWSGI is reloaded.
-
Drop privileges to the specified uid.
1.. note:: Requires master running as root. -
Drop privileges to the specified gid.
1.. note:: Requires master running as root. -
Spawn the process in a new pid namespace.
1 2 3
.. note:: Requires master running as root. .. note:: Linux only. -
Use chdir() to the specified directory before running the command.
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
attach_process_classic¶
-
Must indicate whether process is in background.
-
Consider this process a control: when the daemon dies, the master exits.
1.. note:: pidfile managed processed not supported. -
Legion daemons will be executed only on the legion lord node, so there will always be a single daemon instance running in each legion. Once the lord dies a daemon will be spawned on another node.
Note
uWSGI 1.9.9+ required.
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 2.0+)
http://uwsgi-docs.readthedocs.io/en/latest/AttachingDaemons.html
set_basic_params¶
-
Enable uWSGI master process.
-
Set master process name to given value.
-
Automatically kill workers if master dies (can be dangerous for availability).
-
Leave master process running as root.
-
Set the interval (in seconds) of master checks. Default: 1 The master process makes a scan of subprocesses, etc. every N seconds.
Warning
You can increase this time if you need to, but it's DISCOURAGED.
-
Enables the master FIFO.
1 2 3 4 5 6 7 8 9 10 11
.. note:: Placeholders can be used to build paths, e.g.: {project_runtime_dir}.fifo See ``Section.project_name`` and ``Section.runtime_dir``. Instead of signals, you can tell the master to create a UNIX named pipe (FIFO) that you may use to issue commands to the master. Up to 10 different FIFO files supported. By default, the first specified is bound (mapped as '0'). * <http://uwsgi.readthedocs.io/en/latest/MasterFIFO.html#the-master-fifo> .. note:: Since 1.9.17
set_exception_handling_params¶
-
Register one or more exception handling C-functions.
-
Catch exceptions and report them as http output (including stack trace and env params).
1.. warning:: Use only for testing purposes. -
Disable exception generation on write()/writev().
1 2 3
.. note:: This can be combined with ``logging.set_filters(write_errors=False, sigpipe=False)``. .. note: Currently available for Python.
Exception handling related params.