import yaml
from datetime import datetime
+from traceback import format_tb
from teuthology import setup_log_file
from . import beanstalk
os.execv(sys.executable, args)
+def install_except_hook():
+ """
+ Install an exception hook that first logs any uncaught exception, then
+ raises it.
+ """
+ def log_exception(exception_class, exception, traceback):
+ logging.critical(''.join(format_tb(traceback)))
+ if not exception.message:
+ logging.critical(exception_class.__name__)
+ else:
+ logging.critical('{0}: {1}'.format(
+ exception_class.__name__, exception))
+ # Now raise the exception like normal
+ sys.__excepthook__(exception_class, exception, traceback)
+ sys.excepthook = log_exception
+
+
class filelock(object):
# simple flock class
def __init__(self, fn):
pid=os.getpid(), tube=ctx.tube,))
setup_log_file(log, log_file_path)
+ install_except_hook()
+
if not os.path.isdir(ctx.archive_dir):
sys.exit("{prog}: archive directory must exist: {path}".format(
prog=os.path.basename(sys.argv[0]),