Author: challngr Date: Tue Aug 27 20:25:48 2013 New Revision: 1517971 URL: http://svn.apache.org/r1517971 Log: UIMA-3215 Logging updates.
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/JobManagerConverter.java uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/scheduler/RmJob.java Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/JobManagerConverter.java URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/JobManagerConverter.java?rev=1517971&r1=1517970&r2=1517971&view=diff ============================================================================== --- uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/JobManagerConverter.java (original) +++ uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/JobManagerConverter.java Tue Aug 27 20:25:48 2013 @@ -18,7 +18,10 @@ */ package org.apache.uima.ducc.rm; +import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; import org.apache.uima.ducc.common.Node; @@ -855,9 +858,9 @@ public class JobManagerConverter continue; } - Map<DuccId, IResource> all_shares = new HashMap<DuccId, IResource>(); - Map<DuccId, IResource> shrunken_shares = new HashMap<DuccId, IResource>(); - Map<DuccId, IResource> expanded_shares = new HashMap<DuccId, IResource>(); + Map<DuccId, IResource> all_shares = new LinkedHashMap<DuccId, IResource>(); + Map<DuccId, IResource> shrunken_shares = new LinkedHashMap<DuccId, IResource>(); + Map<DuccId, IResource> expanded_shares = new LinkedHashMap<DuccId, IResource>(); Map<Share, Share> shares = null; Map<Share, Share> redrive = null; @@ -866,7 +869,9 @@ public class JobManagerConverter } else { shares = j.getAssignedShares(); if ( shares != null ) { - for ( Share s : shares.values() ) { + ArrayList<Share> sorted = new ArrayList<Share>(shares.values()); + Collections.sort(sorted, new RmJob.ShareByInvestmentSorter()); + for ( Share s : sorted ) { Resource r = new Resource(s.getId(), s.getNode(), s.isPurged(), s.getShareOrder()); all_shares.put(s.getId(), r); } @@ -1021,5 +1026,6 @@ public class JobManagerConverter return (nodes.size() != 0); } + } Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/scheduler/RmJob.java URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/scheduler/RmJob.java?rev=1517971&r1=1517970&r2=1517971&view=diff ============================================================================== --- uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/scheduler/RmJob.java (original) +++ uima/sandbox/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/scheduler/RmJob.java Tue Aug 27 20:25:48 2013 @@ -913,14 +913,7 @@ public class RmJob */ int getProjectedCap() { - String methodName = "getPrjCap"; // want this to line up with getJobCap in logs - if ( init_wait ) { // no cap if not initialized, because we don't know. other caps will dominate. - return Integer.MAX_VALUE; - } - - if ( time_per_item == Double.NaN ) { - return Integer.MAX_VALUE; - } + String methodName = "getPrjCap"; // want this to line up with getJobCap in logs // Get average init time int count = 0; @@ -951,13 +944,22 @@ public class RmJob long future = Math.max(nquestions_remaining - projected, 0); // work still to do after doubling logger.info(methodName, getId(), username, "O", getShareOrder(),"T", target, "NTh", (nprocesses * threads), "TI", avg_init, - "TR", (long) time_per_item, + "TR", time_per_item, "R", String.format("%.4e", rate), "QR", nquestions_remaining, "P", projected, "F", future, + "ST", submit_time, "return", (future / threads)); - int answer = (int) future / threads; - if ( (future % threads ) > 0 ) answer++; + int answer = 0; + + if ( init_wait || (time_per_item == Double.NaN) ) { // no cap if not initialized, or no per-itme time yet + // (We could exit sooner but for debugging purposes we very much want that log statement just above even + // if there's some junk in it.) + answer = Integer.MAX_VALUE; + } else { + answer = (int) future / threads; + if ( (future % threads ) > 0 ) answer++; + } return answer; // number of processes we expect to need // in the future @@ -1246,6 +1248,7 @@ public class RmJob shares = countInstances(); } + if ( name == null ) name = ""; // 1 2 3 4 5 6 7 8 9 10 11 12 13 String format = "%11s %30.30s %10s %10s %6d %5d %7d %3d %6d %6d %8d %8s %9d"; String jid = String.format("%1s%10s", getShortType(), id.toString()).replace(' ', '_'); @@ -1294,7 +1297,7 @@ public class RmJob // // Order shares by INCREASING investment // - class ShareByInvestmentSorter + public static class ShareByInvestmentSorter implements Comparator<Share> { public int compare(Share s1, Share s2)