You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by de...@apache.org on 2016/12/20 20:51:57 UTC
svn commit: r1775352 - in
/uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws:
DuccMachinesData.java server/nodeviz/NodeViz.java
server/nodeviz/VisualizedHost.java
Author: degenaro
Date: Tue Dec 20 20:51:57 2016
New Revision: 1775352
URL: http://svn.apache.org/viewvc?rev=1775352&view=rev
Log:
UIMA-5181 DUCC Web Server (WS) Viz should display actual and schedulable sizes in concordance with Machines page
Modified:
uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/DuccMachinesData.java
uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/nodeviz/NodeViz.java
uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/nodeviz/VisualizedHost.java
Modified: uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/DuccMachinesData.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/DuccMachinesData.java?rev=1775352&r1=1775351&r2=1775352&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/DuccMachinesData.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/DuccMachinesData.java Tue Dec 20 20:51:57 2016
@@ -525,6 +525,11 @@ public class DuccMachinesData {
return retVal;
}
+ public MachineInfo getMachineInfoForNodeid(NodeId nodeId) {
+ MachineInfo retVal = unsortedMachines.get(nodeId);
+ return retVal;
+ }
+
/**
* Create a cached data set employed by the WS
* to display the System -> Machines page. The
Modified: uima/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/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/nodeviz/NodeViz.java?rev=1775352&r1=1775351&r2=1775352&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/nodeviz/NodeViz.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/nodeviz/NodeViz.java Tue Dec 20 20:51:57 2016
@@ -27,6 +27,7 @@ import java.util.Map.Entry;
import org.apache.uima.ducc.common.Node;
import org.apache.uima.ducc.common.NodeConfiguration;
+import org.apache.uima.ducc.common.NodeIdentity;
import org.apache.uima.ducc.common.SizeBytes;
import org.apache.uima.ducc.common.utils.DuccLogger;
import org.apache.uima.ducc.common.utils.DuccLoggerComponents;
@@ -120,7 +121,7 @@ public class NodeViz
{
String methodName = "generateVisualization";
Map<String, VisualizedHost> hosts = new HashMap<String, VisualizedHost>();
-
+ DuccMachinesData machinesData = DuccMachinesData.getInstance();
IDuccWorkMap jobmap = ev.getWorkMap();
int job_gb = 0;
@@ -128,7 +129,7 @@ public class NodeViz
int pop_gb = 0;
int reservation_gb = 0;
- // Must find nost configuration so we can work out the quantum used to schedule each job
+ // Must find host configuration so we can work out the quantum used to schedule each job
String class_definitions = SystemPropertyResolver
.getStringProperty(DuccPropertiesResolver
.ducc_rm_class_definitions, "scheduler.classes");
@@ -223,18 +224,23 @@ public class NodeViz
default:
break;
}
-
- if ( n != null ) {
+ NodeIdentity ni = n.getNodeIdentity();
+ NodeId nodeId = new NodeId(ni.getName());
+ MachineInfo mi = machinesData.getMachineInfoForNodeid(nodeId);
+ if ( mi != null ) {
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);
+ vh = new VisualizedHost(mi, quantum);
hosts.put(key, vh);
}
-
vh.addWork(type, user, duccid, jobmem, qshares, service_endpoint);
}
+ else {
+ String message = nodeId.getShortName()+" not found?";
+ logger.debug(methodName, w.getDuccId(), message);
+ }
}
}
break;
@@ -254,14 +260,23 @@ public class NodeViz
} else if ( n.getNodeIdentity() == null ) {
logger.debug(methodName, w.getDuccId(), "NodeIdentity [N/A] mem[N/A");
} else {
- 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 + ":");
+ NodeIdentity ni = n.getNodeIdentity();
+ NodeId nodeId = new NodeId(ni.getName());
+ MachineInfo mi = machinesData.getMachineInfoForNodeid(nodeId);
+ if ( mi != null ) {
+ 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(mi, quantum);
+ hosts.put(key, vh);
+ }
+ vh.addWork(type, user, duccid, jobmem, qshares, null);
+ }
+ else {
+ String message = nodeId.getShortName()+" not found?";
+ logger.debug(methodName, w.getDuccId(), message);
}
- vh.addWork(type, user, duccid, jobmem, qshares, null);
}
}
}
Modified: uima/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/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/nodeviz/VisualizedHost.java?rev=1775352&r1=1775351&r2=1775352&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/nodeviz/VisualizedHost.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/nodeviz/VisualizedHost.java Tue Dec 20 20:51:57 2016
@@ -24,7 +24,6 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
-import org.apache.uima.ducc.common.Node;
import org.apache.uima.ducc.common.utils.DuccLogger;
import org.apache.uima.ducc.common.utils.DuccLoggerComponents;
import org.apache.uima.ducc.transport.event.common.IDuccTypes.DuccType;
@@ -48,27 +47,10 @@ class VisualizedHost
List<JobFragment> fragments = new ArrayList<JobFragment>();
/**
- * Generate host from OR state which contains info about the work on a host.
- */
- VisualizedHost(Node n, int quantum)
- {
- this.quantum = quantum;
- this.name = NodeViz.strip(n.getNodeIdentity().getName());
- this.ip = n.getNodeIdentity().getIp();
-
- // mem from OR pub is in KB. must convert to GB
- this.mem_total = (int) n.getNodeMetrics().getNodeMemory().getMemFree() / ( 1024 * 1024 );
- this.shares_reserve = (mem_total / quantum);
- this.shares_free = shares_reserve;
- this.mem_reserve = shares_reserve * quantum;
- }
-
- /**
* Generate host from agent publications because OR state only has host info for hosts with work on them.
*/
VisualizedHost(MachineInfo info, int quantum)
{
-
this.quantum = quantum;
this.name = NodeViz.strip(info.getName());
this.ip = info.getIp();