Author: challngr
Date: Tue May 14 16:29:50 2013
New Revision: 1482433

URL: http://svn.apache.org/r1482433
Log:
UIMA-2907 Clarify RM reseervation refusal messages.

Modified:
    
uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/scheduler/NodePool.java
    
uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/scheduler/NodepoolScheduler.java
    
uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/scheduler/ResourceClass.java

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/scheduler/NodePool.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/scheduler/NodePool.java?rev=1482433&r1=1482432&r2=1482433&view=diff
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/scheduler/NodePool.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/scheduler/NodePool.java
 Tue May 14 16:29:50 2013
@@ -804,11 +804,10 @@ class NodePool
                } else {
                        return 0;
                }
-            // TODO sort by something smart
         } else {
             machs.addAll(allMachines.values());
-            // TODO sort by smallest machine, secondarily by something smart
         }
+        Collections.sort(machs, new MachineByAscendingOrderSorter());
 
         int given = 0;           // total to give, free or freeable
         Iterator<Machine> iter = machs.iterator();
@@ -818,6 +817,11 @@ class NodePool
             if ( preemptables.containsKey(m.key()) ) {         // already 
counted, don't count twice
                 continue;
             }
+
+            if ( m.getShareOrder() < order ) {
+                continue;
+            }
+
             if ( m.isFree() ) {
                 given++;
                 continue;
@@ -1487,4 +1491,13 @@ class NodePool
         }
     }
 
+    class MachineByAscendingOrderSorter
+       implements Comparator<Machine>
+    {  
+       public int compare(Machine m1, Machine m2)
+        {
+            return m1.getShareOrder() - m2.getShareOrder();
+        }
+    }
+
 }

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/scheduler/NodepoolScheduler.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/scheduler/NodepoolScheduler.java?rev=1482433&r1=1482432&r2=1482433&view=diff
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/scheduler/NodepoolScheduler.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/scheduler/NodepoolScheduler.java
 Tue May 14 16:29:50 2013
@@ -1074,7 +1074,10 @@ public class NodepoolScheduler
 
                 // Don't schedule non-preemptable shares over subpools
                 if ( np.countLocalShares() < n_instances ) {
-                    schedulingUpdate.refuse(j, "Cannot accept Fixed Share job, 
nodepool " + np.getId() + " is too small. Available[" + np.countLocalShares() + 
"] requested[" + n_instances + "]");
+                    schedulingUpdate.refuse(j, "Cannot accept Fixed Share job, 
nodepool " + np.getId() 
+                                            + " has insufficient nodes left. 
Available[" 
+                                            + np.countLocalShares() 
+                                            + "] requested[" + n_instances + 
"]");
                     continue;
                 }
              
@@ -1235,7 +1238,7 @@ public class NodepoolScheduler
                 }
 
                 if ( rc.getMaxMachines() < nrequested ) {               // 
Does it blow the configured limit for this class?
-                    schedulingUpdate.refuse(j, "Cannot accept reservation, 
requested machines exceeds class max of " + rc.getMaxMachines() + ".");
+                    schedulingUpdate.refuse(j, "Cannot accept reservation, 
requested machines exceeds configured class max of " + rc.getMaxMachines() + 
".");
                     continue;
                 }
 
@@ -1247,7 +1250,9 @@ public class NodepoolScheduler
                 if ( (machines_given_out + nrequested) > classcap ) {
                     schedulingUpdate.refuse(j, "Job asks for " 
                                             + nrequested 
-                                            + " reserved machines but there 
are insufficient machines available for class \"" + rc.getName());
+                                            + " reserved machines but total 
machines for class '" + rc.getName()
+                                            + "' exceeds class cap of "
+                                            + classcap);
                                             
                     continue;
                 }               
@@ -1267,9 +1272,19 @@ public class NodepoolScheduler
                 }           
 
                 if ( given == 0 ) {
-                    schedulingUpdate.refuse(j, "Job asks for " 
-                                            + nrequested 
-                                            + " reserved machines but 
reservable resources are unavailable or exhausted.");
+                    if ( rc.enforceMemory() ) {
+                        schedulingUpdate.refuse(j, "Job asks for " 
+                                                + nrequested 
+                                                + " reserved machines with 
exactly "
+                                                + j.getShareOrder()  
+                                                + " shares but there are 
insufficient freeable machines.");
+                    } else {
+                        schedulingUpdate.refuse(j, "Job asks for " 
+                                                + nrequested 
+                                                + " reserved machines with at 
least "
+                                                + j.getShareOrder()  
+                                                + " shares but there are 
insufficient freeable machines.");
+                    }
                     continue;
                 }
             }

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/scheduler/ResourceClass.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/scheduler/ResourceClass.java?rev=1482433&r1=1482432&r2=1482433&view=diff
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/scheduler/ResourceClass.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/scheduler/ResourceClass.java
 Tue May 14 16:29:50 2013
@@ -168,10 +168,10 @@ public class ResourceClass
             if (absolute_cap == 0) absolute_cap = Integer.MAX_VALUE;
         }
 
-        nodepoolName = props.getProperty(k + "nodepool");                      
         // optional nodepool
+        nodepoolName = props.getStringProperty(k + "nodepool", null);          
                     // optional nodepool
         if (nodepoolName == null) {
             nodepoolName = NodePool.globalName;
-        }
+        } 
     }
 
     public long getTimestamp()


Reply via email to