Author: challngr Date: Fri Jul 17 15:58:13 2015 New Revision: 1691594 URL: http://svn.apache.org/r1691594 Log: UIMA-4358 Delete deprecated code.
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 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=1691594&r1=1691593&r2=1691594&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 Fri Jul 17 15:58:13 2015 @@ -19,7 +19,6 @@ package org.apache.uima.ducc.rm.scheduler; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; @@ -1508,126 +1507,126 @@ class NodePool return null; // found nothing, heck } - private void doEvictions(int[] neededByOrder, HashMap<Integer, HashMap<IRmJob, IRmJob>> candidates, boolean force) - { - - for ( int nbo = maxorder; nbo > 0; nbo-- ) { - - if ( neededByOrder[nbo] == 0 ) { // these are N-shares - continue; - } - for ( int oo = maxorder; oo > 0; oo-- ) { - HashMap<IRmJob, IRmJob> jobs = candidates.get(oo); - if ( jobs == null ) { - continue; - } - - Iterator<IRmJob> iter = jobs.values().iterator(); // he has something to give. is it enough? - while ( iter.hasNext() && (neededByOrder[nbo] > 0) ) { - IRmJob j = iter.next(); - int loss = 0; - - switch ( evictionPolicy ) { - case SHRINK_BY_MACHINE: - // minimize fragmentation - loss = j.shrinkByOrderByMachine(neededByOrder[nbo], nbo, force, this); // pass in number of N-shares of given order that we want - // returns number of quantum shares it had to relinquish - break; - case SHRINK_BY_INVESTMENT: - // minimize lost work - loss = j.shrinkByInvestment(neededByOrder[nbo], nbo, force, this); // pass in number of N-shares of given order that we want - // returns number of quantum shares it had to relinquish - break; - } + // private void doEvictions(int[] neededByOrder, HashMap<Integer, HashMap<IRmJob, IRmJob>> candidates, boolean force) + // { - neededByOrder[nbo] -= loss; - neededByOrder[0] -= loss; - nPendingByOrder[oo] += loss; + // for ( int nbo = maxorder; nbo > 0; nbo-- ) { - if ( j.countNShares() == 0 ) { // nothing left? don't look here any more - iter.remove(); - } - } - - } - } - } - - /** - * Here we tell the NP how much we need cleared up. It will look around and try to do that. - * @deprecated No longer used, the doEvictions code in NodepoolScheduler handles evictions by itself. - * Keeping this for a while for reference. UIMA-4275 - */ - void doEvictionsByMachine(int [] neededByOrder, boolean force) - { - String methodName = "doEvictions"; - // - // Collect losers that are also squatters, by order, and try them first - // - String type; - type = force ? "forced" : "natural"; - - logger.debug(methodName, null, getId(), "NeededByOrder", type, "on entrance eviction", Arrays.toString(neededByOrder)); - - for ( NodePool np : getChildrenDescending() ) { - logger.info(methodName, null, "Recurse to", np.getId(), "from", getId(), "force:", force); - np.doEvictionsByMachine(neededByOrder, force); - logger.info(methodName, null, "Recurse from", np.getId(), "proceed with logic for", getId(), "force", force); - } - - // - // Adjust neededByOrder to reflect the number of shares that need to be preempted by subtracting the - // number of shares that already are free - // - for ( int nbo = maxorder; nbo > 0; nbo-- ) { - // UIMA-4065 - I think that subtracting countPendingSharesByOrder() amounts to double counting because it - // will reflect any evictions from the depth-first recursion. Instead, we would subtract only - // our own shares. - // - // int needed = Math.max(0, neededByOrder[nbo] - countNSharesByOrder(nbo) - countPendingSharesByOrder(nbo)); - int needed = Math.max(0, neededByOrder[nbo] - countNSharesByOrder(nbo) - nPendingByOrder[nbo]); - neededByOrder[nbo] = needed; - neededByOrder[0] += needed; - } - - logger.debug(methodName, null, getId(), "NeededByOrder", type, "after adjustments for pending eviction:", Arrays.toString(neededByOrder)); - - HashMap<Integer, HashMap<IRmJob, IRmJob>> squatters = new HashMap<Integer, HashMap<IRmJob, IRmJob>>(); - HashMap<Integer, HashMap<IRmJob, IRmJob>> residents = new HashMap<Integer, HashMap<IRmJob, IRmJob>>(); - - for ( Share s : allShares.values() ) { - HashMap<Integer, HashMap<IRmJob, IRmJob>> map = null; - boolean is_candidate = force ? s.isForceable() : s.isPreemptable(); - if ( is_candidate ) { - IRmJob j = s.getJob(); - ResourceClass rc = j.getResourceClass(); - if ( rc.getNodepoolName().equals(id) ) { - map = residents; - } else { - map = squatters; - } - - int order = j.getShareOrder(); - HashMap<IRmJob, IRmJob> jmap = null; - if ( map.containsKey(order) ) { - jmap = map.get(order); - } else { - jmap = new HashMap<IRmJob, IRmJob>(); - map.put(order, jmap); - } - jmap.put(j, j); - } - } - - doEvictions(neededByOrder, squatters, force); - logger.debug(methodName, null, getId(), "NeededByOrder", type, "after eviction of squatters:", Arrays.toString(neededByOrder)); - if ( neededByOrder[0] <= 0 ) { - return; - } - - doEvictions(neededByOrder, residents, force); - logger.debug(methodName, null, getId(), "NeededByOrder", type, "after eviction of residents:", Arrays.toString(neededByOrder)); - } + // if ( neededByOrder[nbo] == 0 ) { // these are N-shares + // continue; + // } + // for ( int oo = maxorder; oo > 0; oo-- ) { + // HashMap<IRmJob, IRmJob> jobs = candidates.get(oo); + // if ( jobs == null ) { + // continue; + // } + + // Iterator<IRmJob> iter = jobs.values().iterator(); // he has something to give. is it enough? + // while ( iter.hasNext() && (neededByOrder[nbo] > 0) ) { + // IRmJob j = iter.next(); + // int loss = 0; + + // switch ( evictionPolicy ) { + // case SHRINK_BY_MACHINE: + // // minimize fragmentation + // loss = j.shrinkByOrderByMachine(neededByOrder[nbo], nbo, force, this); // pass in number of N-shares of given order that we want + // // returns number of quantum shares it had to relinquish + // break; + // case SHRINK_BY_INVESTMENT: + // // minimize lost work + // loss = j.shrinkByInvestment(neededByOrder[nbo], nbo, force, this); // pass in number of N-shares of given order that we want + // // returns number of quantum shares it had to relinquish + // break; + // } + + // neededByOrder[nbo] -= loss; + // neededByOrder[0] -= loss; + // nPendingByOrder[oo] += loss; + + // if ( j.countNShares() == 0 ) { // nothing left? don't look here any more + // iter.remove(); + // } + // } + + // } + // } + // } + + // /** + // * Here we tell the NP how much we need cleared up. It will look around and try to do that. + // * @deprecated No longer used, the doEvictions code in NodepoolScheduler handles evictions by itself. + // * Keeping this for a while for reference. UIMA-4275 + // */ + // void doEvictionsByMachine(int [] neededByOrder, boolean force) + // { + // String methodName = "doEvictions"; + // // + // // Collect losers that are also squatters, by order, and try them first + // // + // String type; + // type = force ? "forced" : "natural"; + + // logger.debug(methodName, null, getId(), "NeededByOrder", type, "on entrance eviction", Arrays.toString(neededByOrder)); + + // for ( NodePool np : getChildrenDescending() ) { + // logger.info(methodName, null, "Recurse to", np.getId(), "from", getId(), "force:", force); + // np.doEvictionsByMachine(neededByOrder, force); + // logger.info(methodName, null, "Recurse from", np.getId(), "proceed with logic for", getId(), "force", force); + // } + + // // + // // Adjust neededByOrder to reflect the number of shares that need to be preempted by subtracting the + // // number of shares that already are free + // // + // for ( int nbo = maxorder; nbo > 0; nbo-- ) { + // // UIMA-4065 - I think that subtracting countPendingSharesByOrder() amounts to double counting because it + // // will reflect any evictions from the depth-first recursion. Instead, we would subtract only + // // our own shares. + // // + // // int needed = Math.max(0, neededByOrder[nbo] - countNSharesByOrder(nbo) - countPendingSharesByOrder(nbo)); + // int needed = Math.max(0, neededByOrder[nbo] - countNSharesByOrder(nbo) - nPendingByOrder[nbo]); + // neededByOrder[nbo] = needed; + // neededByOrder[0] += needed; + // } + + // logger.debug(methodName, null, getId(), "NeededByOrder", type, "after adjustments for pending eviction:", Arrays.toString(neededByOrder)); + + // HashMap<Integer, HashMap<IRmJob, IRmJob>> squatters = new HashMap<Integer, HashMap<IRmJob, IRmJob>>(); + // HashMap<Integer, HashMap<IRmJob, IRmJob>> residents = new HashMap<Integer, HashMap<IRmJob, IRmJob>>(); + + // for ( Share s : allShares.values() ) { + // HashMap<Integer, HashMap<IRmJob, IRmJob>> map = null; + // boolean is_candidate = force ? s.isForceable() : s.isPreemptable(); + // if ( is_candidate ) { + // IRmJob j = s.getJob(); + // ResourceClass rc = j.getResourceClass(); + // if ( rc.getNodepoolName().equals(id) ) { + // map = residents; + // } else { + // map = squatters; + // } + + // int order = j.getShareOrder(); + // HashMap<IRmJob, IRmJob> jmap = null; + // if ( map.containsKey(order) ) { + // jmap = map.get(order); + // } else { + // jmap = new HashMap<IRmJob, IRmJob>(); + // map.put(order, jmap); + // } + // jmap.put(j, j); + // } + // } + + // doEvictions(neededByOrder, squatters, force); + // logger.debug(methodName, null, getId(), "NeededByOrder", type, "after eviction of squatters:", Arrays.toString(neededByOrder)); + // if ( neededByOrder[0] <= 0 ) { + // return; + // } + + // doEvictions(neededByOrder, residents, force); + // logger.debug(methodName, null, getId(), "NeededByOrder", type, "after eviction of residents:", Arrays.toString(neededByOrder)); + // } int findShares( IRmJob j ) 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=1691594&r1=1691593&r2=1691594&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 Fri Jul 17 15:58:13 2015 @@ -334,18 +334,18 @@ public class NodepoolScheduler return String.format("%sQ%d", o, shares); } - /** - * Return the nodepool for a class, or the global nodepool if none is explicitly associated with the class. - * @deprecated Remove as soon as it is verified corrcct. - */ - NodePool getNodepool(ResourceClass rc) - { - String id = rc.getNodepoolName(); - if ( id == null ) { - return globalNodepool; - } - return globalNodepool.getSubpool(id); - } + // /** + // * Return the nodepool for a class, or the global nodepool if none is explicitly associated with the class. + // * @deprecated Remove as soon as it is verified corrcct. + // */ + // NodePool getNodepool(ResourceClass rc) + // { + // String id = rc.getNodepoolName(); + // if ( id == null ) { + // return globalNodepool; + // } + // return globalNodepool.getSubpool(id); + // } // ========================================================================================== // ========================================================================================== @@ -353,20 +353,20 @@ public class NodepoolScheduler // ========================================================================================== // ========================================================================================== - /** - * @deprecated - see rc.geMaxOrder(); - */ - int calculateMaxJobOrder(ArrayList<ResourceClass> rcs) - { - int max = 0; - for ( ResourceClass rc: rcs ) { - HashMap<Integer, HashMap<IRmJob, IRmJob>> jobs = rc.getAllJobsByOrder(); - for ( int i : jobs.keySet() ) { - max= Math.max(max, i); - } - } - return max; - } + // /** + // * @deprecated - see rc.geMaxOrder(); + // */ + // int calculateMaxJobOrder(ArrayList<ResourceClass> rcs) + // { + // int max = 0; + // for ( ResourceClass rc: rcs ) { + // HashMap<Integer, HashMap<IRmJob, IRmJob>> jobs = rc.getAllJobsByOrder(); + // for ( int i : jobs.keySet() ) { + // max= Math.max(max, i); + // } + // } + // return max; + // } private String fmtArray(int[] array) {