]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Stop workers on demand 910/head
authorZack Cerza <zack@redhat.com>
Fri, 15 Jul 2016 16:05:54 +0000 (10:05 -0600)
committerZack Cerza <zack@redhat.com>
Fri, 15 Jul 2016 17:07:02 +0000 (11:07 -0600)
teuthology/worker.py

index e314e796896eae2cf7c178b69e012ffb16d070f8..84b9f33c8a550319473c226a37d94177e34a7da8 100644 (file)
@@ -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: