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 2014/04/23 19:54:39 UTC
svn commit: r1589470 - in
/uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/files/workitem:
IRemoteLocation.java RemoteLocation.java WorkItemStateKeeper.java
Author: degenaro
Date: Wed Apr 23 17:54:39 2014
New Revision: 1589470
URL: http://svn.apache.org/r1589470
Log:
UIMA-3360 DUCC orchestrator (OR) must report "investment" in work items for each JP so RM can make intelligent preemption decisions
Added:
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/files/workitem/IRemoteLocation.java (with props)
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/files/workitem/RemoteLocation.java (with props)
Modified:
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/files/workitem/WorkItemStateKeeper.java
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/files/workitem/IRemoteLocation.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/files/workitem/IRemoteLocation.java?rev=1589470&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/files/workitem/IRemoteLocation.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/files/workitem/IRemoteLocation.java Wed Apr 23 17:54:39 2014
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.common.jd.files.workitem;
+
+import java.io.Serializable;
+
+public interface IRemoteLocation extends Serializable {
+
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/files/workitem/IRemoteLocation.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/files/workitem/RemoteLocation.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/files/workitem/RemoteLocation.java?rev=1589470&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/files/workitem/RemoteLocation.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/files/workitem/RemoteLocation.java Wed Apr 23 17:54:39 2014
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.common.jd.files.workitem;
+
+public class RemoteLocation implements IRemoteLocation {
+
+ private static final long serialVersionUID = 1L;
+
+ private String nodeIP = null;
+ private String pid = null;
+
+ public RemoteLocation(String nodeIP, String pid) {
+ this.nodeIP = nodeIP;
+ this.pid = pid;
+ }
+
+ public String getNodeIP() {
+ return nodeIP;
+ }
+
+ public String getPid() {
+ return pid;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((nodeIP == null) ? 0 : nodeIP.hashCode()) + ((pid == null) ? 0 : pid.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (this.getClass() != obj.getClass())
+ return false;
+ RemoteLocation that = (RemoteLocation)obj;
+ if(this.nodeIP == null) {
+ return false;
+ }
+ if(that.nodeIP == null) {
+ return false;
+ }
+ if(this.pid == null) {
+ return false;
+ }
+ if(that.pid == null) {
+ return false;
+ }
+ if(!this.nodeIP.equals(that.nodeIP)) {
+ return false;
+ }
+ if(!this.pid.equals(that.pid)) {
+ return false;
+ }
+ return true;
+ }
+
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/files/workitem/RemoteLocation.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/files/workitem/WorkItemStateKeeper.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/files/workitem/WorkItemStateKeeper.java?rev=1589470&r1=1589469&r2=1589470&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/files/workitem/WorkItemStateKeeper.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/files/workitem/WorkItemStateKeeper.java Wed Apr 23 17:54:39 2014
@@ -30,6 +30,7 @@ import java.io.OutputStreamWriter;
import java.io.StringReader;
import java.lang.reflect.Type;
import java.util.Map.Entry;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.zip.GZIPOutputStream;
import org.apache.uima.ducc.common.jd.files.IWorkItemState;
@@ -49,6 +50,46 @@ public class WorkItemStateKeeper extends
initialize(directory);
}
+ public ConcurrentHashMap<RemoteLocation, Long> getOperatingMillisMap(DuccLogger logger) {
+ String location = "getOperatingMillisMap";
+ ConcurrentHashMap<RemoteLocation, Long> map = new ConcurrentHashMap<RemoteLocation, Long>();
+ if(logger!= null) {
+ logger.trace(location, jobid, "size: "+activeMap.size());
+ }
+ for(Entry<Long, IWorkItemState> entry : activeMap.entrySet()) {
+ IWorkItemState wis = entry.getValue();
+ State state = wis.getState();
+ String pid = wis.getPid();
+ String node = wis.getNode();
+ switch(state) {
+ case operating:
+ RemoteLocation key = new RemoteLocation(node, pid);
+ if(key != null) {
+ Long value = new Long(wis.getMillisProcessing());
+ if(logger != null) {
+ logger.trace(location, jobid, "node: "+node+" "+"pid: "+pid+" "+"time: "+value);
+ }
+ if(map.contains(key)) {
+ value += map.get(key);
+ }
+ map.put(key,value);
+ }
+ break;
+ }
+
+ }
+ if(logger != null) {
+ for(Entry<RemoteLocation, Long> entry : map.entrySet()) {
+ RemoteLocation key = entry.getKey();
+ String nodeIP = key.getNodeIP();
+ String pid = key.getPid();
+ Long time = map.get(key);
+ logger.trace(location, jobid, "nodeIP: "+nodeIP+" "+"pid: "+pid+" "+"time: "+time);
+ }
+ }
+ return map;
+ }
+
public synchronized void zip() {
String location = "zip";
try {