oslo_concurrency.watchdog
¶Watchdog module.
New in version 0.4.
oslo_concurrency.watchdog.
watch
(*args, **kwds)¶Log a message if an operation exceeds a time threshold.
This context manager is expected to be used when you are going to do an operation in code which might either deadlock or take an extraordinary amount of time, and you’d like to emit a status message back to the user that the operation is still ongoing but has not completed in an expected amount of time. This is more user friendly than logging ‘start’ and ‘end’ events and making users correlate the events to figure out they ended up in a deadlock.
Parameters: |
|
---|
Example usage:
FORMAT = '%(asctime)-15s %(message)s'
logging.basicConfig(format=FORMAT)
LOG = logging.getLogger('mylogger')
with watchdog.watch(LOG, "subprocess call", logging.ERROR):
subprocess.call("sleep 10", shell=True)
print "done"
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.