Control¶
from uwsgiconf.runtime.control import harakiri_imposed, reload
@harakiri_imposed(1)
def doomed():
"""Master process will kill this function after 1 sec."""
# or
with harakiri_imposed(30):
# Master will kill worker if code under that manager won't finish in 30 sec.
# We'll reload uWSGI.
reload()
-
class
uwsgiconf.runtime.control.
harakiri_imposed
(*, timeout: int)¶ Decorator and context manager.
Allows temporarily setting harakiri timeout for a function or a code block.
Note
This is for workers, mules and spoolers.
Examples:
@harakiri_imposed(1) def doomed(): do()
with harakiri_imposed(10): do()
Parameters: timeout – Timeout (seconds) before harakiri.