Python uwsgi module stub¶
uwsgiconf comes with documented uwsgi module that you can import instead of import uwsgi
.
# Instead of
import uwsgi
# you can do.
from uwsgiconf import uwsgi
That way uwsgi will be available runtime as usual, besides you will get autocompletion
and hints in IDE, and won’t get ImportError
when run without uwsgi.
This also will facilitate your testing a bit, for those simple cases when you won’t expect any result from uwsgi function.
Warning
This is a stub module, so it doesn’t really implement functions defined in it. Use it for documentation purposes.
-
uwsgiconf.uwsgi_stub.
is_stub
= True¶ Indicates whether stub is used instead of real uwsgi module.
-
uwsgiconf.uwsgi_stub.
SPOOL_IGNORE
= 0¶ Spooler function result.
Ignore this task, if multiple languages are loaded in the instance all of them will fight for managing the task. This return values allows you to skip a task in specific languages.
-
uwsgiconf.uwsgi_stub.
SPOOL_OK
= -2¶ Spooler function result.
The task has been completed, the spool file will be removed.
-
uwsgiconf.uwsgi_stub.
SPOOL_RETRY
= -1¶ Spooler function result.
Something is temporarily wrong, the task will be retried at the next spooler iteration.
-
uwsgiconf.uwsgi_stub.
SymbolsImporter
= None¶ SymbolsImporter type.
-
uwsgiconf.uwsgi_stub.
SymbolsZipImporter
= None¶ SymbolsZipImporter type.
-
uwsgiconf.uwsgi_stub.
ZipImporter
= None¶ ZipImporter type.
-
uwsgiconf.uwsgi_stub.
applications
= None¶ Applications dictionary mapping mountpoints to application callables.
Note
Can be
None
.
-
uwsgiconf.uwsgi_stub.
buffer_size
= 0¶ The current configured buffer size in bytes.
-
uwsgiconf.uwsgi_stub.
cores
= 0¶ Detected number of processor cores.
-
uwsgiconf.uwsgi_stub.
env
= {}¶ Request environment dictionary.
-
uwsgiconf.uwsgi_stub.
has_threads
= False¶ Flag indicating whether thread support is enabled.
-
uwsgiconf.uwsgi_stub.
hostname
= b''¶ Current host name.
-
uwsgiconf.uwsgi_stub.
magic_table
= {}¶ Current mapping of configuration file “magic” variables.
-
uwsgiconf.uwsgi_stub.
numproc
= 0¶ Number of workers (processes) currently running.
-
uwsgiconf.uwsgi_stub.
opt
= {}¶ The current configuration options, including any custom placeholders.
-
uwsgiconf.uwsgi_stub.
post_fork_hook
= <bound method _PostForkHooks.run of <class 'uwsgiconf.runtime.platform._PostForkHooks'>>¶ Function to be called after process fork (spawning a new worker/mule).
-
uwsgiconf.uwsgi_stub.
spooler
= <bound method Spooler._process_message_raw of <class 'uwsgiconf.runtime.spooler.Spooler'>>¶ Function to be called for spooler messages processing.
-
uwsgiconf.uwsgi_stub.
sockets
= []¶ Current list of file descriptors for registered sockets.
-
uwsgiconf.uwsgi_stub.
start_response
= None¶ Callable spitting UWSGI response.
-
uwsgiconf.uwsgi_stub.
started_on
= 0¶ uWSGI’s startup Unix timestamp.
-
uwsgiconf.uwsgi_stub.
unbit
= False¶ Unbit internal flag.
-
uwsgiconf.uwsgi_stub.
version
= b'0.0.0'¶ The uWSGI version string.
-
uwsgiconf.uwsgi_stub.
version_info
= (0, 0, 0, 0, b'')¶ Five-elements version number tuple.
-
uwsgiconf.uwsgi_stub.
mule_msg_hook
(message: bytes)¶ Registers a function to be called for each mule message.
-
uwsgiconf.uwsgi_stub.
accepting
()¶ Called to notify the master that the worker is accepting requests, this is required for
touch_chain_reload
to work.
-
uwsgiconf.uwsgi_stub.
add_cron
(signal: int, minute: int, hour: int, day: int, month: int, weekday: int) → bool¶ Adds cron. The interface to the uWSGI signal cron facility. The syntax is
Note
The last 5 arguments work similarly to a standard crontab, but instead of “*”, use -1, and instead of “/2”, “/3”, etc. use -2 and -3, etc.
Parameters: - signal – Signal to raise.
- minute – Minute 0-59. Defaults to each.
- hour – Hour 0-23. Defaults to each.
- day – Day of the month number 1-31. Defaults to each.
- month – Month number 1-12. Defaults to each.
- weekday – Day of a the week number. Defaults to each. 0 - Sunday 1 - Monday 2 - Tuesday 3 - Wednesday 4 - Thursday 5 - Friday 6 - Saturday
Raises: ValueError – If unable to add cron rule.
-
uwsgiconf.uwsgi_stub.
add_file_monitor
(signal: int, filename: str)¶ Maps a specific file/directory modification event to a signal.
Parameters: - signal – Signal to raise.
- filename – File or a directory to watch for its modification.
Raises: ValueError – If unable to register monitor.
-
uwsgiconf.uwsgi_stub.
add_ms_timer
(signal: int, period: int)¶ Add a millisecond resolution timer.
Parameters: - signal – Signal to raise.
- period – The interval (milliseconds) at which to raise the signal.
Raises: ValueError – If unable to add timer.
-
uwsgiconf.uwsgi_stub.
add_rb_timer
(signal: int, period: int, repeat: int = 0)¶ Add a red-black timer.
Parameters: - signal – Signal to raise.
- period – The interval (seconds) at which the signal is raised.
- repeat – How many times to send signal. Will stop after ther number is reached. Default: 0 - infinitely.
Raises: ValueError – If unable to add timer.
-
uwsgiconf.uwsgi_stub.
add_timer
(signal: int, period: int)¶ Add timer.
Parameters: - signal – Signal to raise.
- period – The interval (seconds) at which to raise the signal.
Raises: ValueError – If unable to add timer.
-
uwsgiconf.uwsgi_stub.
add_var
(name: str, value: str) → bool¶ Registers custom request variable.
Can be used for better integration with the internal routing subsystem.
Parameters: - name –
- value –
Raises: ValueError – If buffer size is not enough.
-
uwsgiconf.uwsgi_stub.
alarm
(name: str, message: str)¶ Issues the given alarm with the given message.
Note
to register an alarm use
section.alarms.register_alarm(section.alarms.alarm_types.log('myalarm'))
Parameters: - name –
- message – Message to pass to alarm.
-
uwsgiconf.uwsgi_stub.
async_connect
(socket: str) → int¶ Issues socket connection. And returns a file descriptor or -1.
Parameters: socket –
-
uwsgiconf.uwsgi_stub.
async_sleep
(seconds: int) → bytes¶ Suspends handling the current request and passes control to the next async core.
Parameters: seconds – Sleep time, in seconds.
-
uwsgiconf.uwsgi_stub.
cache_clear
(cache: str)¶ Clears cache with the given name.
Parameters: cache – Cache name with optional address (if @-syntax is used).
-
uwsgiconf.uwsgi_stub.
cache_dec
(key: str, value: int = 1, expires: int = None, cache: str = None) → bool¶ Decrements the specified key value by the specified value.
Parameters: - key –
- value –
- expires – Expire timeout (seconds).
- cache – Cache name with optional address (if @-syntax is used).
-
uwsgiconf.uwsgi_stub.
cache_del
(key: str, cache: str = None) → bool¶ Deletes the given cached key from the cache.
Parameters: - key – The cache key to delete.
- cache – Cache name with optional address (if @-syntax is used).
-
uwsgiconf.uwsgi_stub.
cache_div
(key: str, value: int = 2, expires: int = None, cache: str = None) → bool¶ Divides the specified key value by the specified value.
Parameters: - key –
- value –
- expires – Expire timeout (seconds).
- cache – Cache name with optional address (if @-syntax is used).
-
uwsgiconf.uwsgi_stub.
cache_exists
(key: str, cache: str = None) → bool¶ Checks whether there is a value in the cache associated with the given key.
Parameters: - key – The cache key to check.
- cache – Cache name with optional address (if @-syntax is used).
-
uwsgiconf.uwsgi_stub.
cache_get
(key: str, cache: str = None) → Optional[bytes]¶ Gets a value from the cache.
Parameters: - key – The cache key to get value for.
- cache – Cache name with optional address (if @-syntax is used).
-
uwsgiconf.uwsgi_stub.
cache_inc
(key: str, value: int = 1, expires: int = None, cache: str = None) → bool¶ Increments the specified key value by the specified value.
Parameters: - key –
- value –
- expires – Expire timeout (seconds).
- cache – Cache name with optional address (if @-syntax is used).
-
uwsgiconf.uwsgi_stub.
cache_keys
(cache: str = None) → List[T]¶ Returns a list of keys available in cache.
Parameters: cache (str) – Cache name with optional address (if @-syntax is used). Raises: ValueError – If cache is unavailable.
-
uwsgiconf.uwsgi_stub.
cache_mul
(key: str, value: int = 2, expires: int = None, cache: str = None) → bool¶ Multiplies the specified key value by the specified value.
Parameters: - key –
- value –
- expires – Expire timeout (seconds).
- cache – Cache name with optional address (if @-syntax is used).
-
uwsgiconf.uwsgi_stub.
cache_num
(key: str, cache: str = None) → Optional[int]¶ Gets the 64bit number from the specified item.
Parameters: - key – The cache key to get value for.
- cache – Cache name with optional address (if @-syntax is used).
-
uwsgiconf.uwsgi_stub.
cache_set
(key: str, value: str, expires: int = None, cache: str = None) → bool¶ Sets the specified key value.
Parameters: - key –
- value –
- expires – Expire timeout (seconds).
- cache – Cache name with optional address (if @-syntax is used).
-
uwsgiconf.uwsgi_stub.
cache_update
(key: str, value: str, expires: int = None, cache: str = None) → bool¶ Updates the specified key value.
Parameters: - key –
- value –
- expires – Expire timeout (seconds).
- cache – Cache name with optional address (if @-syntax is used).
-
uwsgiconf.uwsgi_stub.
call
(func_name: bytes, *args) → bytes¶ Performs an [RPC] function call with the given arguments.
Parameters: - func_name – Function name to call with optional address (if @-syntax is used).
- args –
-
uwsgiconf.uwsgi_stub.
chunked_read
(timeout: int) → bytes¶ Reads chunked input.
- http://uwsgi.readthedocs.io/en/latest/Chunked.html
- http://uwsgi.readthedocs.io/en/latest/Changelog-1.9.13.html#chunked-input-api
Parameters: timeout – Wait timeout (seconds). Raises: IOError – If unable to receive chunked part.
-
uwsgiconf.uwsgi_stub.
chunked_read_nb
() → bytes¶ Reads chunked input without blocking.
- http://uwsgi.readthedocs.io/en/latest/Chunked.html
- http://uwsgi.readthedocs.io/en/latest/Changelog-1.9.13.html#chunked-input-api
Raises: IOError – If unable to receive chunked part.
-
uwsgiconf.uwsgi_stub.
cl
() → int¶ Returns current post content length.
-
uwsgiconf.uwsgi_stub.
close
(fd: int)¶ Closes the given file descriptor.
Parameters: fd – File descriptor.
-
uwsgiconf.uwsgi_stub.
connect
(socket: str, timeout: int = 0) → int¶ Connects to the socket.
Parameters: - socket – Socket name.
- timeout – Timeout (seconds).
-
uwsgiconf.uwsgi_stub.
connection_fd
() → int¶ Returns current request file descriptor.
-
uwsgiconf.uwsgi_stub.
disconnect
()¶ Drops current connection.
-
uwsgiconf.uwsgi_stub.
embedded_data
(symbol_name: str) → bytes¶ Reads a symbol from the uWSGI binary image.
Parameters: symbol_name – The symbol name to extract. Raises: ValueError – If symbol is unavailable.
-
uwsgiconf.uwsgi_stub.
extract
(fname: str) → bytes¶ Extracts file contents.
Parameters: fname –
-
uwsgiconf.uwsgi_stub.
farm_get_msg
() → Optional[bytes]¶ Reads a mule farm message.
Raises: ValueError – If not in a mule
-
uwsgiconf.uwsgi_stub.
farm_msg
(farm: str, message: Union[str, bytes])¶ Sends a message to the given farm.
Parameters: - farm – Farm name to send message to.
- message –
-
uwsgiconf.uwsgi_stub.
get_logvar
(name: str) → bytes¶ Return user-defined log variable contents.
Parameters: name –
-
uwsgiconf.uwsgi_stub.
green_schedule
() → bool¶ Switches to another green thread.
Note
Alias for
suspend
.
-
uwsgiconf.uwsgi_stub.
i_am_the_spooler
() → bool¶ Returns flag indicating whether you are the Spooler.
-
uwsgiconf.uwsgi_stub.
in_farm
(name: str) → Optional[bool]¶ Returns flag indicating whether you (mule) belong to the given farm. Returns
None
is not in a mule.Parameters: name – Farm name.
-
uwsgiconf.uwsgi_stub.
is_a_reload
() → bool¶ Returns flag indicating whether reloading mechanics is used.
-
uwsgiconf.uwsgi_stub.
is_connected
(fd: int) → bool¶ Checks the given file descriptor.
Parameters: fd – File descriptor
-
uwsgiconf.uwsgi_stub.
is_locked
(lock_num: int = 0) → bool¶ Checks for the given lock.
Note
Lock 0 is always available.
Parameters: lock_num – Lock number. Raises: ValueError – For Spooler or invalid lock number
-
uwsgiconf.uwsgi_stub.
listen_queue
(socket_num: int = 0) → int¶ Returns listen queue (backlog size) of the given socket.
Parameters: socket_num – Socket number. Raises: ValueError – If socket is not found
-
uwsgiconf.uwsgi_stub.
lock
(lock_num: int = 0)¶ Sets the given lock.
Note
Lock 0 is always available.
Parameters: lock_num – Lock number. Raises: ValueError – For Spooler or invalid lock number
-
uwsgiconf.uwsgi_stub.
log
(message: str) → bool¶ Logs a message.
Parameters: message –
-
uwsgiconf.uwsgi_stub.
log_this_request
()¶ Instructs uWSGI to log current request data.
-
uwsgiconf.uwsgi_stub.
logsize
() → int¶ Returns current log size.
-
uwsgiconf.uwsgi_stub.
loop
() → Optional[str]¶ Returns current event loop name or None if loop is not set.
-
uwsgiconf.uwsgi_stub.
masterpid
() → int¶ Return the process identifier (PID) of the uWSGI master process.
-
uwsgiconf.uwsgi_stub.
mem
() → Tuple[int, int]¶ Returns memory usage tuple of ints: (rss, vsz).
-
uwsgiconf.uwsgi_stub.
metric_dec
(key: str, value: int = 1) → bool¶ Decrements the specified metric key value by the specified value.
Parameters: - key –
- value –
-
uwsgiconf.uwsgi_stub.
metric_div
(key: str, value: int = 1) → bool¶ Divides the specified metric key value by the specified value.
Parameters: - key –
- value –
-
uwsgiconf.uwsgi_stub.
metric_get
(key: str) → int¶ Returns metric value by key.
Parameters: key –
-
uwsgiconf.uwsgi_stub.
metric_inc
(key: str, value: int = 1) → bool¶ Increments the specified metric key value by the specified value.
Parameters: - key –
- value –
-
uwsgiconf.uwsgi_stub.
metric_mul
(key: str, value: int = 1) → bool¶ Multiplies the specified metric key value by the specified value.
Parameters: - key –
- value –
-
uwsgiconf.uwsgi_stub.
metric_set
(key: str, value: int) → bool¶ Sets metric value.
Parameters: - key –
- value –
-
uwsgiconf.uwsgi_stub.
metric_set_max
(key: str, value: int) → bool¶ Sets metric value if it is greater that the current one.
Parameters: - key –
- value –
-
uwsgiconf.uwsgi_stub.
metric_set_min
(key: str, value: int) → bool¶ Sets metric value if it is less that the current one.
Parameters: - key –
- value –
-
uwsgiconf.uwsgi_stub.
micros
() → int¶ Returns uWSGI clock microseconds.
-
uwsgiconf.uwsgi_stub.
mule_get_msg
(signals: bool = None, farms: bool = None, buffer_size: int = 65536, timeout: int = -1) → bytes¶ Block until a mule message is received and return it.
This can be called from multiple threads in the same programmed mule.
Parameters: - signals – Whether to manage signals.
- farms – Whether to manage farms.
- buffer_size –
- timeout – Seconds.
Raises: ValueError – If not in a mule.
-
uwsgiconf.uwsgi_stub.
mule_id
() → int¶ Returns current mule ID. 0 if not a mule (e.g. worker).
-
uwsgiconf.uwsgi_stub.
mule_msg
(message: Union[str, bytes], mule_farm: Union[str, int] = None) → bool¶ Sends a message to a mule(s)/farm.
Parameters: - message –
- mule_farm – Mule ID, or farm name.
Raises: ValueError – If no mules, or mule ID or farm name is not recognized.
-
uwsgiconf.uwsgi_stub.
offload
(filename: str) → bytes¶ Offloads a file.
Warning
Currently not implemented.
Parameters: filename – Raises: ValueError – If unable to offload.
-
uwsgiconf.uwsgi_stub.
parsefile
(fpath: str)¶ Parses the given file.
Currently implemented only Spooler file parsing.
Parameters: fpath –
-
uwsgiconf.uwsgi_stub.
ready
() → bool¶ Returns flag indicating whether we are ready to handle requests.
-
uwsgiconf.uwsgi_stub.
ready_fd
() → bool¶ Returns flag indicating whether file description related to request is ready.
-
uwsgiconf.uwsgi_stub.
recv
(fd: int, maxsize: int = 4096) → bytes¶ Reads data from the given file descriptor.
Parameters: - fd –
- maxsize – Chunk size (bytes).
-
uwsgiconf.uwsgi_stub.
register_rpc
(name: str, func: Callable) → bool¶ Registers RPC function.
Parameters: - name –
- func –
Raises: ValueError – If unable to register function
-
uwsgiconf.uwsgi_stub.
register_signal
(number: int, target: str, func: Callable)¶ Registers a signal handler.
Parameters: - number – Signal number.
- target –
workers
- run the signal handler on all the workersworkerN
- run the signal handler only on worker Nworker/worker0
- run the signal handler on the first available workeractive-workers
- run the signal handlers on all the active [non-cheaped] workersmules
- run the signal handler on all of the mulesmuleN
- run the signal handler on mule Nmule/mule0
- run the signal handler on the first available mulespooler
- run the signal on the first available spoolerfarmN/farm_XXX
- run the signal handler in the mule farm N or named XXX- http://uwsgi.readthedocs.io/en/latest/Signals.html#signals-targets
- func –
Raises: ValueError – If unable to register
-
uwsgiconf.uwsgi_stub.
reload
() → bool¶ Gracefully reloads uWSGI.
-
uwsgiconf.uwsgi_stub.
request_id
() → int¶ Returns current request number (handled by worker on core).
-
uwsgiconf.uwsgi_stub.
route
(name: str, args_str: str) → int¶ Registers a named route for internal routing subsystem.
Parameters: - name – Route name
- args_str – Comma-separated arguments string.
-
uwsgiconf.uwsgi_stub.
rpc
(address: Optional[bytes], func_name: bytes, *args) → bytes¶ Performs an RPC function call with the given arguments.
Parameters: - address –
- func_name – Function name to call.
- args –
Raises: ValueError – If unable to call RPC function.
-
uwsgiconf.uwsgi_stub.
rpc_list
() → Tuple[bytes, ...]¶ Returns registered RPC functions names.
-
uwsgiconf.uwsgi_stub.
send
(fd_or_data: Union[int, bytes], data: bytes = None) → bool¶ Puts data into file descriptor.
- One argument. Data to write into request file descriptor.
- Two arguments. 1. File descriptor; 2. Data to write.
Parameters: - fd_or_data –
- data –
-
uwsgiconf.uwsgi_stub.
sendfile
(fd_or_name: Union[int, str], chunk_size: int = 0, start_pos: int = 0, filesize: int = 0) → Optional[bool]¶ Runs a sendfile.
Parameters: - fd_or_name – File path or descriptor number.
- chunk_size – Not used.
- start_pos –
- filesize – Filesize. If
0
will be determined automatically.
-
uwsgiconf.uwsgi_stub.
send_to_spooler
(message: Dict[bytes, bytes] = None, **kwargs)¶ Send data to the The uWSGI Spooler. Also known as spool().
Warning
Either message argument should contain a dictionary this message dictionary will be constructed from kwargs.
Parameters: - message – The message to spool. Keys and values are bytes.
- kwargs –
Possible kwargs (these are also reserved message argument dictionary keys):
- spooler: The spooler (id or directory) to use.
- Specify the ABSOLUTE path of the spooler that has to manage this task
- priority: Number. The priority of the message. Larger - less important.
Warning
This works only if you enable order_tasks option in spooler.set_basic_params().
This will be the subdirectory in the spooler directory in which the task will be placed, you can use that trick to give a good-enough prioritization to tasks.
Note
This is for systems with few resources. For better approach use multiple spoolers.
- at: Unix time at which the task must be executed.
- The task will not be run until the ‘at’ time is passed.
- body: A binary body to add to the message,
- in addition to the message dictionary itself. Use this key for objects bigger than 64k, the blob will be appended to the serialized uwsgi packet and passed back t o the spooler function as the ‘body’ argument.
-
uwsgiconf.uwsgi_stub.
set_logvar
(name: str, value: str)¶ Sets log variable.
Parameters: - name –
- value –
-
uwsgiconf.uwsgi_stub.
set_spooler_frequency
(seconds: int) → bool¶ Sets how often the spooler runs.
Parameters: seconds –
-
uwsgiconf.uwsgi_stub.
set_user_harakiri
(timeout: int = 0)¶ Sets user level harakiri.
Parameters: timeout – Seconds. 0
disable timer.
-
uwsgiconf.uwsgi_stub.
set_warning_message
(message: str) → bool¶ Sets a warning. This will be reported by pingers.
Parameters: message –
-
uwsgiconf.uwsgi_stub.
setprocname
(name: str)¶ Sets current process name.
Parameters: name –
-
uwsgiconf.uwsgi_stub.
signal
(num: int, remote: str = '')¶ Sends the signal to master or remote.
Parameters: - num – Signal number.
- remote – Remote address.
Raises: - ValueError – If remote rejected the signal.
- IOError – If unable to deliver to remote.
-
uwsgiconf.uwsgi_stub.
signal_received
() → int¶ Get the number of the last signal received.
Used in conjunction with
signal_wait
.
-
uwsgiconf.uwsgi_stub.
signal_registered
(num: int) → Optional[int]¶ Verifies the given signal has been registered.
Parameters: num –
-
uwsgiconf.uwsgi_stub.
signal_wait
(num: int = None) → str¶ Waits for the given of any signal.
Block the process/thread/async core until a signal is received. Use signal_received to get the number of the signal received. If a registered handler handles a signal, signal_wait will be interrupted and the actual handler will handle the signal.
Parameters: num (int) – Raises: SystemError – If something went wrong.
-
uwsgiconf.uwsgi_stub.
spool
(message: Dict[bytes, bytes] = None, **kwargs)¶ Send data to the The uWSGI Spooler. Also known as spool().
Warning
Either message argument should contain a dictionary this message dictionary will be constructed from kwargs.
Parameters: - message – The message to spool. Keys and values are bytes.
- kwargs –
Possible kwargs (these are also reserved message argument dictionary keys):
- spooler: The spooler (id or directory) to use.
- Specify the ABSOLUTE path of the spooler that has to manage this task
- priority: Number. The priority of the message. Larger - less important.
Warning
This works only if you enable order_tasks option in spooler.set_basic_params().
This will be the subdirectory in the spooler directory in which the task will be placed, you can use that trick to give a good-enough prioritization to tasks.
Note
This is for systems with few resources. For better approach use multiple spoolers.
- at: Unix time at which the task must be executed.
- The task will not be run until the ‘at’ time is passed.
- body: A binary body to add to the message,
- in addition to the message dictionary itself. Use this key for objects bigger than 64k, the blob will be appended to the serialized uwsgi packet and passed back t o the spooler function as the ‘body’ argument.
-
uwsgiconf.uwsgi_stub.
spooler_get_task
(path: str) → Optional[dict]¶ Returns a spooler task information.
Parameters: path – The relative or absolute path to the task to read.
-
uwsgiconf.uwsgi_stub.
spooler_jobs
() → List[str]¶ Returns a list of spooler jobs (filenames in spooler directory).
-
uwsgiconf.uwsgi_stub.
spooler_pid
() → int¶ Returns first spooler process ID
-
uwsgiconf.uwsgi_stub.
spooler_pids
() → List[int]¶ Returns a list of all spooler processes IDs.
-
uwsgiconf.uwsgi_stub.
stop
() → Optional[bool]¶ Stops uWSGI.
-
uwsgiconf.uwsgi_stub.
suspend
() → bool¶ Suspends handling of current coroutine/green thread and passes control to the next async core.
-
uwsgiconf.uwsgi_stub.
total_requests
() → int¶ Returns the total number of requests managed so far by the pool of uWSGI workers.
-
uwsgiconf.uwsgi_stub.
unlock
(lock_num: int = 0)¶ Unlocks the given lock.
Note
Lock 0 is always available.
Parameters: lock_num – Lock number. Raises: ValueError – For Spooler or invalid lock number
-
uwsgiconf.uwsgi_stub.
wait_fd_read
(fd: int, timeout: int = None) → bytes¶ Suspends handling of the current request until there is something to be read on file descriptor.
May be called several times before yielding/suspending to add more file descriptors to the set to be watched.
Parameters: - fd – File descriptor number.
- timeout – Timeout. Default: infinite.
Raises: OSError – If unable to read.
-
uwsgiconf.uwsgi_stub.
wait_fd_write
(fd: int, timeout: int = None) → bytes¶ Suspends handling of the current request until there is nothing more to be written on file descriptor.
May be called several times to add more file descriptors to the set to be watched.
Parameters: - fd – File descriptor number.
- timeout – Timeout. Default: infinite.
Raises: OSError – If unable to read.
-
uwsgiconf.uwsgi_stub.
websocket_handshake
(security_key: str = None, origin: str = None, proto: str = None)¶ Waits for websocket handshake.
Parameters: - security_key – Websocket security key to use.
- origin – Override
Sec-WebSocket-Origin
. - proto – Override
Sec-WebSocket-Protocol
.
Raises: IOError – If unable to complete handshake.
-
uwsgiconf.uwsgi_stub.
websocket_recv
(request_context=None) → bytes¶ Receives data from websocket.
Parameters: request_context – Raises: IOError – If unable to receive a message.
-
uwsgiconf.uwsgi_stub.
websocket_recv_nb
(request_context=None) → bytes¶ Receives data from websocket (non-blocking variant).
Parameters: request_context – Raises: IOError – If unable to receive a message.
-
uwsgiconf.uwsgi_stub.
websocket_send
(message: str, request_context=None)¶ Sends a message to websocket.
Parameters: - message – data to send
- request_context –
Note
uWSGI 2.1+
Raises: IOError – If unable to send a message.
-
uwsgiconf.uwsgi_stub.
websocket_send_binary
(message: str, request_context=None)¶ Sends binary message to websocket.
Parameters: - message – data to send
- request_context –
Note
uWSGI 2.1+
Raises: IOError – If unable to send a message.
-
uwsgiconf.uwsgi_stub.
worker_id
() → int¶ Returns current worker ID. 0 if not a worker (e.g. mule).
-
uwsgiconf.uwsgi_stub.
workers
() → Tuple[dict, ...]¶ Gets statistics for all the workers for the current server.
Returns tuple of dicts.
-
uwsgiconf.uwsgi_stub.
i_am_the_lord
(legion_name: str) → bool¶ Returns flag indicating whether you are the lord of the given legion.
Parameters: legion_name –
-
uwsgiconf.uwsgi_stub.
lord_scroll
(legion_name: str) → bool¶ Returns a Lord scroll for the Legion.
Parameters: legion_name –
-
uwsgiconf.uwsgi_stub.
scrolls
(legion_name: str) → List[str]¶ Returns a list of Legion scrolls defined on cluster.
Parameters: legion_name –