[Swift-commit] Cog update

swift at ci.uchicago.edu swift at ci.uchicago.edu
Thu Apr 19 22:55:03 CDT 2012


------------------------------------------------------------------------
r3376 | hategan | 2012-04-19 22:52:35 -0500 (Thu, 19 Apr 2012) | 1 line

Don't send updates about workers to client if client is not connected (it just causes NPEs in the logs)
------------------------------------------------------------------------
Index: modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/BlockQueueProcessor.java
===================================================================
--- modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/BlockQueueProcessor.java	(revision 3375)
+++ modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/BlockQueueProcessor.java	(working copy)
@@ -818,6 +818,10 @@
     public ChannelContext getClientChannelContext() {
         return clientChannelContext;
     }
+    
+    public boolean clientIsConnected() {
+        return clientChannelContext != null;
+    }
 
     public static void main(String[] args) {
         Settings s = new Settings();
Index: modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/PassiveQueueProcessor.java
===================================================================
--- modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/PassiveQueueProcessor.java	(revision 3375)
+++ modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/PassiveQueueProcessor.java	(working copy)
@@ -62,20 +62,22 @@
         
         String r = getBlock(blockID).workerStarted(workerID, workerHostname, channelContext);
         
-        ResourceUpdateCommand wsc;
-        synchronized(this) {
-            currentWorkers++;
-            wsc = new ResourceUpdateCommand("job-capacity", 
-                String.valueOf(currentWorkers * getSettings().getJobsPerNode()));
+        if (clientIsConnected()) {
+            ResourceUpdateCommand wsc;
+            synchronized(this) {
+                currentWorkers++;
+                wsc = new ResourceUpdateCommand("job-capacity", 
+                    String.valueOf(currentWorkers * getSettings().getJobsPerNode()));
+            }
+            try {
+                KarajanChannel channel = ChannelManager.getManager().reserveChannel(getClientChannelContext());
+                wsc.executeAsync(channel);
+                ChannelManager.getManager().releaseChannel(channel);
+            }
+            catch (Exception e) {
+                logger.warn("Failed to send worker status update to client", e);
+            }
         }
-        try {
-            KarajanChannel channel = ChannelManager.getManager().reserveChannel(getClientChannelContext());
-            wsc.executeAsync(channel);
-            ChannelManager.getManager().releaseChannel(channel);
-        }
-        catch (Exception e) {
-            logger.warn("Failed to send worker status update to client", e);
-        }
         
         return r;
     }



More information about the Swift-commit mailing list