Ansible launcher: re-register functions after disconnect

Because we are using the private MASS_DO gearman operation to
register functions, the gear.Worker does not know what functions
are registered and therefore the routine which automatically
re-registers functions after a gear server disconnect was not
effective.  Correct this by also storing the function list when
sending MASS_DO.  This will result in the worker actually sending
CAN_DO packets rather than MASS_DO in the case of a reconnect,
but at least it will be correct, if not efficient.

This error would cause existing nodes attached to zuul launchers
to be unable to run jobs after a zuul (geard) restart.

Change-Id: I60804355a8b3a3cfb79a12dd6e6f0e219fe50c31
This commit is contained in:
James E. Blair 2016-08-03 15:14:43 -07:00
parent 84c4f94000
commit 2959855544
1 changed files with 6 additions and 1 deletions

View File

@ -68,11 +68,16 @@ class NodeGearWorker(gear.Worker):
MASS_DO = 101
def sendMassDo(self, functions):
data = b'\x00'.join([gear.convert_to_bytes(x) for x in functions])
names = [gear.convert_to_bytes(x) for x in functions]
data = b'\x00'.join(names)
new_function_dict = {}
for name in names:
new_function_dict[name] = gear.FunctionRecord(name)
self.broadcast_lock.acquire()
try:
p = gear.Packet(gear.constants.REQ, self.MASS_DO, data)
self.broadcast(p)
self.functions = new_function_dict
finally:
self.broadcast_lock.release()