[Swift-commit] Cog update

swift at ci.uchicago.edu swift at ci.uchicago.edu
Mon Apr 30 18:40:03 CDT 2012


------------------------------------------------------------------------
r3395 | hategan | 2012-04-30 18:38:58 -0500 (Mon, 30 Apr 2012) | 1 line

allow jobs to go straight from being submitted to workers in-between plannings
------------------------------------------------------------------------
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 3394)
+++ modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/BlockQueueProcessor.java	(working copy)
@@ -79,7 +79,7 @@
 
     private ChannelContext clientChannelContext;
 
-    private boolean done;
+    private boolean done, planning;
 
     private final Metric metric;
 
@@ -167,11 +167,16 @@
     public void enqueue1(Task t) {
         Job j = new Job(t);
         if (checkJob(j)) {
-            synchronized (incoming) {
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Got job with walltime = " + j.getMaxWallTime());
+            if (logger.isDebugEnabled()) {
+                logger.debug("Got job with walltime = " + j.getMaxWallTime());
+            }
+            synchronized (holding) {
+                if (planning) {
+                    incoming.add(j);
                 }
-                incoming.add(j);
+                else {
+                    holding.add(j);
+                }
             }
         }
     }
@@ -686,34 +691,39 @@
         long start = System.currentTimeMillis();
 
         synchronized(holding) {
+            planning = true;
+        }
+
+        // Shutdown Blocks that are done
+        cleanDoneBlocks();
+
+        // Subtract elapsed time from existing allocation
+        updateAllocatedSize();
+    
+        // Move jobs that fit from holding to queued
+        queueToExistingBlocks();
+
+        // int jss = jobs.size();
+        // If queued has too many Jobs, move some back to holding
+        requeueNonFitting();
+
+        updateSettings();
+
+        computeSums();
+
+        tsum = computeTotalRequestSize();
+
+        if (tsum == 0) {
+            removeIdleBlocks();
+        }
+        else {
+            allocateBlocks(tsum);
+        }
+
+        synchronized(holding) {
+            planning = false;
             // Move all incoming Jobs to holding
             commitNewJobs();
-    
-            // Shutdown Blocks that are done
-            cleanDoneBlocks();
-    
-            // Subtract elapsed time from existing allocation
-            updateAllocatedSize();
-        
-            // Move jobs that fit from holding to queued
-            queueToExistingBlocks();
-    
-            // int jss = jobs.size();
-            // If queued has too many Jobs, move some back to holding
-            requeueNonFitting();
-    
-            updateSettings();
-    
-            computeSums();
-    
-            tsum = computeTotalRequestSize();
-    
-            if (tsum == 0) {
-                removeIdleBlocks();
-            }
-            else {
-                allocateBlocks(tsum);
-            }
         }
 
         updateMonitor();
@@ -725,7 +735,9 @@
         Job job = queued.removeOne(ti, cpus);
         if (job == null) {
             synchronized(holding) {
-                job = holding.removeOne(ti, cpus);
+                if (!planning) {
+                    job = holding.removeOne(ti, cpus);
+                }
             }
         }
         



More information about the Swift-commit mailing list