Merge "executor: add merge_jobs options to disable gearman merge jobs"

This commit is contained in:
Zuul 2019-11-18 23:41:46 +00:00 committed by Gerrit Code Review
commit a6c945d883
3 changed files with 38 additions and 18 deletions

View File

@ -775,6 +775,15 @@ The following sections of ``zuul.conf`` are used by the executor:
node-attributes:
executor-zone: vpn
.. attr:: merge_jobs
:default: True
To disable global merge job, set it to false. This is useful for zoned
executors that are running on slow network where you don't want them to
perform merge operations for any events. The executor will still perform
the merge operations required for the build they are executing.
.. attr:: merger
.. attr:: git_user_email

View File

@ -0,0 +1,4 @@
---
features:
- |
A new config option enable executor to not performed global merge job.

View File

@ -2430,6 +2430,7 @@ class ExecutorServer(object):
self.ansible_manager.install()
self.ansible_manager.copyAnsibleFiles()
if get_default(self.config, 'executor', 'merge_jobs', True):
self.merger_jobs = {
'merger:merge': self.merge,
'merger:cat': self.cat,
@ -2444,6 +2445,8 @@ class ExecutorServer(object):
self.merger_jobs,
worker_class=ExecutorMergeWorker,
worker_args=[self])
else:
self.merger_gearworker = None
function_name = 'executor:execute'
if self.zone:
@ -2474,6 +2477,7 @@ class ExecutorServer(object):
self._running = True
self._command_running = True
if self.merger_gearworker is not None:
self.merger_gearworker.start()
self.executor_gearworker.start()
@ -2526,6 +2530,7 @@ class ExecutorServer(object):
self.governor_stop_event.set()
self.governor_thread.join()
# Stop accepting new jobs
if self.merger_gearworker is not None:
self.merger_gearworker.gearman.setFunctions([])
self.executor_gearworker.gearman.setFunctions([])
# Tell the executor worker to abort any jobs it just accepted,
@ -2556,6 +2561,7 @@ class ExecutorServer(object):
# All job results should have been sent by now, shutdown the
# gearman workers.
if self.merger_gearworker is not None:
self.merger_gearworker.stop()
self.executor_gearworker.stop()
@ -2573,6 +2579,7 @@ class ExecutorServer(object):
self.governor_thread.join()
for update_thread in self.update_threads:
update_thread.join()
if self.merger_gearworker is not None:
self.merger_gearworker.join()
self.executor_gearworker.join()