[Swift-commit] cog r3798

swift at ci.uchicago.edu swift at ci.uchicago.edu
Tue Sep 24 21:00:21 CDT 2013


------------------------------------------------------------------------
r3798 | hategan | 2013-09-24 20:58:57 -0500 (Tue, 24 Sep 2013) | 1 line

increased local scheduler polling interval when using coasters to 15 seconds
------------------------------------------------------------------------
Index: modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/CoasterService.java
===================================================================
--- modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/CoasterService.java	(revision 3797)
+++ modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/CoasterService.java	(working copy)
@@ -11,6 +11,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.lang.reflect.Method;
 import java.net.InetAddress;
 import java.net.Socket;
 import java.text.DateFormat;
@@ -97,8 +98,30 @@
         this.id = id;
         setAuthorization(new SelfAuthorization());
         initializeLocalService();
+        setPollingIntervals();
     }
 
+    private void setPollingIntervals() {
+        setPollingInterval("pbs", 15);
+        setPollingInterval("slurm", 15);
+        setPollingInterval("lsf", 15);
+        setPollingInterval("sge", 15);
+    }
+
+    private void setPollingInterval(String p, int t) {
+        try {
+            String clsName = "org.globus.cog.abstraction.impl.scheduler." + p + ".Properties";
+            Class<?> cls = CoasterService.class.getClassLoader().loadClass(clsName);
+            Method getProperties = cls.getMethod("getProperties", (Class<?>[]) null); 
+            Object instance = getProperties.invoke(null, (Object[]) null);
+            Method setPollInterval = cls.getMethod("setPollInterval", new Class<?>[] {int.class});
+            setPollInterval.invoke(instance, new Object[] {t});
+        }
+        catch (Exception e) {
+            logger.warn("Failed to set polling interval for " + p, e);
+        }
+    }
+
     private RequestManager newLocalRequestManager() {
         RequestManager rm = new ServiceRequestManager();
         rm.addHandler("REGISTER", RegistrationHandler.class);



More information about the Swift-commit mailing list