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
This commit is contained in:
James E. Blair 2013-07-01 12:31:34 -04:00 committed by Jenkins
parent e2819012fa
commit 8a6f0c20f3
4 changed files with 6 additions and 0 deletions

View File

@ -393,6 +393,7 @@ class FakeGerritTrigger(zuul.trigger.gerrit.Gerrit):
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 @@ class FakeBuild(threading.Thread):
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 @@ class FakeWorker(gear.Worker):
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):

View File

@ -29,6 +29,7 @@ class GearmanCleanup(threading.Thread):
def __init__(self, gearman):
threading.Thread.__init__(self)
self.daemon = True
self.gearman = gearman
self.wake_event = threading.Event()
self._stopped = False

View File

@ -61,6 +61,7 @@ class Scheduler(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.daemon = True
self.wake_event = threading.Event()
self.reconfigure_complete_event = threading.Event()
self._pause = False

View File

@ -27,6 +27,7 @@ class GerritEventConnector(threading.Thread):
def __init__(self, gerrit, sched):
super(GerritEventConnector, self).__init__()
self.daemon = True
self.gerrit = gerrit
self.sched = sched
self._stopped = False