gear: remove support for custom MASS_DO packet
Zuul 2.5 Ansible launcher registered ten of thousands of functions on
each node which, when done serially, took a while. To alleviate that
issue the Gear protocol had been extended with a custom MASS_DO packet
to register several functions in a single call (see d437159887
).
The Ansible launcher has been superseeded by the executor server
removing the sole use of MASS_DO. The extended Gear.Server had not been
cleaned up though.
Replace custom zuul.lib.gearserver.GearServer() with gear.Server() and
remove code.
For posterity, the MASS_DO idea is captured in Gearman upstream issue
tracker:
https://github.com/gearman/gearmand/issues/6
Change-Id: Ifc57f9b7a17d1d9291a535eb0d9f5e1da3713241
This commit is contained in:
parent
000f6ec21e
commit
7969b96a86
|
@ -85,7 +85,7 @@ class Scheduler(zuul.cmd.ZuulDaemonApp):
|
|||
if child_pid == 0:
|
||||
os.close(pipe_write)
|
||||
self.setup_logging('gearman_server', 'log_config')
|
||||
import zuul.lib.gearserver
|
||||
import gear
|
||||
|
||||
(statsd_host, statsd_port, statsd_prefix) = get_statsd_config(
|
||||
self.config)
|
||||
|
@ -100,18 +100,18 @@ class Scheduler(zuul.cmd.ZuulDaemonApp):
|
|||
ssl_key = get_default(self.config, 'gearman_server', 'ssl_key')
|
||||
ssl_cert = get_default(self.config, 'gearman_server', 'ssl_cert')
|
||||
ssl_ca = get_default(self.config, 'gearman_server', 'ssl_ca')
|
||||
zuul.lib.gearserver.GearServer(port,
|
||||
ssl_key=ssl_key,
|
||||
ssl_cert=ssl_cert,
|
||||
ssl_ca=ssl_ca,
|
||||
host=host,
|
||||
statsd_host=statsd_host,
|
||||
statsd_port=statsd_port,
|
||||
statsd_prefix=statsd_prefix,
|
||||
keepalive=True,
|
||||
tcp_keepidle=300,
|
||||
tcp_keepintvl=60,
|
||||
tcp_keepcnt=5)
|
||||
gear.Server(port,
|
||||
ssl_key=ssl_key,
|
||||
ssl_cert=ssl_cert,
|
||||
ssl_ca=ssl_ca,
|
||||
host=host,
|
||||
statsd_host=statsd_host,
|
||||
statsd_port=statsd_port,
|
||||
statsd_prefix=statsd_prefix,
|
||||
keepalive=True,
|
||||
tcp_keepidle=300,
|
||||
tcp_keepintvl=60,
|
||||
tcp_keepcnt=5)
|
||||
|
||||
# Keep running until the parent dies:
|
||||
pipe_read = os.fdopen(pipe_read)
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
# Copyright 2016 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import gear
|
||||
|
||||
MASS_DO = 101
|
||||
|
||||
|
||||
class GearServer(gear.Server):
|
||||
def handlePacket(self, packet):
|
||||
if packet.ptype == MASS_DO:
|
||||
self.log.info("Received packet from %s: %s" % (packet.connection,
|
||||
packet))
|
||||
self.handleMassDo(packet)
|
||||
else:
|
||||
return super(GearServer, self).handlePacket(packet)
|
||||
|
||||
def handleMassDo(self, packet):
|
||||
packet.connection.functions = set()
|
||||
for name in packet.data.split(b'\x00'):
|
||||
self.log.debug("Adding function %s to %s" % (
|
||||
name, packet.connection))
|
||||
packet.connection.functions.add(name)
|
||||
self.functions.add(name)
|
Loading…
Reference in New Issue