Use daemon threads

Otherwise they can prevent exiting on timeout which confuses testr.

Change-Id: I239ab46f44fd09fe6b69fb70fdf4043e3c1daa67
Reviewed-on: https://review.openstack.org/35321
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py
index 92104dc..66fbd4e 100644
--- a/tests/test_scheduler.py
+++ b/tests/test_scheduler.py
@@ -393,6 +393,7 @@
 class FakeStatsd(threading.Thread):
     def __init__(self):
         threading.Thread.__init__(self)
+        self.daemon = True
         self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
         self.sock.bind(('', 0))
         self.port = self.sock.getsockname()[1]
@@ -423,6 +424,7 @@
 
     def __init__(self, worker, job, number, node):
         threading.Thread.__init__(self)
+        self.daemon = True
         self.worker = worker
         self.job = job
         self.name = job.name.split(':')[1]
@@ -514,6 +516,7 @@
         self.hold_jobs_in_build = False
         self.lock = threading.Lock()
         self.__work_thread = threading.Thread(target=self.work)
+        self.__work_thread.daemon = True
         self.__work_thread.start()
 
     def handleJob(self, job):
diff --git a/zuul/launcher/gearman.py b/zuul/launcher/gearman.py
index 26dd316..6055bb2 100644
--- a/zuul/launcher/gearman.py
+++ b/zuul/launcher/gearman.py
@@ -29,6 +29,7 @@
 
     def __init__(self, gearman):
         threading.Thread.__init__(self)
+        self.daemon = True
         self.gearman = gearman
         self.wake_event = threading.Event()
         self._stopped = False
diff --git a/zuul/scheduler.py b/zuul/scheduler.py
index cf862e3..938bb50 100644
--- a/zuul/scheduler.py
+++ b/zuul/scheduler.py
@@ -61,6 +61,7 @@
 
     def __init__(self):
         threading.Thread.__init__(self)
+        self.daemon = True
         self.wake_event = threading.Event()
         self.reconfigure_complete_event = threading.Event()
         self._pause = False
diff --git a/zuul/trigger/gerrit.py b/zuul/trigger/gerrit.py
index 3a2a028..650ef6f 100644
--- a/zuul/trigger/gerrit.py
+++ b/zuul/trigger/gerrit.py
@@ -27,6 +27,7 @@
 
     def __init__(self, gerrit, sched):
         super(GerritEventConnector, self).__init__()
+        self.daemon = True
         self.gerrit = gerrit
         self.sched = sched
         self._stopped = False