mnemonic-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject incubator-mnemonic git commit: MNEMONIC-189: Expose list handlers from MneReader and MneWriter for Hadoop Durable Computing (HDCS)
Date Tue, 07 Feb 2017 19:00:02 GMT
Repository: incubator-mnemonic
Updated Branches:
  refs/heads/0.5.0-dev 4d1afeed1 -> abda3c44e


MNEMONIC-189: Expose list handlers from MneReader and MneWriter for Hadoop Durable Computing
(HDCS)


Project: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/commit/abda3c44
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/tree/abda3c44
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/diff/abda3c44

Branch: refs/heads/0.5.0-dev
Commit: abda3c44e96ef0cb894108e031317c97afc53b21
Parents: 4d1afee
Author: Wang, Gang(Gary) <gang1.wang@intel.com>
Authored: Tue Feb 7 10:51:46 2017 -0800
Committer: Wang, Gang(Gary) <gang1.wang@intel.com>
Committed: Tue Feb 7 10:56:03 2017 -0800

----------------------------------------------------------------------
 .../hadoop/mapreduce/MneDurableComputable.java  | 28 ++++++++++++++++++++
 .../mapreduce/MneMapreduceRecordReader.java     | 19 ++++++++++---
 .../mapreduce/MneMapreduceRecordWriter.java     | 13 ++++++++-
 3 files changed, 56 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/abda3c44/mnemonic-hadoop/mnemonic-hadoop-mapreduce/src/main/java/org/apache/mnemonic/hadoop/mapreduce/MneDurableComputable.java
----------------------------------------------------------------------
diff --git a/mnemonic-hadoop/mnemonic-hadoop-mapreduce/src/main/java/org/apache/mnemonic/hadoop/mapreduce/MneDurableComputable.java
b/mnemonic-hadoop/mnemonic-hadoop-mapreduce/src/main/java/org/apache/mnemonic/hadoop/mapreduce/MneDurableComputable.java
new file mode 100644
index 0000000..c427454
--- /dev/null
+++ b/mnemonic-hadoop/mnemonic-hadoop-mapreduce/src/main/java/org/apache/mnemonic/hadoop/mapreduce/MneDurableComputable.java
@@ -0,0 +1,28 @@
+/**
+ * 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.mnemonic.hadoop.mapreduce;
+
+import org.apache.mnemonic.CommonAllocator;
+
+public interface MneDurableComputable<A extends CommonAllocator<A>> {
+
+  A getAllocator();
+  
+  long getHandler();
+}

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/abda3c44/mnemonic-hadoop/mnemonic-hadoop-mapreduce/src/main/java/org/apache/mnemonic/hadoop/mapreduce/MneMapreduceRecordReader.java
----------------------------------------------------------------------
diff --git a/mnemonic-hadoop/mnemonic-hadoop-mapreduce/src/main/java/org/apache/mnemonic/hadoop/mapreduce/MneMapreduceRecordReader.java
b/mnemonic-hadoop/mnemonic-hadoop-mapreduce/src/main/java/org/apache/mnemonic/hadoop/mapreduce/MneMapreduceRecordReader.java
index 2de2e64..bdf6170 100644
--- a/mnemonic-hadoop/mnemonic-hadoop-mapreduce/src/main/java/org/apache/mnemonic/hadoop/mapreduce/MneMapreduceRecordReader.java
+++ b/mnemonic-hadoop/mnemonic-hadoop-mapreduce/src/main/java/org/apache/mnemonic/hadoop/mapreduce/MneMapreduceRecordReader.java
@@ -38,13 +38,15 @@ import org.apache.mnemonic.hadoop.MneConfigHelper;
  * @param <V> the type of the data item
  */
 public class MneMapreduceRecordReader<V>
-    extends org.apache.hadoop.mapreduce.RecordReader<NullWritable, V> {
+    extends org.apache.hadoop.mapreduce.RecordReader<NullWritable, V>
+    implements MneDurableComputable<NonVolatileMemAllocator> {
 
   protected Configuration m_conf;
   protected TaskAttemptContext m_context;
   protected NonVolatileMemAllocator m_act;
   protected Iterator<V> m_iter;
   protected long m_slotkeyid;
+  protected long m_handler = 0L;
   protected DurableType[] m_gtypes;
   protected EntityFactoryProxy[] m_efproxies;
   protected String m_msvrname;
@@ -73,9 +75,9 @@ public class MneMapreduceRecordReader<V>
 
     m_act = new NonVolatileMemAllocator(Utils.getNonVolatileMemoryAllocatorService(m_msvrname),
1024000L,
         split.getPath().toString(), true);
-    long handler = m_act.getHandler(m_slotkeyid);
+    m_handler = m_act.getHandler(m_slotkeyid);
     dsllist = DurableSinglyLinkedListFactory.restore(m_act, m_efproxies, 
-        m_gtypes, handler, false);
+        m_gtypes, m_handler, false);
     m_iter = dsllist.iterator();
   }
 
@@ -98,4 +100,15 @@ public class MneMapreduceRecordReader<V>
   public float getProgress() throws IOException {
     return 0.5f; /* TBD */
   }
+
+  @Override
+  public NonVolatileMemAllocator getAllocator() {
+    return m_act;
+  }
+
+  @Override
+  public long getHandler() {
+    return m_handler;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/abda3c44/mnemonic-hadoop/mnemonic-hadoop-mapreduce/src/main/java/org/apache/mnemonic/hadoop/mapreduce/MneMapreduceRecordWriter.java
----------------------------------------------------------------------
diff --git a/mnemonic-hadoop/mnemonic-hadoop-mapreduce/src/main/java/org/apache/mnemonic/hadoop/mapreduce/MneMapreduceRecordWriter.java
b/mnemonic-hadoop/mnemonic-hadoop-mapreduce/src/main/java/org/apache/mnemonic/hadoop/mapreduce/MneMapreduceRecordWriter.java
index 42e4a55..c74590f 100644
--- a/mnemonic-hadoop/mnemonic-hadoop-mapreduce/src/main/java/org/apache/mnemonic/hadoop/mapreduce/MneMapreduceRecordWriter.java
+++ b/mnemonic-hadoop/mnemonic-hadoop-mapreduce/src/main/java/org/apache/mnemonic/hadoop/mapreduce/MneMapreduceRecordWriter.java
@@ -41,7 +41,8 @@ import org.apache.mnemonic.hadoop.MneConfigHelper;
 import org.apache.mnemonic.collections.DurableSinglyLinkedList;
 import org.apache.mnemonic.collections.DurableSinglyLinkedListFactory;
 
-public class MneMapreduceRecordWriter<V> extends RecordWriter<NullWritable, V>
{
+public class MneMapreduceRecordWriter<V> extends RecordWriter<NullWritable, V>
+    implements MneDurableComputable<NonVolatileMemAllocator> {
 
   protected Configuration m_conf;
   protected TaskAttemptContext m_context;
@@ -103,10 +104,20 @@ public class MneMapreduceRecordWriter<V> extends RecordWriter<NullWritable,
V> {
     m_newpool = true;
   }
 
+  @Override
   public NonVolatileMemAllocator getAllocator() {
     return m_act;
   }
 
+  @Override
+  public long getHandler() {
+    long ret = 0L;
+    if (null != m_listnode) {
+      m_listnode.getHandler();
+    }
+    return ret;
+  }
+
   @SuppressWarnings("unchecked")
   protected V createDurableObjectRecord() {
     V ret = null;


Mime
View raw message