From: Zack Cerza Date: Fri, 15 Jul 2016 16:05:54 +0000 (-0600) Subject: Stop workers on demand X-Git-Tag: 1.1.0~567^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F910%2Fhead;p=teuthology.git Stop workers on demand --- diff --git a/teuthology/worker.py b/teuthology/worker.py index e314e7968..84b9f33c8 100644 --- a/teuthology/worker.py +++ b/teuthology/worker.py @@ -21,6 +21,7 @@ from .repo_utils import fetch_qa_suite, fetch_teuthology log = logging.getLogger(__name__) start_time = datetime.utcnow() restart_file_path = '/tmp/teuthology-restart-workers' +stop_file_path = '/tmp/teuthology-stop-workers' def sentinel(path): @@ -40,6 +41,11 @@ def restart(): os.execv(sys.executable, args) +def stop(): + log.info('Stopping...') + sys.exit(0) + + def install_except_hook(): """ Install an exception hook that first logs any uncaught exception, then @@ -94,6 +100,8 @@ def main(ctx): if sentinel(restart_file_path): restart() + elif sentinel(stop_file_path): + stop() job = connection.reserve(timeout=60) if job is None: