You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by ch...@apache.org on 2014/07/16 03:55:19 UTC
svn commit: r1610898 - in
/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/nodeviz:
NodeViz.java VisualizedHost.java
Author: challngr
Date: Wed Jul 16 01:55:19 2014
New Revision: 1610898
URL: http://svn.apache.org/r1610898
Log:
UIMA-3900 Strip domain when used as keys in the VisualizedHost map to avoid dups.
Modified:
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/nodeviz/NodeViz.java
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/nodeviz/VisualizedHost.java
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/nodeviz/NodeViz.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/nodeviz/NodeViz.java?rev=1610898&r1=1610897&r2=1610898&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/nodeviz/NodeViz.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/nodeviz/NodeViz.java Wed Jul 16 01:55:19 2014
@@ -173,9 +173,10 @@ public class NodeViz
}
if ( n != null ) {
- String key = n.getNodeIdentity().getName();
+ String key = strip(n.getNodeIdentity().getName());
VisualizedHost vh = hosts.get(key);
if ( vh == null ) {
+ // System.out.println("Set host from OR with key:" + key + ":");
vh = new VisualizedHost(n, quantum);
hosts.put(key, vh);
}
@@ -199,11 +200,12 @@ public class NodeViz
if ( n == null ) {
logger.debug(methodName, w.getDuccId(), "Node [N/A] mem[N/A");
} else {
- String key = n.getNodeIdentity().getName();
+ String key = strip(n.getNodeIdentity().getName());
VisualizedHost vh = hosts.get(key);
if ( vh == null ) {
vh = new VisualizedHost(n, quantum);
hosts.put(key, vh);
+ // System.out.println("Set host from OR with key:" + key + ":");
}
vh.addWork(type, user, duccid, jobmem, qshares, null);
}
@@ -223,8 +225,9 @@ public class NodeViz
for (String s : m.keySet()) {
if ( ! hosts.containsKey(s) ) {
+ // System.out.println("Set host from MachineInfo with key :" + s + ":");
VisualizedHost vh = new VisualizedHost(m.get(s), quantum);
- hosts.put(s, vh);
+ hosts.put(strip(s), vh);
}
}
@@ -279,6 +282,20 @@ public class NodeViz
hosts = null;
}
+ /**
+ * Possibly strip domain name from hostname
+ */
+ static String strip(String n)
+ {
+ if ( strip_domain ) {
+ int ndx = n.indexOf(".");
+ if ( ndx >= 0) {
+ n = n.substring(0, ndx);
+ }
+ }
+ return n;
+ }
+
public void update(OrchestratorStateDuccEvent ev)
{
String methodName = "update";
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/nodeviz/VisualizedHost.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/nodeviz/VisualizedHost.java?rev=1610898&r1=1610897&r2=1610898&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/nodeviz/VisualizedHost.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/nodeviz/VisualizedHost.java Wed Jul 16 01:55:19 2014
@@ -37,7 +37,7 @@ class VisualizedHost
VisualizedHost(Node n, int quantum)
{
this.quantum = quantum;
- this.name = strip(n.getNodeIdentity().getName());
+ this.name = NodeViz.strip(n.getNodeIdentity().getName());
this.ip = n.getNodeIdentity().getIp();
// mem from OR pub is in KB. must convert to GB
@@ -53,9 +53,9 @@ class VisualizedHost
*/
VisualizedHost(MachineInfo info, int quantum)
{
- this.quantum = quantum;
- this.name = strip(info.getName());
+ this.quantum = quantum;
+ this.name = NodeViz.strip(info.getName());
this.ip = info.getIp();
String ns = info.getSharesTotal();
@@ -72,20 +72,6 @@ class VisualizedHost
this.shares_free = shares;
}
- /**
- * Possibly strip domain name from hostname
- */
- String strip(String n)
- {
- if ( NodeViz.strip_domain ) {
- int ndx = n.indexOf(".");
- if ( ndx >= 0) {
- n = n.substring(0, ndx);
- }
- }
- return n;
- }
-
int countShares()
{
return shares;