You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eagle.apache.org by jj...@apache.org on 2017/04/06 07:22:17 UTC

eagle git commit: [EAGLE-986] HBaseStorage unable to deserialize Deserialize from java

Repository: eagle
Updated Branches:
  refs/heads/master 29b797614 -> 20b4bea3e


[EAGLE-986] HBaseStorage unable to deserialize Deserialize from java

[EAGLE-986] HBaseStorage unable to deserialize  from java object bytes

- recover allocatedMB type from int to long

https://issues.apache.org/jira/browse/EAGLE-986

Author: r7raul1984 <ta...@yhd.com>

Closes #903 from r7raul1984/EAGLE-986.


Project: http://git-wip-us.apache.org/repos/asf/eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/eagle/commit/20b4bea3
Tree: http://git-wip-us.apache.org/repos/asf/eagle/tree/20b4bea3
Diff: http://git-wip-us.apache.org/repos/asf/eagle/diff/20b4bea3

Branch: refs/heads/master
Commit: 20b4bea3edc12e95ed0056594e630564e28fd4a9
Parents: 29b7976
Author: r7raul1984 <ta...@yhd.com>
Authored: Thu Apr 6 07:22:02 2017 +0000
Committer: r7raul1984 <ta...@yhd.com>
Committed: Thu Apr 6 07:22:02 2017 +0000

----------------------------------------------------------------------
 .../jpm/util/resourcefetch/model/AppInfo.java   |   6 +--
 .../eagle/jpm/util/TestAppInfoDeserialize.java  |  46 +++++++++++++++++++
 .../src/test/resources/appinfobyteint           | Bin 0 -> 989 bytes
 .../src/test/resources/appinfobytelong          | Bin 0 -> 989 bytes
 .../webapp/app/apps/jpm/ctrl/compareCtrl.js     |   5 +-
 5 files changed, 53 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/eagle/blob/20b4bea3/eagle-jpm/eagle-jpm-util/src/main/java/org/apache/eagle/jpm/util/resourcefetch/model/AppInfo.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/main/java/org/apache/eagle/jpm/util/resourcefetch/model/AppInfo.java b/eagle-jpm/eagle-jpm-util/src/main/java/org/apache/eagle/jpm/util/resourcefetch/model/AppInfo.java
index 5b0269d..a410ccf 100644
--- a/eagle-jpm/eagle-jpm-util/src/main/java/org/apache/eagle/jpm/util/resourcefetch/model/AppInfo.java
+++ b/eagle-jpm/eagle-jpm-util/src/main/java/org/apache/eagle/jpm/util/resourcefetch/model/AppInfo.java
@@ -43,7 +43,7 @@ public class AppInfo implements Serializable {
     private long elapsedTime;
     private String amContainerLogs;
     private String amHostHttpAddress;
-    private int allocatedMB;
+    private long allocatedMB;
     private int allocatedVCores;
     private int runningContainers;
     // for HDP 2.7
@@ -186,11 +186,11 @@ public class AppInfo implements Serializable {
         this.amHostHttpAddress = amHostHttpAddress;
     }
 
-    public int getAllocatedMB() {
+    public long getAllocatedMB() {
         return allocatedMB;
     }
 
-    public void setAllocatedMB(int allocatedMB) {
+    public void setAllocatedMB(long allocatedMB) {
         this.allocatedMB = allocatedMB;
     }
 

http://git-wip-us.apache.org/repos/asf/eagle/blob/20b4bea3/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/TestAppInfoDeserialize.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/TestAppInfoDeserialize.java b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/TestAppInfoDeserialize.java
new file mode 100644
index 0000000..f833962
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/TestAppInfoDeserialize.java
@@ -0,0 +1,46 @@
+/*
+ * 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.eagle.jpm.util;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.eagle.common.SerializableUtils;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+public class TestAppInfoDeserialize {
+    @Test
+    public void testAppInfoDeserializeFromByteArray() throws IOException {
+        InputStream appinfostream = this.getClass().getResourceAsStream("/appinfobytelong");
+        //serialize allocatedMB as long byte deserializeto long
+        byte[] bytes = IOUtils.toByteArray(appinfostream);
+        Assert.assertNotNull(bytes);
+        SerializableUtils.deserializeFromByteArray(bytes, "AppInfo Deserialize From ByteArray");
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testAppInfoDeserializeFromByteArray1() throws IOException {
+        InputStream appinfostream = this.getClass().getResourceAsStream("/appinfobyteint");
+        //serialize allocatedMB as int byte deserialize to long
+        byte[] bytes = IOUtils.toByteArray(appinfostream);
+        SerializableUtils.deserializeFromByteArray(bytes, "AppInfo Deserialize From ByteArray");
+    }
+}

http://git-wip-us.apache.org/repos/asf/eagle/blob/20b4bea3/eagle-jpm/eagle-jpm-util/src/test/resources/appinfobyteint
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/test/resources/appinfobyteint b/eagle-jpm/eagle-jpm-util/src/test/resources/appinfobyteint
new file mode 100644
index 0000000..6343fe6
Binary files /dev/null and b/eagle-jpm/eagle-jpm-util/src/test/resources/appinfobyteint differ

http://git-wip-us.apache.org/repos/asf/eagle/blob/20b4bea3/eagle-jpm/eagle-jpm-util/src/test/resources/appinfobytelong
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/test/resources/appinfobytelong b/eagle-jpm/eagle-jpm-util/src/test/resources/appinfobytelong
new file mode 100644
index 0000000..f0854c4
Binary files /dev/null and b/eagle-jpm/eagle-jpm-util/src/test/resources/appinfobytelong differ

http://git-wip-us.apache.org/repos/asf/eagle/blob/20b4bea3/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/compareCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/compareCtrl.js b/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/compareCtrl.js
index 121e80e..85168e3 100644
--- a/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/compareCtrl.js
+++ b/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/compareCtrl.js
@@ -44,7 +44,10 @@
 			// ==================================================================
 			// =                         Fetch Job List                         =
 			// ==================================================================
-			var jobList = $scope.jobList = JPM.findMRJobs($scope.site, $scope.jobDefId);
+            var endTime = new Time();
+            var startTime = endTime.clone().subtract(30, 'day');
+            var condition = JPM.condition({site: $scope.site, jobDefId:$scope.jobDefId});
+			var jobList = $scope.jobList = JPM.list("JobExecutionService", condition, startTime, endTime, [], 10000);
 			jobList._promise.then(function () {
 				if(jobList.length <= 1) {
 					$.dialog({