import uwsgi

def will_executed_after_reload(*args):
    print('I was invoked')
uwsgi.register_signal(17, 'worker', will_executed_after_reload)
uwsgi.add_file_monitor(17, './uwsgi.pid')
uWSGI and gracefully killing a multithreaded Flask app