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()
harakiri_imposed(*, timeout: int)¶
Decorator and context manager.
Allows temporarily setting harakiri timeout for a function or a code block.
This is for workers, mules and spoolers.
@harakiri_imposed(1) def doomed(): do()
with harakiri_imposed(10): do()
Parameters: timeout – Timeout (seconds) before harakiri.