summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhai Do <zaro0508@gmail.com>2014-10-21 12:47:29 -0700
committerKhai Do <zaro0508@gmail.com>2014-10-21 15:14:20 -0700
commitfa5f0834ff991e13a85cea6624a144432a328fea (patch)
treed07f939aede01030df23d11463ab48075a11e518
parent6307ba2225bbc9e8d4f41062bd6b944e40d7fa7a (diff)
Fix job result not being sent back to gearman client0.1.1
This fixes a bug that causes the result object to be left off of the returned data packet after a job finishes executing. This only occurs when the job request sets the node to temporary offline (i.e. "OFFLINE_NODE_WHEN_COMPLETE":"true"). The problem is that the ComputerListener.onTemporaryOffline event was stopping the gearman worker which causes a disconnect to the gearman client thus not being able to send back the results for the job. The worker should not stop on a temporary offline, only on disconnect and delete of a node. The fix is to only re-register the gearman functions instead of stopping the workers on a temporary online/offline of a node. Change-Id: Icf672acf059d6cb0e16a6685d637824c678ea5be
Notes
Notes (review): Code-Review+2: James E. Blair <corvus@inaugust.com> Workflow+1: James E. Blair <corvus@inaugust.com> Verified+2: Jenkins Code-Review+2: Clark Boylan <cboylan@sapwetik.org> Submitted-by: Jenkins Submitted-at: Tue, 21 Oct 2014 23:39:45 +0000 Reviewed-on: https://review.openstack.org/130025 Project: openstack-infra/gearman-plugin Branch: refs/heads/master
-rw-r--r--src/main/java/hudson/plugins/gearman/ComputerListenerImpl.java16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/main/java/hudson/plugins/gearman/ComputerListenerImpl.java b/src/main/java/hudson/plugins/gearman/ComputerListenerImpl.java
index 08e07a9..e117bac 100644
--- a/src/main/java/hudson/plugins/gearman/ComputerListenerImpl.java
+++ b/src/main/java/hudson/plugins/gearman/ComputerListenerImpl.java
@@ -109,8 +109,8 @@ public class ComputerListenerImpl extends ComputerListener {
109 return; 109 return;
110 } 110 }
111 111
112 // stop worker when jenkins slave is set to offline 112 // re-register gearman functions on node status change,
113 GearmanProxy.getInstance().stop(c); 113 GearmanProxy.getInstance().registerJobs();
114 } 114 }
115 115
116 @Override 116 @Override
@@ -123,16 +123,8 @@ public class ComputerListenerImpl extends ComputerListener {
123 return; 123 return;
124 } 124 }
125 125
126 GearmanProxy gp = GearmanProxy.getInstance(); 126 // re-register gearman functions on node status change,
127 /* 127 GearmanProxy.getInstance().registerJobs();
128 * Spawn management executor worker if one doesn't exist yet.
129 * This worker does not need any executors. It only needs
130 * to work with gearman.
131 */
132 gp.createManagementWorker();
133
134 // on brining a slave back online
135 gp.createExecutorWorkersOnNode(c);
136 } 128 }
137 129
138} 130}