You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by wa...@apache.org on 2016/08/09 22:33:43 UTC
[01/50] [abbrv] hadoop git commit: YARN-4888. Changes in scheduler to
identify resource-requests explicitly by allocation-id. (Subru Krishnan via
wangda) [Forced Update!]
Repository: hadoop
Updated Branches:
refs/heads/YARN-3368 1b56d537f -> 3c2c918a8 (forced update)
YARN-4888. Changes in scheduler to identify resource-requests explicitly by allocation-id. (Subru Krishnan via wangda)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/3f100d76
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/3f100d76
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/3f100d76
Branch: refs/heads/YARN-3368
Commit: 3f100d76ff5df020dbb8ecd4f5b4f9736a0a8270
Parents: e0d131f
Author: Wangda Tan <wa...@apache.org>
Authored: Fri Aug 5 10:43:35 2016 -0700
Committer: Wangda Tan <wa...@apache.org>
Committed: Fri Aug 5 10:43:35 2016 -0700
----------------------------------------------------------------------
.../src/main/proto/yarn_protos.proto | 2 +-
.../hadoop/yarn/server/utils/BuilderUtils.java | 14 +-
.../OpportunisticContainerAllocator.java | 3 +-
.../scheduler/SchedulerRequestKey.java | 41 ++-
.../allocator/RegularContainerAllocator.java | 15 +-
.../scheduler/fair/FSAppAttempt.java | 11 +-
.../scheduler/fifo/FifoScheduler.java | 7 +-
.../yarn/server/resourcemanager/MockAM.java | 25 +-
.../scheduler/TestAppSchedulingInfo.java | 37 ++-
.../TestSchedulingWithAllocationRequestId.java | 274 +++++++++++++++++++
.../scheduler/capacity/TestUtils.java | 8 +-
11 files changed, 399 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3f100d76/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto
index 6c337cf..d9ce11f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto
@@ -303,7 +303,7 @@ message ResourceRequestProto {
optional bool relax_locality = 5 [default = true];
optional string node_label_expression = 6;
optional ExecutionTypeRequestProto execution_type_request = 7;
- optional int64 allocation_request_id = 8 [default = -1];
+ optional int64 allocation_request_id = 8 [default = 0];
}
message ExecutionTypeRequestProto {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3f100d76/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/utils/BuilderUtils.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/utils/BuilderUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/utils/BuilderUtils.java
index 5aa1c41..8ecbea7 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/utils/BuilderUtils.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/utils/BuilderUtils.java
@@ -236,7 +236,8 @@ public class BuilderUtils {
public static Container newContainer(ContainerId containerId, NodeId nodeId,
String nodeHttpAddress, Resource resource, Priority priority,
- Token containerToken, ExecutionType executionType) {
+ Token containerToken, ExecutionType executionType,
+ long allocationRequestId) {
Container container = recordFactory.newRecordInstance(Container.class);
container.setId(containerId);
container.setNodeId(nodeId);
@@ -245,6 +246,7 @@ public class BuilderUtils {
container.setPriority(priority);
container.setContainerToken(containerToken);
container.setExecutionType(executionType);
+ container.setAllocationRequestId(allocationRequestId);
return container;
}
@@ -252,7 +254,15 @@ public class BuilderUtils {
String nodeHttpAddress, Resource resource, Priority priority,
Token containerToken) {
return newContainer(containerId, nodeId, nodeHttpAddress, resource,
- priority, containerToken, ExecutionType.GUARANTEED);
+ priority, containerToken, ExecutionType.GUARANTEED, 0);
+ }
+
+ public static Container newContainer(ContainerId containerId, NodeId nodeId,
+ String nodeHttpAddress, Resource resource, Priority priority,
+ Token containerToken, long allocationRequestId) {
+ return newContainer(containerId, nodeId, nodeHttpAddress, resource,
+ priority, containerToken, ExecutionType.GUARANTEED,
+ allocationRequestId);
}
public static <T extends Token> T newToken(Class<T> tokenClass,
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3f100d76/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/scheduler/OpportunisticContainerAllocator.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/scheduler/OpportunisticContainerAllocator.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/scheduler/OpportunisticContainerAllocator.java
index ce5bda0..4723233 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/scheduler/OpportunisticContainerAllocator.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/scheduler/OpportunisticContainerAllocator.java
@@ -163,7 +163,8 @@ public class OpportunisticContainerAllocator {
Container container = BuilderUtils.newContainer(
cId, nodeId, nodeId.getHost() + ":" + webpagePort,
capability, rr.getPriority(), containerToken,
- containerTokenIdentifier.getExecutionType());
+ containerTokenIdentifier.getExecutionType(),
+ rr.getAllocationRequestId());
return container;
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3f100d76/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerRequestKey.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerRequestKey.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerRequestKey.java
index b4988be..4b640ae 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerRequestKey.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerRequestKey.java
@@ -30,9 +30,7 @@ public final class SchedulerRequestKey implements
Comparable<SchedulerRequestKey> {
private final Priority priority;
-
- public static final SchedulerRequestKey UNDEFINED =
- new SchedulerRequestKey(Priority.UNDEFINED);
+ private final long allocationRequestId;
/**
* Factory method to generate a SchedulerRequestKey from a ResourceRequest.
@@ -40,7 +38,8 @@ public final class SchedulerRequestKey implements
* @return SchedulerRequestKey
*/
public static SchedulerRequestKey create(ResourceRequest req) {
- return new SchedulerRequestKey(req.getPriority());
+ return new SchedulerRequestKey(req.getPriority(),
+ req.getAllocationRequestId());
}
/**
@@ -50,11 +49,13 @@ public final class SchedulerRequestKey implements
* @return SchedulerRequestKey
*/
public static SchedulerRequestKey extractFrom(Container container) {
- return new SchedulerRequestKey(container.getPriority());
+ return new SchedulerRequestKey(container.getPriority(),
+ container.getAllocationRequestId());
}
- private SchedulerRequestKey(Priority priority) {
+ private SchedulerRequestKey(Priority priority, long allocationRequestId) {
this.priority = priority;
+ this.allocationRequestId = allocationRequestId;
}
/**
@@ -66,6 +67,15 @@ public final class SchedulerRequestKey implements
return priority;
}
+ /**
+ * Get the Id of the associated {@link ResourceRequest}.
+ *
+ * @return the Id of the associated {@link ResourceRequest}
+ */
+ public long getAllocationRequestId() {
+ return allocationRequestId;
+ }
+
@Override
public int compareTo(SchedulerRequestKey o) {
if (o == null) {
@@ -75,7 +85,12 @@ public final class SchedulerRequestKey implements
return 1;
}
}
- return o.getPriority().compareTo(priority);
+ int priorityCompare = o.getPriority().compareTo(priority);
+ // we first sort by priority and then by allocationRequestId
+ if (priorityCompare != 0) {
+ return priorityCompare;
+ }
+ return Long.compare(allocationRequestId, o.getAllocationRequestId());
}
@Override
@@ -88,12 +103,20 @@ public final class SchedulerRequestKey implements
}
SchedulerRequestKey that = (SchedulerRequestKey) o;
- return getPriority().equals(that.getPriority());
+ if (getAllocationRequestId() != that.getAllocationRequestId()) {
+ return false;
+ }
+ return getPriority() != null ?
+ getPriority().equals(that.getPriority()) :
+ that.getPriority() == null;
}
@Override
public int hashCode() {
- return getPriority().hashCode();
+ int result = getPriority() != null ? getPriority().hashCode() : 0;
+ result = 31 * result + (int) (getAllocationRequestId() ^ (
+ getAllocationRequestId() >>> 32));
+ return result;
}
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3f100d76/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/allocator/RegularContainerAllocator.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/allocator/RegularContainerAllocator.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/allocator/RegularContainerAllocator.java
index 21114f7..8d4042c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/allocator/RegularContainerAllocator.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/allocator/RegularContainerAllocator.java
@@ -18,6 +18,9 @@
package org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.allocator;
+import java.util.ArrayList;
+import java.util.List;
+
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -34,10 +37,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceLimits;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerAppUtils;
-
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerRequestKey;
-
-
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerUtils;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.activities.ActivityDiagnosticConstant;
@@ -54,9 +54,6 @@ import org.apache.hadoop.yarn.server.utils.BuilderUtils;
import org.apache.hadoop.yarn.util.resource.ResourceCalculator;
import org.apache.hadoop.yarn.util.resource.Resources;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Allocate normal (new) containers, considers locality/label, etc. Using
* delayed scheduling mechanism to get better locality allocation.
@@ -681,8 +678,10 @@ public class RegularContainerAllocator extends AbstractContainerAllocator {
application.getNewContainerId());
// Create the container
- return BuilderUtils.newContainer(containerId, nodeId, node.getRMNode()
- .getHttpAddress(), capability, schedulerKey.getPriority(), null);
+ return BuilderUtils.newContainer(containerId, nodeId,
+ node.getRMNode().getHttpAddress(), capability,
+ schedulerKey.getPriority(), null,
+ schedulerKey.getAllocationRequestId());
}
private ContainerAllocation handleNewContainerAllocation(
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3f100d76/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSAppAttempt.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSAppAttempt.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSAppAttempt.java
index 8f074cd..9e5a807 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSAppAttempt.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSAppAttempt.java
@@ -20,8 +20,8 @@ package org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair;
import java.io.Serializable;
import java.text.DecimalFormat;
-import java.util.Arrays;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
@@ -55,8 +55,8 @@ import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ActiveUsersManage
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt;
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerRequestKey;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerNode;
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerRequestKey;
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
import org.apache.hadoop.yarn.util.resource.DefaultResourceCalculator;
import org.apache.hadoop.yarn.util.resource.Resources;
@@ -495,9 +495,10 @@ public class FSAppAttempt extends SchedulerApplicationAttempt
getApplicationAttemptId(), getNewContainerId());
// Create the container
- Container container =
- BuilderUtils.newContainer(containerId, nodeId, node.getRMNode()
- .getHttpAddress(), capability, schedulerKey.getPriority(), null);
+ Container container = BuilderUtils.newContainer(containerId, nodeId,
+ node.getRMNode().getHttpAddress(), capability,
+ schedulerKey.getPriority(), null,
+ schedulerKey.getAllocationRequestId());
return container;
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3f100d76/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java
index fe8d0af..2863a97 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java
@@ -710,9 +710,10 @@ public class FifoScheduler extends
.getApplicationAttemptId(), application.getNewContainerId());
// Create the container
- Container container =
- BuilderUtils.newContainer(containerId, nodeId, node.getRMNode()
- .getHttpAddress(), capability, schedulerKey.getPriority(), null);
+ Container container = BuilderUtils.newContainer(containerId, nodeId,
+ node.getRMNode().getHttpAddress(), capability,
+ schedulerKey.getPriority(), null,
+ schedulerKey.getAllocationRequestId());
// Allocate!
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3f100d76/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockAM.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockAM.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockAM.java
index 8f6a6c1..1b11472 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockAM.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockAM.java
@@ -128,7 +128,13 @@ public class MockAM {
public void addRequests(String[] hosts, int memory, int priority,
int containers) throws Exception {
- requests.addAll(createReq(hosts, memory, priority, containers));
+ addRequests(hosts, memory, priority, containers, 0L);
+ }
+
+ public void addRequests(String[] hosts, int memory, int priority,
+ int containers, long allocationRequestId) throws Exception {
+ requests.addAll(
+ createReq(hosts, memory, priority, containers, allocationRequestId));
}
public AllocateResponse schedule() throws Exception {
@@ -159,17 +165,19 @@ public class MockAM {
List<ContainerId> releases, String labelExpression) throws Exception {
List<ResourceRequest> reqs =
createReq(new String[] { host }, memory, priority, numContainers,
- labelExpression);
+ labelExpression, 0L);
return allocate(reqs, releases);
}
- public List<ResourceRequest> createReq(String[] hosts, int memory, int priority,
- int containers) throws Exception {
- return createReq(hosts, memory, priority, containers, null);
+ public List<ResourceRequest> createReq(String[] hosts, int memory,
+ int priority, int containers, long allocationRequestId) throws Exception {
+ return createReq(hosts, memory, priority, containers, null,
+ allocationRequestId);
}
- public List<ResourceRequest> createReq(String[] hosts, int memory, int priority,
- int containers, String labelExpression) throws Exception {
+ public List<ResourceRequest> createReq(String[] hosts, int memory,
+ int priority, int containers, String labelExpression,
+ long allocationRequestId) throws Exception {
List<ResourceRequest> reqs = new ArrayList<ResourceRequest>();
if (hosts != null) {
for (String host : hosts) {
@@ -178,10 +186,12 @@ public class MockAM {
ResourceRequest hostReq =
createResourceReq(host, memory, priority, containers,
labelExpression);
+ hostReq.setAllocationRequestId(allocationRequestId);
reqs.add(hostReq);
ResourceRequest rackReq =
createResourceReq("/default-rack", memory, priority, containers,
labelExpression);
+ rackReq.setAllocationRequestId(allocationRequestId);
reqs.add(rackReq);
}
}
@@ -189,6 +199,7 @@ public class MockAM {
ResourceRequest offRackReq = createResourceReq(ResourceRequest.ANY, memory,
priority, containers, labelExpression);
+ offRackReq.setAllocationRequestId(allocationRequestId);
reqs.add(offRackReq);
return reqs;
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3f100d76/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/TestAppSchedulingInfo.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/TestAppSchedulingInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/TestAppSchedulingInfo.java
index a1c6294..503ea34 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/TestAppSchedulingInfo.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/TestAppSchedulingInfo.java
@@ -18,12 +18,17 @@
package org.apache.hadoop.yarn.server.resourcemanager.scheduler;
-import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+
import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.TreeSet;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationId;
+import org.apache.hadoop.yarn.api.records.Priority;
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.TestUtils;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue;
import org.junit.Assert;
import org.junit.Test;
@@ -70,4 +75,34 @@ public class TestAppSchedulingInfo {
blacklistRemovals);
Assert.assertFalse(appSchedulingInfo.getAndResetBlacklistChanged());
}
+
+ @Test
+ public void testSchedulerRequestKeyOrdering() {
+ TreeSet<SchedulerRequestKey> ts = new TreeSet<>();
+ ts.add(TestUtils.toSchedulerKey(Priority.newInstance(1), 1));
+ ts.add(TestUtils.toSchedulerKey(Priority.newInstance(1), 2));
+ ts.add(TestUtils.toSchedulerKey(Priority.newInstance(0), 4));
+ ts.add(TestUtils.toSchedulerKey(Priority.newInstance(0), 3));
+ ts.add(TestUtils.toSchedulerKey(Priority.newInstance(2), 5));
+ ts.add(TestUtils.toSchedulerKey(Priority.newInstance(2), 6));
+ Iterator<SchedulerRequestKey> iter = ts.iterator();
+ SchedulerRequestKey sk = iter.next();
+ Assert.assertEquals(0, sk.getPriority().getPriority());
+ Assert.assertEquals(3, sk.getAllocationRequestId());
+ sk = iter.next();
+ Assert.assertEquals(0, sk.getPriority().getPriority());
+ Assert.assertEquals(4, sk.getAllocationRequestId());
+ sk = iter.next();
+ Assert.assertEquals(1, sk.getPriority().getPriority());
+ Assert.assertEquals(1, sk.getAllocationRequestId());
+ sk = iter.next();
+ Assert.assertEquals(1, sk.getPriority().getPriority());
+ Assert.assertEquals(2, sk.getAllocationRequestId());
+ sk = iter.next();
+ Assert.assertEquals(2, sk.getPriority().getPriority());
+ Assert.assertEquals(5, sk.getAllocationRequestId());
+ sk = iter.next();
+ Assert.assertEquals(2, sk.getPriority().getPriority());
+ Assert.assertEquals(6, sk.getAllocationRequestId());
+ }
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3f100d76/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/TestSchedulingWithAllocationRequestId.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/TestSchedulingWithAllocationRequestId.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/TestSchedulingWithAllocationRequestId.java
new file mode 100644
index 0000000..e60fd6f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/TestSchedulingWithAllocationRequestId.java
@@ -0,0 +1,274 @@
+/**
+ * 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.hadoop.yarn.server.resourcemanager.scheduler;
+
+import java.util.List;
+
+import org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse;
+import org.apache.hadoop.yarn.api.records.Container;
+import org.apache.hadoop.yarn.api.records.NodeId;
+import org.apache.hadoop.yarn.conf.YarnConfiguration;
+import org.apache.hadoop.yarn.server.resourcemanager.MockAM;
+import org.apache.hadoop.yarn.server.resourcemanager.MockNM;
+import org.apache.hadoop.yarn.server.resourcemanager.MockRM;
+import org.apache.hadoop.yarn.server.resourcemanager.ParameterizedSchedulerTestBase;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Tests for checking Scheduling with allocationRequestId, i.e. mapping of
+ * allocated containers to the original client {@code ResourceRequest}.
+ */
+public class TestSchedulingWithAllocationRequestId
+ extends ParameterizedSchedulerTestBase {
+
+ private static final Logger LOG =
+ LoggerFactory.getLogger(TestSchedulingWithAllocationRequestId.class);
+ private static final int GB = 1024;
+
+ @Test
+ public void testMultipleAllocationRequestIds() throws Exception {
+ configureScheduler();
+ YarnConfiguration conf = getConf();
+ MockRM rm = new MockRM(conf);
+ try {
+ rm.start();
+
+ MockNM nm1 = rm.registerNode("127.0.0.1:1234", 4 * GB);
+ MockNM nm2 = rm.registerNode("127.0.0.2:5678", 4 * GB);
+ RMApp app1 = rm.submitApp(2048);
+ // kick the scheduling
+ nm1.nodeHeartbeat(true);
+ RMAppAttempt attempt1 = app1.getCurrentAppAttempt();
+ MockAM am1 = rm.sendAMLaunched(attempt1.getAppAttemptId());
+ am1.registerAppAttempt();
+
+ // add request for containers with id 10 & 20
+ am1.addRequests(new String[] {"127.0.0.1" }, 2 * GB, 1, 1, 10L);
+ AllocateResponse allocResponse = am1.schedule(); // send the request
+ am1.addRequests(new String[] {"127.0.0.2" }, 2 * GB, 1, 2, 20L);
+ allocResponse = am1.schedule(); // send the request
+
+ // check if request id 10 is satisfied
+ nm1.nodeHeartbeat(true);
+ allocResponse = am1.schedule(); // send the request
+ while (allocResponse.getAllocatedContainers().size() < 1) {
+ LOG.info("Waiting for containers to be created for app 1...");
+ Thread.sleep(100);
+ allocResponse = am1.schedule();
+ }
+ List<Container> allocated = allocResponse.getAllocatedContainers();
+ Assert.assertEquals(1, allocated.size());
+ checkAllocatedContainer(allocated.get(0), 2 * GB, nm1.getNodeId(), 10);
+
+ // check now if request id 20 is satisfied
+ nm2.nodeHeartbeat(true);
+ while (allocResponse.getAllocatedContainers().size() < 2) {
+ LOG.info("Waiting for containers to be created for app 1...");
+ Thread.sleep(100);
+ allocResponse = am1.schedule();
+ }
+
+ allocated = allocResponse.getAllocatedContainers();
+ Assert.assertEquals(2, allocated.size());
+ for (Container container : allocated) {
+ checkAllocatedContainer(container, 2 * GB, nm2.getNodeId(), 20);
+ }
+ } finally {
+ if (rm != null) {
+ rm.stop();
+ }
+ }
+ }
+
+ @Test
+ public void testMultipleAllocationRequestDiffPriority() throws Exception {
+ configureScheduler();
+ YarnConfiguration conf = getConf();
+ MockRM rm = new MockRM(conf);
+ try {
+ rm.start();
+
+ MockNM nm1 = rm.registerNode("127.0.0.1:1234", 4 * GB);
+ MockNM nm2 = rm.registerNode("127.0.0.2:5678", 4 * GB);
+ RMApp app1 = rm.submitApp(2048);
+ // kick the scheduling
+ nm1.nodeHeartbeat(true);
+ RMAppAttempt attempt1 = app1.getCurrentAppAttempt();
+ MockAM am1 = rm.sendAMLaunched(attempt1.getAppAttemptId());
+ am1.registerAppAttempt();
+
+ // add request for containers with id 10 & 20
+ am1.addRequests(new String[] {"127.0.0.1" }, 2 * GB, 2, 1, 10L);
+ AllocateResponse allocResponse = am1.schedule(); // send the request
+ am1.addRequests(new String[] {"127.0.0.2" }, 2 * GB, 1, 2, 20L);
+ allocResponse = am1.schedule(); // send the request
+
+ // check if request id 20 is satisfied first
+ nm2.nodeHeartbeat(true);
+ while (allocResponse.getAllocatedContainers().size() < 2) {
+ LOG.info("Waiting for containers to be created for app 1...");
+ Thread.sleep(100);
+ allocResponse = am1.schedule();
+ }
+
+ List<Container> allocated = allocResponse.getAllocatedContainers();
+ Assert.assertEquals(2, allocated.size());
+ for (Container container : allocated) {
+ checkAllocatedContainer(container, 2 * GB, nm2.getNodeId(), 20);
+ }
+
+ // check now if request id 10 is satisfied
+ nm1.nodeHeartbeat(true);
+ allocResponse = am1.schedule(); // send the request
+ while (allocResponse.getAllocatedContainers().size() < 1) {
+ LOG.info("Waiting for containers to be created for app 1...");
+ Thread.sleep(100);
+ allocResponse = am1.schedule();
+ }
+ allocated = allocResponse.getAllocatedContainers();
+ Assert.assertEquals(1, allocated.size());
+ checkAllocatedContainer(allocated.get(0), 2 * GB, nm1.getNodeId(), 10);
+ } finally {
+ if (rm != null) {
+ rm.stop();
+ }
+ }
+ }
+
+ private void checkAllocatedContainer(Container allocated, int memory,
+ NodeId nodeId, long allocationRequestId) {
+ Assert.assertEquals(memory, allocated.getResource().getMemorySize());
+ Assert.assertEquals(nodeId, allocated.getNodeId());
+ Assert.assertEquals(allocationRequestId,
+ allocated.getAllocationRequestId());
+ }
+
+ @Test
+ public void testMultipleAppsWithAllocationReqId() throws Exception {
+ configureScheduler();
+ YarnConfiguration conf = getConf();
+ MockRM rm = new MockRM(conf);
+ try {
+ rm.start();
+
+ // Register node1
+ String host0 = "host_0";
+ String host1 = "host_1";
+ MockNM nm1 =
+ new MockNM(host0 + ":1234", 8 * GB, rm.getResourceTrackerService());
+ nm1.registerNode();
+
+ // Register node2
+ MockNM nm2 =
+ new MockNM(host1 + ":2351", 8 * GB, rm.getResourceTrackerService());
+ nm2.registerNode();
+
+ // submit 1st app
+ RMApp app1 = rm.submitApp(1 * GB, "user_0", "a1");
+ MockAM am1 = MockRM.launchAndRegisterAM(app1, rm, nm1);
+
+ // Submit app1 RR with allocationReqId = 5
+ int numContainers = 1;
+ am1.addRequests(new String[] {host0, host1 }, 1 * GB, 1, numContainers,
+ 5L);
+ AllocateResponse allocResponse = am1.schedule();
+
+ // wait for containers to be allocated.
+ nm1.nodeHeartbeat(true);
+ allocResponse = am1.schedule(); // send the request
+ while (allocResponse.getAllocatedContainers().size() < 1) {
+ LOG.info("Waiting for containers to be created for app 1...");
+ Thread.sleep(100);
+ allocResponse = am1.schedule();
+ }
+
+ List<Container> allocated = allocResponse.getAllocatedContainers();
+ Assert.assertEquals(1, allocated.size());
+ checkAllocatedContainer(allocated.get(0), 1 * GB, nm1.getNodeId(), 5L);
+
+ // Submit another application
+ RMApp app2 = rm.submitApp(1 * GB, "user_1", "a2");
+ MockAM am2 = MockRM.launchAndRegisterAM(app2, rm, nm2);
+
+ // Submit app2 RR with allocationReqId = 5
+ am2.addRequests(new String[] {host0, host1 }, 2 * GB, 1, numContainers,
+ 5L);
+ am2.schedule();
+
+ // wait for containers to be allocated.
+ nm2.nodeHeartbeat(true);
+ allocResponse = am2.schedule(); // send the request
+ while (allocResponse.getAllocatedContainers().size() < 1) {
+ LOG.info("Waiting for containers to be created for app 1...");
+ Thread.sleep(100);
+ allocResponse = am2.schedule();
+ }
+
+ allocated = allocResponse.getAllocatedContainers();
+ Assert.assertEquals(1, allocated.size());
+ checkAllocatedContainer(allocated.get(0), 2 * GB, nm2.getNodeId(), 5L);
+
+ // Now submit app2 RR with allocationReqId = 10
+ am2.addRequests(new String[] {host0, host1 }, 3 * GB, 1, numContainers,
+ 10L);
+ am2.schedule();
+
+ // wait for containers to be allocated.
+ nm1.nodeHeartbeat(true);
+ allocResponse = am2.schedule(); // send the request
+ while (allocResponse.getAllocatedContainers().size() < 1) {
+ LOG.info("Waiting for containers to be created for app 1...");
+ Thread.sleep(100);
+ allocResponse = am2.schedule();
+ }
+
+ allocated = allocResponse.getAllocatedContainers();
+ Assert.assertEquals(1, allocated.size());
+ checkAllocatedContainer(allocated.get(0), 3 * GB, nm1.getNodeId(), 10L);
+
+ // Now submit app1 RR with allocationReqId = 10
+ am1.addRequests(new String[] {host0, host1 }, 4 * GB, 1, numContainers,
+ 10L);
+ am1.schedule();
+
+ // wait for containers to be allocated.
+ nm2.nodeHeartbeat(true);
+ allocResponse = am1.schedule(); // send the request
+ while (allocResponse.getAllocatedContainers().size() < 1) {
+ LOG.info("Waiting for containers to be created for app 1...");
+ Thread.sleep(100);
+ allocResponse = am1.schedule();
+ }
+
+ allocated = allocResponse.getAllocatedContainers();
+ Assert.assertEquals(1, allocated.size());
+ checkAllocatedContainer(allocated.get(0), 4 * GB, nm2.getNodeId(), 10L);
+ } finally {
+ if (rm != null) {
+ rm.stop();
+ }
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3f100d76/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestUtils.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestUtils.java
index c808b5a..66e833f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestUtils.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestUtils.java
@@ -51,7 +51,6 @@ import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsMana
import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.ContainerAllocationExpirer;
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
-
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerRequestKey;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerApp;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerNode;
@@ -412,4 +411,11 @@ public class TestUtils {
return SchedulerRequestKey.create(ResourceRequest.newInstance(
Priority.newInstance(pri), null, null, 0));
}
+
+ public static SchedulerRequestKey toSchedulerKey(Priority pri,
+ long allocationRequestId) {
+ ResourceRequest req = ResourceRequest.newInstance(pri, null, null, 0);
+ req.setAllocationRequestId(allocationRequestId);
+ return SchedulerRequestKey.create(req);
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[39/50] [abbrv] hadoop git commit: YARN-4849. [YARN-3368] cleanup
code base, integrate web UI related build to mvn, and fix licenses. (wangda)
Posted by wa...@apache.org.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml
new file mode 100644
index 0000000..66bf54a
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml
@@ -0,0 +1,207 @@
+<!--
+ 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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>hadoop-yarn</artifactId>
+ <groupId>org.apache.hadoop</groupId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-yarn-ui</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <name>Apache Hadoop YARN UI</name>
+ <packaging>${packaging.type}</packaging>
+
+ <properties>
+ <packaging.type>jar</packaging.type>
+ <webappDir>src/main/webapp</webappDir>
+ <node.executable>node</node.executable>
+ <nodeVersion>v0.12.2</nodeVersion>
+ <npmVersion>2.10.0</npmVersion>
+ <skipTests>false</skipTests>
+ </properties>
+
+ <build>
+ <plugins>
+ <!-- Apache RAT -->
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>src/main/webapp/node_modules/**/*</exclude>
+ <exclude>src/main/webapp/bower_components/**/*</exclude>
+ <exclude>src/main/webapp/jsconfig.json</exclude>
+ <exclude>src/main/webapp/bower.json</exclude>
+ <exclude>src/main/webapp/package.json</exclude>
+ <exclude>src/main/webapp/testem.json</exclude>
+ <exclude>src/main/webapp/public/assets/images/**/*</exclude>
+ <exclude>src/main/webapp/public/robots.txt</exclude>
+ <exclude>public/crossdomain.xml</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>3.0.0</version>
+ <configuration>
+ <followSymLinks>false</followSymLinks>
+ <filesets>
+ <fileset>
+ <directory>${basedir}/src/main/webapp/bower_components</directory>
+ </fileset>
+ <fileset>
+ <directory>${basedir}/src/main/webapp/node_modules</directory>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>yarn-ui</id>
+
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+
+ <properties>
+ <packaging.type>war</packaging.type>
+ </properties>
+
+ <build>
+ <plugins>
+ <!-- Bower install & grunt build-->
+ <plugin>
+ <artifactId>exec-maven-plugin</artifactId>
+ <groupId>org.codehaus.mojo</groupId>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <id>npm install</id>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <workingDirectory>${webappDir}</workingDirectory>
+ <executable>npm</executable>
+ <arguments>
+ <argument>install</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ <execution>
+ <phase>generate-sources</phase>
+ <id>bower install</id>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <workingDirectory>${webappDir}</workingDirectory>
+ <executable>bower</executable>
+ <arguments>
+ <argument>--allow-root</argument>
+ <argument>install</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ <execution>
+ <phase>generate-sources</phase>
+ <id>bower --allow-root install</id>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <workingDirectory>${webappDir}</workingDirectory>
+ <executable>bower</executable>
+ <arguments>
+ <argument>--allow-root</argument>
+ <argument>install</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ <execution>
+ <id>ember build</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <workingDirectory>${webappDir}</workingDirectory>
+ <executable>ember</executable>
+ <arguments>
+ <argument>build</argument>
+ <argument>-prod</argument>
+ <argument>--output-path</argument>
+ <argument>${basedir}/target/dist</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ <execution>
+ <id>ember test</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <skip>${skipTests}</skip>
+ <workingDirectory>${webappDir}</workingDirectory>
+ <executable>ember</executable>
+ <arguments>
+ <argument>test</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ <execution>
+ <id>cleanup tmp</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <workingDirectory>${webappDir}</workingDirectory>
+ <executable>rm</executable>
+ <arguments>
+ <argument>-rf</argument>
+ <argument>tmp</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Package into war -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webXml>${basedir}/src/main/webapp/WEB-INF/web.xml</webXml>
+ <warSourceDirectory>${basedir}/target/dist</warSourceDirectory>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/robots.txt
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/robots.txt b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/robots.txt
deleted file mode 100644
index f591645..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/robots.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-# http://www.robotstxt.org
-User-agent: *
-Disallow:
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/WEB-INF/web.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..ddb8532
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/WEB-INF/web.xml
@@ -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.
+-->
+
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd" >
+
+<web-app>
+ <display-name>YARN UI</display-name>
+</web-app>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-info.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-info.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-info.js
new file mode 100644
index 0000000..7dcbe61
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-info.js
@@ -0,0 +1,38 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Config from 'yarn-ui/config';
+
+export default DS.JSONAPIAdapter.extend({
+ headers: {
+ Accept: 'application/json'
+ },
+ host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
+ namespace: 'ws/v1/cluster', // common const
+ pathForType(modelName) {
+ return ''; // move to some common place, return path by modelname.
+ },
+ ajax(url, method, hash) {
+ hash = hash || {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "RM";
+ return this._super(url, method, hash);
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-metric.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-metric.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-metric.js
new file mode 100644
index 0000000..ad5ae0e
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-metric.js
@@ -0,0 +1,38 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Config from 'yarn-ui/config';
+
+export default DS.JSONAPIAdapter.extend({
+ headers: {
+ Accept: 'application/json'
+ },
+ host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
+ namespace: 'ws/v1/cluster/metrics', // common const
+ pathForType(modelName) {
+ return ''; // move to some common place, return path by modelname.
+ },
+ ajax(url, method, hash) {
+ hash = hash || {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "RM";
+ return this._super(url, method, hash);
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app-attempt.js
new file mode 100644
index 0000000..7b233bc
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app-attempt.js
@@ -0,0 +1,50 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Converter from 'yarn-ui/utils/converter';
+import Config from 'yarn-ui/config';
+
+export default DS.JSONAPIAdapter.extend({
+ headers: {
+ Accept: 'application/json'
+ },
+ host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
+ namespace: 'ws/v1/cluster', // common const
+
+ urlForQuery(query, modelName) {
+ var url = this._buildURL();
+ return url + '/apps/' + query.appId + "/appattempts";
+ },
+
+ urlForFindRecord(id, modelName, snapshot) {
+ var url = this._buildURL();
+ var url = url + '/apps/' +
+ Converter.attemptIdToAppId(id) + "/appattempts/" + id;
+ console.log(url);
+ return url;
+ },
+
+ ajax(url, method, hash) {
+ hash = {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "RM";
+ return this._super(url, method, hash);
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app.js
new file mode 100644
index 0000000..5cd888c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app.js
@@ -0,0 +1,44 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Config from 'yarn-ui/config';
+
+export default DS.JSONAPIAdapter.extend({
+ headers: {
+ Accept: 'application/json'
+ },
+ host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
+ namespace: 'ws/v1/cluster', // common const
+ pathForType(modelName) {
+ return 'apps'; // move to some common place, return path by modelname.
+ },
+ /*
+ urlForQuery(query, modelName) {
+ var url = this._buildURL();
+ return url + '/apps/' + query.appId + "/appattempts";
+ },
+ */
+ ajax(url, method, hash) {
+ hash = hash || {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "RM";
+ return this._super(url, method, hash);
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container-log.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container-log.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container-log.js
new file mode 100644
index 0000000..7838c98
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container-log.js
@@ -0,0 +1,74 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Ember from 'ember';
+import Converter from 'yarn-ui/utils/converter';
+
+/**
+ * REST URL's response when fetching container logs will be
+ * in plain text format and not JSON.
+ */
+export default DS.RESTAdapter.extend({
+ headers: {
+ Accept: 'text/plain'
+ },
+ host: 'http://localhost:1337/',
+ namespace: 'ws/v1/node',
+
+ urlForFindRecord(id, modelName, snapshot) {
+ var splits = Converter.splitForContainerLogs(id);
+ var nodeHttpAddr = splits[0];
+ var containerId = splits[1];
+ var filename = splits[2];
+ this.host = this.host + nodeHttpAddr;
+ var url = this._buildURL();
+ url = url + "/containerlogs/" + containerId + "/" + filename;
+ return url;
+ },
+
+ ajax(url, method, hash) {
+ hash = hash || {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "NM";
+ return this._super(url, method, hash);
+ },
+
+ /**
+ * Override options so that result is not expected to be JSON
+ */
+ ajaxOptions: function (url, type, options) {
+ var hash = options || {};
+ hash.url = url;
+ hash.type = type;
+ // Make sure jQuery does not try to convert response to JSON.
+ hash.dataType = 'text';
+ hash.context = this;
+
+ var headers = Ember.get(this, 'headers');
+ if (headers != undefined) {
+ hash.beforeSend = function (xhr) {
+ Object.keys(headers).forEach(function (key) {
+ return xhr.setRequestHeader(key, headers[key]);
+ });
+ };
+ }
+ return hash;
+ },
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container.js
new file mode 100644
index 0000000..67a37f7
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container.js
@@ -0,0 +1,61 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Converter from 'yarn-ui/utils/converter';
+import Config from 'yarn-ui/config';
+
+export default DS.JSONAPIAdapter.extend({
+ headers: {
+ Accept: 'application/json'
+ },
+ rmHost: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT,
+ tsHost: 'http://localhost:1337/' + Config.TS_HOST + ':' + Config.TS_PORT,
+ host: function() {
+ return undefined
+ }.property(),
+ rmNamespace: 'ws/v1/cluster',
+ tsNamespace: 'ws/v1/applicationhistory',
+ namespace: function() {
+ return undefined
+ }.property(),
+
+ urlForQuery(query, modelName) {
+ if (query.is_rm) {
+ this.set("host", this.rmHost);
+ this.set("namespace", this.rmNamespace);
+ } else {
+ this.set("host", this.tsHost);
+ this.set("namespace", this.tsNamespace);
+ }
+
+ var url = this._buildURL();
+ url = url + '/apps/' + Converter.attemptIdToAppId(query.app_attempt_id)
+ + "/appattempts/" + query.app_attempt_id + "/containers";
+ console.log(url);
+ return url;
+ },
+
+ ajax(url, method, hash) {
+ hash = {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "RM";
+ return this._super(url, method, hash);
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-app.js
new file mode 100644
index 0000000..0c60d1f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-app.js
@@ -0,0 +1,63 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.JSONAPIAdapter.extend({
+ headers: {
+ Accept: 'application/json'
+ },
+ host: 'http://localhost:1337/',
+ namespace: 'ws/v1/node',
+
+ urlForQuery(query) {
+ this.host = this.host + query.nodeAddr;
+ var url = this._buildURL();
+ url = url + "/apps";
+ return url;
+ },
+
+ urlForQueryRecord: function (query) {
+ this.host = this.host + query.nodeAddr;
+ var url = this._buildURL();
+ url = url + "/apps/" + query.appId;
+ return url;
+ },
+
+ query: function (store, type, query) {
+ var url = this.urlForQuery(query);
+ // Query params not required.
+ query = null;
+ return this.ajax(url, 'GET', { data: query });
+ },
+
+ queryRecord: function (store, type, query) {
+ var url = this.urlForQueryRecord(query);
+ // Query params not required.
+ query = null;
+ return this.ajax(url, 'GET', { data: query });
+ },
+
+ ajax(url, method, hash) {
+ hash = hash || {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "NM";
+ return this._super(url, method, hash);
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-container.js
new file mode 100644
index 0000000..e8bf7b7
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-container.js
@@ -0,0 +1,64 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.JSONAPIAdapter.extend({
+ headers: {
+ Accept: 'application/json'
+ },
+ host: 'http://localhost:1337/',
+ namespace: 'ws/v1/node',
+
+ urlForQuery(query) {
+ this.host = this.host + query.nodeHttpAddr;
+ var url = this._buildURL();
+ url = url + "/containers";
+ return url;
+ },
+
+ urlForQueryRecord(query) {
+ this.host = this.host + query.nodeHttpAddr;
+ var url = this._buildURL();
+ url = url + "/containers/" + query.containerId;
+ return url;
+ },
+
+ query: function (store, type, query) {
+ var url = this.urlForQuery(query);
+ // Query params not required.
+ query = null;
+ return this.ajax(url, 'GET', { data: query });
+ },
+
+ queryRecord: function (store, type, query) {
+ var url = this.urlForQueryRecord(query);
+ // Query params not required.
+ query = null;
+ console.log(url);
+ return this.ajax(url, 'GET', { data: query });
+ },
+
+ ajax(url, method, hash) {
+ hash = hash || {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "NM";
+ return this._super(url, method, hash);
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node.js
new file mode 100644
index 0000000..64f524a
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node.js
@@ -0,0 +1,40 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.JSONAPIAdapter.extend({
+ headers: {
+ Accept: 'application/json'
+ },
+ host: 'http://localhost:1337/',
+ namespace: 'ws/v1/node',
+
+ urlForFindRecord(id, modelName, snapshot) {
+ this.host = this.host + id;
+ var url = this._buildURL();
+ return url;
+ },
+ ajax(url, method, hash) {
+ hash = hash || {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "NM";
+ return this._super(url, method, hash);
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-queue.js
new file mode 100644
index 0000000..ebe7b39
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-queue.js
@@ -0,0 +1,38 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Config from 'yarn-ui/config';
+
+export default DS.JSONAPIAdapter.extend({
+ headers: {
+ Accept: 'application/json'
+ },
+ host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
+ namespace: 'ws/v1/cluster', // common const
+ pathForType(modelName) {
+ return 'scheduler'; // move to some common place, return path by modelname.
+ },
+ ajax(url, method, hash) {
+ hash = hash || {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "RM";
+ return this._super(url, method, hash);
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-rm-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-rm-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-rm-node.js
new file mode 100644
index 0000000..c6ad6f3
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-rm-node.js
@@ -0,0 +1,45 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Config from 'yarn-ui/config';
+
+export default DS.JSONAPIAdapter.extend({
+ headers: {
+ Accept: 'application/json'
+ },
+ host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT,
+ namespace: 'ws/v1/cluster',
+ pathForType(modelName) {
+ return 'nodes';
+ },
+
+ urlForFindRecord(id, modelName, snapshot) {
+ var url = this._buildURL();
+ url = url + "/nodes/" + id;
+ return url;
+ },
+
+ ajax(url, method, hash) {
+ hash = hash || {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "RM";
+ return this._super(url, method, hash);
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/app.js
new file mode 100644
index 0000000..5617953
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/app.js
@@ -0,0 +1,38 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import Resolver from 'ember/resolver';
+import loadInitializers from 'ember/load-initializers';
+import config from './config/environment';
+import Sorter from 'yarn-ui/utils/sorter';
+
+var App;
+
+Ember.MODEL_FACTORY_INJECTIONS = true;
+
+App = Ember.Application.extend({
+ modulePrefix: config.modulePrefix,
+ podModulePrefix: config.podModulePrefix,
+ Resolver: Resolver
+});
+
+loadInitializers(App, config.modulePrefix);
+Sorter.initDataTableSorter();
+
+export default App;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/app-attempt-table.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/app-attempt-table.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/app-attempt-table.js
new file mode 100644
index 0000000..4b741b8
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/app-attempt-table.js
@@ -0,0 +1,22 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/app-table.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/app-table.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/app-table.js
new file mode 100644
index 0000000..4b741b8
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/app-table.js
@@ -0,0 +1,22 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/bar-chart.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/bar-chart.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/bar-chart.js
new file mode 100644
index 0000000..8e48279
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/bar-chart.js
@@ -0,0 +1,122 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import BaseChartComponent from 'yarn-ui/components/base-chart-component';
+
+export default BaseChartComponent.extend({
+ // data:
+ // [{label=label1, value=value1}, ...]
+ // ...
+ renderBarChart: function(data, title, textWidth = 50) {
+ var g = this.chart.g;
+ var layout = this.getLayout();
+ this.renderTitleAndBG(g, title, layout);
+
+ var maxValue = -1;
+ for (var i = 0; i < data.length; i++) {
+ if (data[i] instanceof Array) {
+ if (data[i][0].value > maxValue) {
+ maxValue = data[i][0].value;
+ }
+ } else {
+ if (data[i].value > maxValue) {
+ maxValue = data[i].value;
+ }
+ }
+ }
+
+ var singleBarHeight = 30;
+
+ // 50 is for text
+ var maxBarWidth = layout.x2 - layout.x1 - 2 * layout.margin - textWidth - 50;
+
+ // 30 is for title
+ var maxBarsHeight = layout.y2 - layout.y1 - 2 * layout.margin - 30;
+ var gap = (maxBarsHeight - data.length * singleBarHeight) / (data.length -
+ 1);
+
+ var xScaler = d3.scale.linear()
+ .domain([0, maxValue])
+ .range([0, maxBarWidth]);
+
+ // show bar text
+ for (var i = 0; i < data.length; i++) {
+ g.append("text")
+ .text(
+ function() {
+ return data[i].label;
+ })
+ .attr("y", function() {
+ return layout.y1 + singleBarHeight / 2 + layout.margin + (gap +
+ singleBarHeight) * i + 30;
+ })
+ .attr("x", layout.x1 + layout.margin);
+ }
+
+ // show bar
+ var bar = g.selectAll("bars")
+ .data(data)
+ .enter()
+ .append("rect")
+ .attr("y", function(d, i) {
+ return layout.y1 + 30 + layout.margin + (gap + singleBarHeight) * i;
+ })
+ .attr("x", layout.x1 + layout.margin + textWidth)
+ .attr("height", singleBarHeight)
+ .attr("fill", function(d, i) {
+ return this.colors[i];
+ }.bind(this))
+ .attr("width", 0);
+
+ this.bindTooltip(bar);
+
+ bar.transition()
+ .duration(500)
+ .attr("width", function(d) {
+ var w;
+ w = xScaler(d.value);
+ // At least each item has 3 px
+ w = Math.max(w, 3);
+ return w;
+ });
+
+ // show bar value
+ for (var i = 0; i < data.length; i++) {
+ g.append("text")
+ .text(
+ function() {
+ return data[i].value;
+ })
+ .attr("y", function() {
+ return layout.y1 + singleBarHeight / 2 + layout.margin + (gap +
+ singleBarHeight) * i + 30;
+ })
+ .attr("x", layout.x1 + layout.margin + textWidth + 15 + xScaler(data[i].value));
+ }
+ },
+
+ draw: function() {
+ this.initChart();
+ this.renderBarChart(this.get("data"), this.get("title"), this.get("textWidth"));
+ },
+
+ didInsertElement: function() {
+ this.draw();
+ },
+})
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/base-chart-component.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/base-chart-component.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/base-chart-component.js
new file mode 100644
index 0000000..b85b6ab
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/base-chart-component.js
@@ -0,0 +1,127 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+ chart: undefined,
+ tooltip : undefined,
+ colors: d3.scale.category10().range(),
+
+ initChart: function() {
+ this.chart = {
+ svg: undefined,
+ g: undefined,
+ h: 0,
+ w: 0,
+ tooltip: undefined
+ };
+
+ // Init tooltip if it is not initialized
+ this.tooltip = d3.select("#chart-tooltip");
+ if (!this.tooltip) {
+ this.tooltip = d3.select("body")
+ .append("div")
+ .attr("class", "tooltip")
+ .attr("id", "chart-tooltip")
+ .style("opacity", 0);
+ }
+
+ // Init svg
+ var svg = this.chart.svg;
+ if (svg) {
+ svg.remove();
+ }
+
+ var parentId = this.get("parentId");
+ var parent = d3.select("#" + parentId);
+ var bbox = parent.node().getBoundingClientRect();
+ this.chart.w = bbox.width - 30;
+
+ var ratio = 0.75; // 4:3 by default
+ if (this.get("ratio")) {
+ ratio = this.get("ratio");
+ }
+ this.chart.h = bbox.width * ratio;
+
+ if (this.get("maxHeight")) {
+ this.chart.h = Math.min(this.get("maxHeight"), this.chart.h);
+ }
+
+ this.chart.svg = parent.append("svg")
+ .attr("width", this.chart.w)
+ .attr("height", this.chart.h);
+
+ this.chart.g = this.chart.svg.append("g");
+ },
+
+ renderTitleAndBG: function(g, title, layout) {
+ var bg = g.append("g");
+ bg.append("text")
+ .text(title)
+ .attr("x", (layout.x1 + layout.x2) / 2)
+ .attr("y", layout.y1 + layout.margin + 20)
+ .attr("class", "chart-title");
+
+ bg.append("rect")
+ .attr("x", layout.x1)
+ .attr("y", layout.y1)
+ .attr("width", layout.x2 - layout.x1)
+ .attr("height", layout.y2 - layout.y1)
+ .attr("class", "chart-frame");
+ },
+
+ bindTooltip: function(d) {
+ d.on("mouseover", function(d) {
+ this.tooltip
+ .style("left", (d3.event.pageX) + "px")
+ .style("top", (d3.event.pageY - 28) + "px");
+ }.bind(this))
+ .on("mousemove", function(d) {
+ // Handle pie chart case
+ var data = d;
+ if (d.data) {
+ data = d.data;
+ }
+
+ this.tooltip.style("opacity", .9);
+ this.tooltip.html(data.label + " = " + data.value)
+ .style("left", (d3.event.pageX) + "px")
+ .style("top", (d3.event.pageY - 28) + "px");
+ }.bind(this))
+ .on("mouseout", function(d) {
+ this.tooltip.style("opacity", 0);
+ }.bind(this));
+ },
+
+ getLayout: function() {
+ var x1 = 0;
+ var y1 = 0;
+ var x2 = this.chart.w;
+ var y2 = this.chart.h;
+
+ var layout = {
+ x1: x1,
+ y1: y1,
+ x2: x2 - 10,
+ y2: y2 - 10,
+ margin: 10
+ };
+ return layout;
+ },
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/container-table.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/container-table.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/container-table.js
new file mode 100644
index 0000000..4b741b8
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/container-table.js
@@ -0,0 +1,22 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/donut-chart.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/donut-chart.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/donut-chart.js
new file mode 100644
index 0000000..e6dcb12
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/donut-chart.js
@@ -0,0 +1,166 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import BaseChartComponent from 'yarn-ui/components/base-chart-component';
+
+export default BaseChartComponent.extend({
+ /*
+ * data = [{label="xx", value=},{...}]
+ */
+ renderDonutChart: function(data, title, showLabels = false,
+ middleLabel = "Total", middleValue = undefined) {
+ var g = this.chart.g;
+ var layout = this.getLayout();
+ this.renderTitleAndBG(g, title, layout);
+
+ var total = 0;
+ var allZero = true;
+ for (var i = 0; i < data.length; i++) {
+ total += data[i].value;
+ if (data[i].value > 1e-6) {
+ allZero = false;
+ }
+ }
+
+ if (!middleValue) {
+ middleValue = total;
+ }
+
+ //Width and height
+ var h = layout.y2 - layout.y1;
+
+ // 50 is for title
+ var outerRadius = (h - 50 - 2 * layout.margin) / 2;
+ var innerRadius = outerRadius * 0.618;
+ var arc = d3.svg.arc()
+ .innerRadius(innerRadius)
+ .outerRadius(outerRadius);
+
+ var cx;
+ var cy = layout.y1 + 50 + layout.margin + outerRadius;
+ if (showLabels) {
+ cx = layout.x1 + layout.margin + outerRadius;
+ } else {
+ cx = (layout.x1 + layout.x2) / 2;
+ }
+
+ var pie = d3.layout.pie();
+ pie.sort(null);
+ pie.value(function(d) {
+ var v = d.value;
+ // make sure it > 0
+ v = Math.max(v, 1e-6);
+ return v;
+ });
+
+ //Set up groups
+ var arcs = g
+ .selectAll("g.arc")
+ .data(pie(data))
+ .enter()
+ .append("g")
+ .attr("class", "arc")
+ .attr("transform", "translate(" + cx + "," + cy + ")");
+
+ function tweenPie(finish) {
+ var start = {
+ startAngle: 0,
+ endAngle: 0
+ };
+ var i = d3.interpolate(start, finish);
+ return function(d) {
+ return arc(i(d));
+ };
+ }
+
+ //Draw arc paths
+ var path = arcs.append("path")
+ .attr("fill", function(d, i) {
+ if (d.value > 1e-6) {
+ return this.colors[i];
+ } else {
+ return "white";
+ }
+ }.bind(this))
+ .attr("d", arc)
+ .attr("stroke", function(d, i) {
+ if (allZero) {
+ return this.colors[i];
+ }
+ }.bind(this))
+ .attr("stroke-dasharray", function(d, i) {
+ if (d.value <= 1e-6) {
+ return "10,10";
+ }
+ }.bind(this));
+ this.bindTooltip(path);
+
+ // Show labels
+ if (showLabels) {
+ var lx = layout.x1 + layout.margin + outerRadius * 2 + 30;
+ var squareW = 15;
+ var margin = 10;
+
+ var select = g.selectAll(".rect")
+ .data(data)
+ .enter();
+ select.append("rect")
+ .attr("fill", function(d, i) {
+ return this.colors[i];
+ }.bind(this))
+ .attr("x", lx)
+ .attr("y", function(d, i) {
+ return layout.y1 + 50 + (squareW + margin) * i + layout.margin;
+ })
+ .attr("width", squareW)
+ .attr("height", squareW);
+ select.append("text")
+ .attr("x", lx + squareW + margin)
+ .attr("y", function(d, i) {
+ return layout.y1 + 50 + (squareW + margin) * i + layout.margin + squareW / 2;
+ })
+ .text(function(d) {
+ return d.label + ' = ' + d.value;
+ });
+ }
+
+ if (middleLabel) {
+ var highLightColor = this.colors[0];
+ g.append("text").text(middleLabel).attr("x", cx).attr("y", cy - 10).
+ attr("class", "donut-highlight-text").attr("fill", highLightColor);
+ g.append("text").text(middleValue).attr("x", cx).attr("y", cy + 20).
+ attr("class", "donut-highlight-text").attr("fill", highLightColor).
+ style("font-size", "30px");
+ }
+
+ path.transition()
+ .duration(500)
+ .attrTween('d', tweenPie);
+ },
+
+ draw: function() {
+ this.initChart();
+ this.renderDonutChart(this.get("data"), this.get("title"), this.get("showLabels"),
+ this.get("middleLabel"), this.get("middleValue"));
+ },
+
+ didInsertElement: function() {
+ this.draw();
+ },
+})
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/item-selector.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/item-selector.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/item-selector.js
new file mode 100644
index 0000000..235e438
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/item-selector.js
@@ -0,0 +1,39 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+ didInsertElement: function() {
+ $(".js-example-basic-single").select2(
+ {
+ width: '100%',
+ placeholder: "Select a queue"
+ });
+ var elementId = this.get("element-id");
+ var prefix = this.get("prefix");
+
+ var element = d3.select("#" + elementId);
+
+ if (element) {
+ this.get("model").forEach(function(o) {
+ element.append("option").attr("value", o.get("name")).text(prefix + o.get("name"));
+ });
+ }
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-configuration-table.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-configuration-table.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-configuration-table.js
new file mode 100644
index 0000000..4b741b8
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-configuration-table.js
@@ -0,0 +1,22 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-navigator.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-navigator.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-navigator.js
new file mode 100644
index 0000000..4b741b8
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-navigator.js
@@ -0,0 +1,22 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-view.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-view.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-view.js
new file mode 100644
index 0000000..2a90771
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-view.js
@@ -0,0 +1,290 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import ChartUtilsMixin from 'yarn-ui/mixins/charts-utils';
+
+export default Ember.Component.extend(ChartUtilsMixin, {
+ queues: {
+ data: undefined,
+ foldedQueues: {},
+ selectedQueueCircle: undefined,
+ maxDepth: -1,
+ },
+
+ queueColors: d3.scale.category20().range(),
+
+ renderQueue: function (now, depth, sequence) {
+ if (depth > this.queues.maxDepth) {
+ this.queues.maxDepth = depth;
+ }
+
+ var cx = 20 + depth * 30;
+ var cy = 20 + sequence * 30;
+ var name = now.get("name");
+
+ var g = this.queues.dataGroup.append("g")
+ .attr("id", "queue-" + name + "-g");
+
+ var folded = this.queues.foldedQueues[name];
+ var isParentQueue = false;
+
+ // render its children
+ var children = [];
+ var childrenNames = now.get("children");
+ if (childrenNames) {
+ childrenNames.forEach(function (name) {
+ isParentQueue = true;
+ var child = this.queues.data[name];
+ if (child) {
+ children.push(child);
+ }
+ }.bind(this));
+ }
+ if (folded) {
+ children = [];
+ }
+ var linefunction = d3.svg.line()
+ .interpolate("basis")
+ .x(function (d) {
+ return d.x;
+ })
+ .y(function (d) {
+ return d.y;
+ });
+
+ for (var i = 0; i < children.length; i++) {
+ sequence = sequence + 1;
+ // Get center of children queue
+ var cc = this.renderQueue(children[i],
+ depth + 1, sequence);
+ g.append("path")
+ .attr("class", "queue")
+ .attr("d", linefunction([{
+ x: cx,
+ y: cy
+ }, {
+ x: cc.x - 20,
+ y: cc.y
+ }, cc]));
+ }
+
+ var circle = g.append("circle")
+ .attr("cx", cx)
+ .attr("cy", cy)
+ .attr("class", "queue");
+
+ circle.on('mouseover', function () {
+ circle.style("fill", this.queueColors[1]);
+ }.bind(this));
+ circle.on('mouseout', function () {
+ if (circle != this.queues.selectedQueueCircle) {
+ circle.style("fill", this.queueColors[0]);
+ }
+ }.bind(this));
+ circle.on('click', function () {
+ circle.style("fill", this.queueColors[2]);
+ var pre = this.queues.selectedQueueCircle;
+ this.queues.selectedQueueCircle = circle;
+ if (pre) {
+ pre.on('mouseout')();
+ }
+ this.renderCharts(name);
+ }.bind(this));
+ circle.on('dblclick', function () {
+ if (!isParentQueue) {
+ return;
+ }
+
+ if (this.queues.foldedQueues[name]) {
+ delete this.queues.foldedQueues[name];
+ } else {
+ this.queues.foldedQueues[name] = now;
+ }
+ this.renderQueues();
+ }.bind(this));
+
+ var text = name;
+ if (folded) {
+ text = name + " (+)";
+ }
+
+ // print queue's name
+ g.append("text")
+ .attr("x", cx + 30)
+ .attr("y", cy + 5)
+ .text(text)
+ .attr("class", "queue");
+
+ return {
+ x: cx,
+ y: cy
+ };
+ },
+
+ renderQueues: function () {
+ if (this.queues.dataGroup) {
+ this.queues.dataGroup.remove();
+ }
+ // render queues
+ this.queues.dataGroup = this.canvas.svg.append("g")
+ .attr("id", "queues-g");
+ var rootQueue = undefined;
+
+ if (this.queues.data) {
+ this.renderQueue(this.queues.data['root'], 0, 0);
+
+ }
+ },
+
+ draw: function () {
+ this.queues.data = {};
+ this.get("model")
+ .forEach(function (o) {
+ this.queues.data[o.id] = o;
+ }.bind(this));
+
+ // get w/h of the svg
+ var bbox = d3.select("#main-container")
+ .node()
+ .getBoundingClientRect();
+ this.canvas.w = bbox.width;
+ this.canvas.h = Math.max(Object.keys(this.queues.data)
+ .length * 35, 1500);
+
+ this.canvas.svg = d3.select("#main-container")
+ .append("svg")
+ .attr("width", this.canvas.w)
+ .attr("height", this.canvas.h)
+ .attr("id", "main-svg");
+
+ this.renderBackground();
+
+ this.renderQueues();
+ this.renderCharts("root");
+ },
+
+ didInsertElement: function () {
+ this.draw();
+ },
+
+ /*
+ * data = [{label="xx", value=},{...}]
+ */
+ renderTable: function (data, title, layout) {
+ d3.select("#main-svg")
+ .append('table')
+ .selectAll('tr')
+ .data(data)
+ .enter()
+ .append('tr')
+ .selectAll('td')
+ .data(function (d) {
+ return d;
+ })
+ .enter()
+ .append('td')
+ .text(function (d) {
+ return d;
+ });
+ },
+
+ renderQueueCapacities: function (queue, layout) {
+ // Render bar chart
+ this.renderBarChart(this.charts.g, [{
+ label: "Cap",
+ value: queue.get("capacity")
+ }, {
+ label: "MaxCap",
+ value: queue.get("maxCapacity")
+ }, {
+ label: "UsedCap",
+ value: queue.get("usedCapacity")
+ }], "Queue Capacities", layout, 60);
+ },
+
+ renderChildrenCapacities: function (queue, layout) {
+ var data = [];
+ var children = queue.get("children");
+ if (children) {
+ for (var i = 0; i < children.length; i++) {
+ var child = this.queues.data[children[i]];
+ data.push({
+ label: child.get("name"),
+ value: child.get("capacity")
+ });
+ }
+ }
+
+ this.renderDonutChart(this.charts.g, data, "Children Capacities", layout, true);
+ },
+
+ renderChildrenUsedCapacities: function (queue, layout) {
+ var data = [];
+ var children = queue.get("children");
+ if (children) {
+ for (var i = 0; i < children.length; i++) {
+ var child = this.queues.data[children[i]];
+ data.push({
+ label: child.get("name"),
+ value: child.get("usedCapacity")
+ });
+ }
+ }
+
+ this.renderDonutChart(this.charts.g, data, "Children Used Capacities", layout, true);
+ },
+
+ renderLeafQueueUsedCapacities: function (layout) {
+ var leafQueueUsedCaps = [];
+ for (var queueName in this.queues.data) {
+ var q = this.queues.data[queueName];
+ if ((!q.get("children")) || q.get("children")
+ .length == 0) {
+ // it's a leafqueue
+ leafQueueUsedCaps.push({
+ label: q.get("name"),
+ value: q.get("usedCapacity")
+ });
+ }
+ }
+
+ this.renderDonutChart(this.charts.g, leafQueueUsedCaps, "LeafQueues Used Capacities",
+ layout, true);
+ },
+
+ renderCharts: function (queueName) {
+ this.charts.leftBannerLen = this.queues.maxDepth * 30 + 100;
+ this.initCharts();
+
+ var queue = this.queues.data[queueName];
+ var idx = 0;
+
+ if (queue.get("name") == "root") {
+ this.renderLeafQueueUsedCapacities(this.getLayout(idx++));
+ }
+ if (queue.get("name") != "root") {
+ this.renderQueueCapacities(queue, this.getLayout(idx++));
+ }
+ if (queue.get("children") && queue.get("children")
+ .length > 0) {
+ this.renderChildrenCapacities(queue, this.getLayout(idx++));
+ this.renderChildrenUsedCapacities(queue, this.getLayout(idx++));
+ }
+ },
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/simple-table.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/simple-table.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/simple-table.js
new file mode 100644
index 0000000..e5da81a
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/simple-table.js
@@ -0,0 +1,76 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+ didInsertElement: function() {
+ var paging = this.get("paging") ? true : this.get("paging");
+ var ordering = this.get("ordering") ? true : this.get("ordering");
+ var info = this.get("info") ? true : this.get("info");
+ var bFilter = this.get("bFilter") ? true : this.get("bFilter");
+
+ // Defines sorter for the columns if not default.
+ // Can also specify a custom sorter.
+ var i;
+ var colDefs = [];
+ if (this.get("colTypes")) {
+ var typesArr = this.get("colTypes").split(' ');
+ var targetsArr = this.get("colTargets").split(' ');
+ for (i = 0; i < typesArr.length; i++) {
+ console.log(typesArr[i] + " " + targetsArr[i]);
+ colDefs.push({
+ type: typesArr[i],
+ targets: parseInt(targetsArr[i])
+ });
+ }
+ }
+ // Defines initial column and sort order.
+ var orderArr = [];
+ if (this.get("colsOrder")) {
+ var cols = this.get("colsOrder").split(' ');
+ for (i = 0; i < cols.length; i++) {
+ var col = cols[i].split(',');
+ if (col.length != 2) {
+ continue;
+ }
+ var order = col[1].trim();
+ if (order != 'asc' && order != 'desc') {
+ continue;
+ }
+ var colOrder = [];
+ colOrder.push(parseInt(col[0]));
+ colOrder.push(order);
+ orderArr.push(colOrder);
+ }
+ }
+ if (orderArr.length == 0) {
+ var defaultOrder = [0, 'asc'];
+ orderArr.push(defaultOrder);
+ }
+ console.log(orderArr[0]);
+ Ember.$('#' + this.get('table-id')).DataTable({
+ "paging": paging,
+ "ordering": ordering,
+ "info": info,
+ "bFilter": bFilter,
+ "order": orderArr,
+ "columnDefs": colDefs
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js
new file mode 100644
index 0000000..b92f4bf
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js
@@ -0,0 +1,268 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import Converter from 'yarn-ui/utils/converter';
+
+export default Ember.Component.extend({
+ canvas: {
+ svg: undefined,
+ h: 0,
+ w: 0,
+ tooltip: undefined
+ },
+
+ clusterMetrics: undefined,
+ modelArr: [],
+ colors: d3.scale.category10().range(),
+ _selected: undefined,
+
+ selected: function() {
+ return this._selected;
+ }.property(),
+
+ tableComponentName: function() {
+ return "app-attempt-table";
+ }.property(),
+
+ setSelected: function(d) {
+ if (this._selected == d) {
+ return;
+ }
+
+ // restore color
+ if (this._selected) {
+ var dom = d3.select("#timeline-bar-" + this._selected.get("id"));
+ dom.attr("fill", this.colors[0]);
+ }
+
+ this._selected = d;
+ this.set("selected", d);
+ dom = d3.select("#timeline-bar-" + d.get("id"));
+ dom.attr("fill", this.colors[1]);
+ },
+
+ getPerItemHeight: function() {
+ var arrSize = this.modelArr.length;
+
+ if (arrSize < 20) {
+ return 30;
+ } else if (arrSize < 100) {
+ return 10;
+ } else {
+ return 2;
+ }
+ },
+
+ getPerItemGap: function() {
+ var arrSize = this.modelArr.length;
+
+ if (arrSize < 20) {
+ return 5;
+ } else if (arrSize < 100) {
+ return 1;
+ } else {
+ return 1;
+ }
+ },
+
+ getCanvasHeight: function() {
+ return (this.getPerItemHeight() + this.getPerItemGap()) * this.modelArr.length + 200;
+ },
+
+ draw: function(start, end) {
+ // get w/h of the svg
+ var bbox = d3.select("#" + this.get("parent-id"))
+ .node()
+ .getBoundingClientRect();
+ this.canvas.w = bbox.width;
+ this.canvas.h = this.getCanvasHeight();
+
+ this.canvas.svg = d3.select("#" + this.get("parent-id"))
+ .append("svg")
+ .attr("width", this.canvas.w)
+ .attr("height", this.canvas.h)
+ .attr("id", this.get("my-id"));
+ this.renderTimeline(start, end);
+ },
+
+ renderTimeline: function(start, end) {
+ var border = 30;
+ var singleBarHeight = this.getPerItemHeight();
+ var gap = this.getPerItemGap();
+ var textWidth = 50;
+ /*
+ start-time end-time
+ |--------------------------------------|
+ ==============
+ ==============
+ ==============
+ ===============
+ */
+ var xScaler = d3.scale.linear()
+ .domain([start, end])
+ .range([0, this.canvas.w - 2 * border - textWidth]);
+
+ /*
+ * Render frame of timeline view
+ */
+ this.canvas.svg.append("line")
+ .attr("x1", border + textWidth)
+ .attr("y1", border - 5)
+ .attr("x2", this.canvas.w - border)
+ .attr("y2", border - 5)
+ .attr("class", "chart");
+
+ this.canvas.svg.append("line")
+ .attr("x1", border + textWidth)
+ .attr("y1", border - 10)
+ .attr("x2", border + textWidth)
+ .attr("y2", border - 5)
+ .attr("class", "chart");
+
+ this.canvas.svg.append("line")
+ .attr("x1", this.canvas.w - border)
+ .attr("y1", border - 10)
+ .attr("x2", this.canvas.w - border)
+ .attr("y2", border - 5)
+ .attr("class", "chart");
+
+ this.canvas.svg.append("text")
+ .text(Converter.timeStampToDate(start))
+ .attr("y", border - 15)
+ .attr("x", border + textWidth)
+ .attr("class", "bar-chart-text")
+ .attr("text-anchor", "left");
+
+ this.canvas.svg.append("text")
+ .text(Converter.timeStampToDate(end))
+ .attr("y", border - 15)
+ .attr("x", this.canvas.w - border)
+ .attr("class", "bar-chart-text")
+ .attr("text-anchor", "end");
+
+ // show bar
+ var bar = this.canvas.svg.selectAll("bars")
+ .data(this.modelArr)
+ .enter()
+ .append("rect")
+ .attr("y", function(d, i) {
+ return border + (gap + singleBarHeight) * i;
+ })
+ .attr("x", function(d, i) {
+ return border + textWidth + xScaler(d.get("startTs"));
+ })
+ .attr("height", singleBarHeight)
+ .attr("fill", function(d, i) {
+ return this.colors[0];
+ }.bind(this))
+ .attr("width", function(d, i) {
+ var finishedTs = xScaler(d.get("finishedTs"));
+ finishedTs = finishedTs > 0 ? finishedTs : xScaler(end);
+ return finishedTs - xScaler(d.get("startTs"));
+ })
+ .attr("id", function(d, i) {
+ return "timeline-bar-" + d.get("id");
+ });
+ bar.on("click", function(d) {
+ this.setSelected(d);
+ }.bind(this));
+
+ this.bindTooltip(bar);
+
+ if (this.modelArr.length <= 20) {
+ // show bar texts
+ for (var i = 0; i < this.modelArr.length; i++) {
+ this.canvas.svg.append("text")
+ .text(this.modelArr[i].get(this.get("label")))
+ .attr("y", border + (gap + singleBarHeight) * i + singleBarHeight / 2)
+ .attr("x", border)
+ .attr("class", "bar-chart-text");
+ }
+ }
+ },
+
+ bindTooltip: function(d) {
+ d.on("mouseover", function(d) {
+ this.tooltip
+ .style("left", (d3.event.pageX) + "px")
+ .style("top", (d3.event.pageY - 28) + "px");
+ }.bind(this))
+ .on("mousemove", function(d) {
+ this.tooltip.style("opacity", .9);
+ this.tooltip.html(d.get("tooltipLabel"))
+ .style("left", (d3.event.pageX) + "px")
+ .style("top", (d3.event.pageY - 28) + "px");
+ }.bind(this))
+ .on("mouseout", function(d) {
+ this.tooltip.style("opacity", 0);
+ }.bind(this));
+ },
+
+ initTooltip: function() {
+ this.tooltip = d3.select("body")
+ .append("div")
+ .attr("class", "tooltip")
+ .attr("id", "chart-tooltip")
+ .style("opacity", 0);
+ },
+
+ didInsertElement: function() {
+ // init tooltip
+ this.initTooltip();
+
+ // init model
+ if (this.get("rmModel")) {
+ this.get("rmModel").forEach(function(o) {
+ this.modelArr.push(o);
+ }.bind(this));
+ }
+
+ if (this.get("tsModel")) {
+ this.get("tsModel").forEach(function(o) {
+ this.modelArr.push(o);
+ }.bind(this));
+ }
+
+ this.modelArr.sort(function(a, b) {
+ var tsA = a.get("startTs");
+ var tsB = b.get("startTs");
+
+ return tsA - tsB;
+ });
+ if (this.modelArr.length > 0) {
+ var begin = this.modelArr[0].get("startTs");
+ }
+ var end = 0;
+ for (var i = 0; i < this.modelArr.length; i++) {
+ var ts = this.modelArr[i].get("finishedTs");
+ if (ts > end) {
+ end = ts;
+ }
+ }
+ if (end < begin) {
+ end = Date.now();
+ }
+
+ this.draw(begin, end);
+
+ if (this.modelArr.length > 0) {
+ this.setSelected(this.modelArr[0]);
+ }
+ },
+});
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[15/50] [abbrv] hadoop git commit: HADOOP-13380.
TestBasicDiskValidator should not write data to /tmp (Yufei Gu via lei)
Posted by wa...@apache.org.
HADOOP-13380. TestBasicDiskValidator should not write data to /tmp (Yufei Gu via lei)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/6418edd6
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/6418edd6
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/6418edd6
Branch: refs/heads/YARN-3368
Commit: 6418edd6feeafc0204536e1860942eeb1cb1a9ce
Parents: 83a2ffe
Author: Lei Xu <le...@apache.org>
Authored: Mon Aug 8 15:04:11 2016 -0700
Committer: Lei Xu <le...@apache.org>
Committed: Mon Aug 8 15:06:03 2016 -0700
----------------------------------------------------------------------
.../hadoop/util/TestBasicDiskValidator.java | 8 +----
.../org/apache/hadoop/util/TestDiskChecker.java | 35 +++++++++++++-------
2 files changed, 24 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/6418edd6/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestBasicDiskValidator.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestBasicDiskValidator.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestBasicDiskValidator.java
index c961ee8..d6964a4 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestBasicDiskValidator.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestBasicDiskValidator.java
@@ -30,14 +30,8 @@ public class TestBasicDiskValidator extends TestDiskChecker {
@Override
protected void checkDirs(boolean isDir, String perm, boolean success)
throws Throwable {
- File localDir = File.createTempFile("test", "tmp");
+ File localDir = isDir ? createTempDir() : createTempFile();
try {
- if (isDir) {
- // reuse the file path generated by File#createTempFile to create a dir
- localDir.delete();
- localDir.mkdir();
- }
-
Shell.execCommand(Shell.getSetPermissionCommand(perm, false,
localDir.getAbsolutePath()));
http://git-wip-us.apache.org/repos/asf/hadoop/blob/6418edd6/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestDiskChecker.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestDiskChecker.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestDiskChecker.java
index b484940..0d55d7e 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestDiskChecker.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestDiskChecker.java
@@ -18,6 +18,7 @@
package org.apache.hadoop.util;
import java.io.*;
+import java.nio.file.Files;
import org.junit.Test;
import static org.junit.Assert.*;
@@ -25,7 +26,6 @@ import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import static org.apache.hadoop.test.MockitoMaker.*;
-import static org.apache.hadoop.fs.permission.FsAction.*;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
@@ -34,7 +34,6 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.test.GenericTestUtils;
import org.apache.hadoop.util.DiskChecker.DiskErrorException;
-import org.apache.hadoop.util.Shell;
public class TestDiskChecker {
final FsPermission defaultPerm = new FsPermission("755");
@@ -112,13 +111,29 @@ public class TestDiskChecker {
_checkDirs(true, new FsPermission("666"), false); // not listable
}
+ /**
+ * Create an empty file with a random name under test directory.
+ * @return the created file
+ * @throws java.io.IOException if any
+ */
+ protected File createTempFile() throws java.io.IOException {
+ File testDir = new File(System.getProperty("test.build.data"));
+ return Files.createTempFile(testDir.toPath(), "test", "tmp").toFile();
+ }
+
+ /**
+ * Create an empty directory with a random name under test directory.
+ * @return the created directory
+ * @throws java.io.IOException if any
+ */
+ protected File createTempDir() throws java.io.IOException {
+ File testDir = new File(System.getProperty("test.build.data"));
+ return Files.createTempDirectory(testDir.toPath(), "test").toFile();
+ }
+
private void _checkDirs(boolean isDir, FsPermission perm, boolean success)
throws Throwable {
- File localDir = File.createTempFile("test", "tmp");
- if (isDir) {
- localDir.delete();
- localDir.mkdir();
- }
+ File localDir = isDir ? createTempDir() : createTempFile();
Shell.execCommand(Shell.getSetPermissionCommand(String.format("%04o",
perm.toShort()), false, localDir.getAbsolutePath()));
try {
@@ -163,11 +178,7 @@ public class TestDiskChecker {
protected void checkDirs(boolean isDir, String perm, boolean success)
throws Throwable {
- File localDir = File.createTempFile("test", "tmp");
- if (isDir) {
- localDir.delete();
- localDir.mkdir();
- }
+ File localDir = isDir ? createTempDir() : createTempFile();
Shell.execCommand(Shell.getSetPermissionCommand(perm, false,
localDir.getAbsolutePath()));
try {
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[42/50] [abbrv] hadoop git commit: YARN-4849. [YARN-3368] cleanup
code base, integrate web UI related build to mvn, and fix licenses. (wangda)
Posted by wa...@apache.org.
YARN-4849. [YARN-3368] cleanup code base, integrate web UI related build to mvn, and fix licenses. (wangda)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/d13f52f0
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/d13f52f0
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/d13f52f0
Branch: refs/heads/YARN-3368
Commit: d13f52f0b47a77a62bc5d976f113f8992529764e
Parents: d5bd55b
Author: Wangda Tan <wa...@apache.org>
Authored: Mon Mar 21 14:03:13 2016 -0700
Committer: Wangda Tan <wa...@apache.org>
Committed: Tue Aug 9 14:48:09 2016 -0700
----------------------------------------------------------------------
.gitignore | 13 +
BUILDING.txt | 4 +-
LICENSE.txt | 80 +++++
dev-support/create-release.sh | 144 +++++++++
dev-support/docker/Dockerfile | 5 +
.../src/site/markdown/YarnUI2.md | 43 +++
.../hadoop-yarn/hadoop-yarn-ui/.bowerrc | 4 -
.../hadoop-yarn/hadoop-yarn-ui/.editorconfig | 34 ---
.../hadoop-yarn/hadoop-yarn-ui/.ember-cli | 11 -
.../hadoop-yarn/hadoop-yarn-ui/.gitignore | 17 --
.../hadoop-yarn/hadoop-yarn-ui/.jshintrc | 32 --
.../hadoop-yarn/hadoop-yarn-ui/.travis.yml | 23 --
.../hadoop-yarn/hadoop-yarn-ui/.watchmanconfig | 3 -
.../hadoop-yarn/hadoop-yarn-ui/README.md | 24 --
.../hadoop-yarn-ui/app/adapters/cluster-info.js | 20 --
.../app/adapters/cluster-metric.js | 20 --
.../app/adapters/yarn-app-attempt.js | 32 --
.../hadoop-yarn-ui/app/adapters/yarn-app.js | 26 --
.../app/adapters/yarn-container-log.js | 74 -----
.../app/adapters/yarn-container.js | 43 ---
.../app/adapters/yarn-node-app.js | 63 ----
.../app/adapters/yarn-node-container.js | 64 ----
.../hadoop-yarn-ui/app/adapters/yarn-node.js | 40 ---
.../hadoop-yarn-ui/app/adapters/yarn-queue.js | 20 --
.../hadoop-yarn-ui/app/adapters/yarn-rm-node.js | 45 ---
.../hadoop-yarn/hadoop-yarn-ui/app/app.js | 20 --
.../hadoop-yarn-ui/app/components/.gitkeep | 0
.../app/components/app-attempt-table.js | 4 -
.../hadoop-yarn-ui/app/components/app-table.js | 4 -
.../hadoop-yarn-ui/app/components/bar-chart.js | 104 -------
.../app/components/base-chart-component.js | 109 -------
.../app/components/container-table.js | 4 -
.../app/components/donut-chart.js | 148 ----------
.../app/components/item-selector.js | 21 --
.../app/components/queue-configuration-table.js | 4 -
.../app/components/queue-navigator.js | 4 -
.../hadoop-yarn-ui/app/components/queue-view.js | 272 -----------------
.../app/components/simple-table.js | 58 ----
.../app/components/timeline-view.js | 250 ----------------
.../app/components/tree-selector.js | 257 ----------------
.../hadoop-yarn/hadoop-yarn-ui/app/config.js | 27 --
.../hadoop-yarn/hadoop-yarn-ui/app/constants.js | 24 --
.../hadoop-yarn-ui/app/controllers/.gitkeep | 0
.../app/controllers/application.js | 55 ----
.../app/controllers/cluster-overview.js | 5 -
.../hadoop-yarn-ui/app/controllers/yarn-apps.js | 4 -
.../app/controllers/yarn-queue.js | 6 -
.../hadoop-yarn-ui/app/helpers/.gitkeep | 0
.../hadoop-yarn-ui/app/helpers/divide.js | 31 --
.../app/helpers/log-files-comma.js | 48 ---
.../hadoop-yarn-ui/app/helpers/node-link.js | 37 ---
.../hadoop-yarn-ui/app/helpers/node-menu.js | 66 -----
.../hadoop-yarn/hadoop-yarn-ui/app/index.html | 25 --
.../hadoop-yarn-ui/app/models/.gitkeep | 0
.../hadoop-yarn-ui/app/models/cluster-info.js | 13 -
.../hadoop-yarn-ui/app/models/cluster-metric.js | 115 --------
.../app/models/yarn-app-attempt.js | 44 ---
.../hadoop-yarn-ui/app/models/yarn-app.js | 65 -----
.../app/models/yarn-container-log.js | 25 --
.../hadoop-yarn-ui/app/models/yarn-container.js | 39 ---
.../hadoop-yarn-ui/app/models/yarn-node-app.js | 44 ---
.../app/models/yarn-node-container.js | 57 ----
.../hadoop-yarn-ui/app/models/yarn-node.js | 33 ---
.../hadoop-yarn-ui/app/models/yarn-queue.js | 76 -----
.../hadoop-yarn-ui/app/models/yarn-rm-node.js | 92 ------
.../hadoop-yarn-ui/app/models/yarn-user.js | 8 -
.../hadoop-yarn/hadoop-yarn-ui/app/router.js | 29 --
.../hadoop-yarn-ui/app/routes/.gitkeep | 0
.../hadoop-yarn-ui/app/routes/application.js | 38 ---
.../app/routes/cluster-overview.js | 11 -
.../hadoop-yarn-ui/app/routes/index.js | 29 --
.../app/routes/yarn-app-attempt.js | 21 --
.../hadoop-yarn-ui/app/routes/yarn-app.js | 10 -
.../hadoop-yarn-ui/app/routes/yarn-apps.js | 8 -
.../app/routes/yarn-container-log.js | 55 ----
.../hadoop-yarn-ui/app/routes/yarn-node-app.js | 29 --
.../hadoop-yarn-ui/app/routes/yarn-node-apps.js | 29 --
.../app/routes/yarn-node-container.js | 30 --
.../app/routes/yarn-node-containers.js | 28 --
.../hadoop-yarn-ui/app/routes/yarn-node.js | 29 --
.../hadoop-yarn-ui/app/routes/yarn-nodes.js | 25 --
.../hadoop-yarn-ui/app/routes/yarn-queue.js | 20 --
.../app/routes/yarn-queues/index.js | 5 -
.../app/routes/yarn-queues/queues-selector.js | 7 -
.../app/serializers/cluster-info.js | 29 --
.../app/serializers/cluster-metric.js | 29 --
.../app/serializers/yarn-app-attempt.js | 49 ----
.../hadoop-yarn-ui/app/serializers/yarn-app.js | 66 -----
.../app/serializers/yarn-container-log.js | 39 ---
.../app/serializers/yarn-container.js | 54 ----
.../app/serializers/yarn-node-app.js | 86 ------
.../app/serializers/yarn-node-container.js | 74 -----
.../hadoop-yarn-ui/app/serializers/yarn-node.js | 56 ----
.../app/serializers/yarn-queue.js | 127 --------
.../app/serializers/yarn-rm-node.js | 77 -----
.../hadoop-yarn-ui/app/styles/app.css | 141 ---------
.../app/templates/application.hbs | 23 --
.../app/templates/cluster-overview.hbs | 56 ----
.../app/templates/components/.gitkeep | 0
.../templates/components/app-attempt-table.hbs | 28 --
.../app/templates/components/app-table.hbs | 62 ----
.../templates/components/container-table.hbs | 36 ---
.../components/queue-configuration-table.hbs | 40 ---
.../templates/components/queue-navigator.hbs | 18 --
.../app/templates/components/timeline-view.hbs | 35 ---
.../hadoop-yarn-ui/app/templates/error.hbs | 19 --
.../hadoop-yarn-ui/app/templates/notfound.hbs | 20 --
.../app/templates/yarn-app-attempt.hbs | 12 -
.../hadoop-yarn-ui/app/templates/yarn-app.hbs | 145 ----------
.../hadoop-yarn-ui/app/templates/yarn-apps.hbs | 3 -
.../app/templates/yarn-container-log.hbs | 36 ---
.../app/templates/yarn-node-app.hbs | 60 ----
.../app/templates/yarn-node-apps.hbs | 51 ----
.../app/templates/yarn-node-container.hbs | 70 -----
.../app/templates/yarn-node-containers.hbs | 58 ----
.../hadoop-yarn-ui/app/templates/yarn-node.hbs | 94 ------
.../hadoop-yarn-ui/app/templates/yarn-nodes.hbs | 65 -----
.../hadoop-yarn-ui/app/templates/yarn-queue.hbs | 48 ---
.../hadoop-yarn-ui/app/utils/converter.js | 91 ------
.../hadoop-yarn-ui/app/utils/sorter.js | 55 ----
.../hadoop-yarn/hadoop-yarn-ui/bower.json | 22 --
.../hadoop-yarn-ui/config/environment.js | 46 ---
.../hadoop-yarn-ui/ember-cli-build.js | 29 --
.../hadoop-yarn/hadoop-yarn-ui/jsconfig.json | 6 -
.../hadoop-yarn/hadoop-yarn-ui/package.json | 44 ---
.../hadoop-yarn/hadoop-yarn-ui/pom.xml | 207 +++++++++++++
.../hadoop-yarn-ui/public/robots.txt | 3 -
.../src/main/webapp/WEB-INF/web.xml | 25 ++
.../main/webapp/app/adapters/cluster-info.js | 38 +++
.../main/webapp/app/adapters/cluster-metric.js | 38 +++
.../webapp/app/adapters/yarn-app-attempt.js | 50 ++++
.../src/main/webapp/app/adapters/yarn-app.js | 44 +++
.../webapp/app/adapters/yarn-container-log.js | 74 +++++
.../main/webapp/app/adapters/yarn-container.js | 61 ++++
.../main/webapp/app/adapters/yarn-node-app.js | 63 ++++
.../webapp/app/adapters/yarn-node-container.js | 64 ++++
.../src/main/webapp/app/adapters/yarn-node.js | 40 +++
.../src/main/webapp/app/adapters/yarn-queue.js | 38 +++
.../main/webapp/app/adapters/yarn-rm-node.js | 45 +++
.../hadoop-yarn-ui/src/main/webapp/app/app.js | 38 +++
.../webapp/app/components/app-attempt-table.js | 22 ++
.../src/main/webapp/app/components/app-table.js | 22 ++
.../src/main/webapp/app/components/bar-chart.js | 122 ++++++++
.../app/components/base-chart-component.js | 127 ++++++++
.../webapp/app/components/container-table.js | 22 ++
.../main/webapp/app/components/donut-chart.js | 166 +++++++++++
.../main/webapp/app/components/item-selector.js | 39 +++
.../app/components/queue-configuration-table.js | 22 ++
.../webapp/app/components/queue-navigator.js | 22 ++
.../main/webapp/app/components/queue-view.js | 290 +++++++++++++++++++
.../main/webapp/app/components/simple-table.js | 76 +++++
.../main/webapp/app/components/timeline-view.js | 268 +++++++++++++++++
.../main/webapp/app/components/tree-selector.js | 275 ++++++++++++++++++
.../src/main/webapp/app/config.js | 27 ++
.../src/main/webapp/app/constants.js | 24 ++
.../main/webapp/app/controllers/application.js | 55 ++++
.../webapp/app/controllers/cluster-overview.js | 23 ++
.../main/webapp/app/controllers/yarn-apps.js | 22 ++
.../main/webapp/app/controllers/yarn-queue.js | 24 ++
.../src/main/webapp/app/helpers/divide.js | 31 ++
.../main/webapp/app/helpers/log-files-comma.js | 48 +++
.../src/main/webapp/app/helpers/node-link.js | 37 +++
.../src/main/webapp/app/helpers/node-menu.js | 66 +++++
.../src/main/webapp/app/index.html | 43 +++
.../src/main/webapp/app/models/cluster-info.js | 31 ++
.../main/webapp/app/models/cluster-metric.js | 133 +++++++++
.../main/webapp/app/models/yarn-app-attempt.js | 62 ++++
.../src/main/webapp/app/models/yarn-app.js | 83 ++++++
.../webapp/app/models/yarn-container-log.js | 25 ++
.../main/webapp/app/models/yarn-container.js | 57 ++++
.../src/main/webapp/app/models/yarn-node-app.js | 44 +++
.../webapp/app/models/yarn-node-container.js | 57 ++++
.../src/main/webapp/app/models/yarn-node.js | 33 +++
.../src/main/webapp/app/models/yarn-queue.js | 94 ++++++
.../src/main/webapp/app/models/yarn-rm-node.js | 92 ++++++
.../src/main/webapp/app/models/yarn-user.js | 26 ++
.../src/main/webapp/app/router.js | 47 +++
.../src/main/webapp/app/routes/application.js | 38 +++
.../main/webapp/app/routes/cluster-overview.js | 29 ++
.../src/main/webapp/app/routes/index.js | 29 ++
.../main/webapp/app/routes/yarn-app-attempt.js | 39 +++
.../src/main/webapp/app/routes/yarn-app.js | 28 ++
.../src/main/webapp/app/routes/yarn-apps.js | 26 ++
.../webapp/app/routes/yarn-container-log.js | 55 ++++
.../src/main/webapp/app/routes/yarn-node-app.js | 29 ++
.../main/webapp/app/routes/yarn-node-apps.js | 29 ++
.../webapp/app/routes/yarn-node-container.js | 30 ++
.../webapp/app/routes/yarn-node-containers.js | 28 ++
.../src/main/webapp/app/routes/yarn-node.js | 29 ++
.../src/main/webapp/app/routes/yarn-nodes.js | 25 ++
.../src/main/webapp/app/routes/yarn-queue.js | 38 +++
.../main/webapp/app/routes/yarn-queues/index.js | 23 ++
.../app/routes/yarn-queues/queues-selector.js | 25 ++
.../main/webapp/app/serializers/cluster-info.js | 47 +++
.../webapp/app/serializers/cluster-metric.js | 47 +++
.../webapp/app/serializers/yarn-app-attempt.js | 67 +++++
.../src/main/webapp/app/serializers/yarn-app.js | 84 ++++++
.../app/serializers/yarn-container-log.js | 39 +++
.../webapp/app/serializers/yarn-container.js | 72 +++++
.../webapp/app/serializers/yarn-node-app.js | 86 ++++++
.../app/serializers/yarn-node-container.js | 74 +++++
.../main/webapp/app/serializers/yarn-node.js | 56 ++++
.../main/webapp/app/serializers/yarn-queue.js | 145 ++++++++++
.../main/webapp/app/serializers/yarn-rm-node.js | 77 +++++
.../src/main/webapp/app/styles/app.css | 159 ++++++++++
.../main/webapp/app/templates/application.hbs | 41 +++
.../webapp/app/templates/cluster-overview.hbs | 74 +++++
.../templates/components/app-attempt-table.hbs | 46 +++
.../app/templates/components/app-table.hbs | 80 +++++
.../templates/components/container-table.hbs | 54 ++++
.../components/queue-configuration-table.hbs | 58 ++++
.../templates/components/queue-navigator.hbs | 36 +++
.../app/templates/components/timeline-view.hbs | 53 ++++
.../src/main/webapp/app/templates/error.hbs | 19 ++
.../src/main/webapp/app/templates/notfound.hbs | 20 ++
.../webapp/app/templates/yarn-app-attempt.hbs | 30 ++
.../src/main/webapp/app/templates/yarn-app.hbs | 163 +++++++++++
.../src/main/webapp/app/templates/yarn-apps.hbs | 21 ++
.../webapp/app/templates/yarn-container-log.hbs | 36 +++
.../main/webapp/app/templates/yarn-node-app.hbs | 60 ++++
.../webapp/app/templates/yarn-node-apps.hbs | 51 ++++
.../app/templates/yarn-node-container.hbs | 70 +++++
.../app/templates/yarn-node-containers.hbs | 58 ++++
.../src/main/webapp/app/templates/yarn-node.hbs | 94 ++++++
.../main/webapp/app/templates/yarn-nodes.hbs | 65 +++++
.../main/webapp/app/templates/yarn-queue.hbs | 66 +++++
.../src/main/webapp/app/utils/converter.js | 109 +++++++
.../src/main/webapp/app/utils/sorter.js | 73 +++++
.../hadoop-yarn-ui/src/main/webapp/bower.json | 22 ++
.../src/main/webapp/config/environment.js | 65 +++++
.../src/main/webapp/ember-cli-build.js | 47 +++
.../src/main/webapp/jsconfig.json | 6 +
.../hadoop-yarn-ui/src/main/webapp/package.json | 44 +++
.../assets/images/datatables/Sorting icons.psd | Bin 0 -> 27490 bytes
.../public/assets/images/datatables/favicon.ico | Bin 0 -> 894 bytes
.../assets/images/datatables/sort_asc.png | Bin 0 -> 160 bytes
.../images/datatables/sort_asc_disabled.png | Bin 0 -> 148 bytes
.../assets/images/datatables/sort_both.png | Bin 0 -> 201 bytes
.../assets/images/datatables/sort_desc.png | Bin 0 -> 158 bytes
.../images/datatables/sort_desc_disabled.png | Bin 0 -> 146 bytes
.../src/main/webapp/public/crossdomain.xml | 34 +++
.../hadoop-yarn-ui/src/main/webapp/testem.json | 12 +
.../src/main/webapp/tests/helpers/resolver.js | 29 ++
.../src/main/webapp/tests/helpers/start-app.js | 36 +++
.../src/main/webapp/tests/index.html | 51 ++++
.../src/main/webapp/tests/test-helper.js | 24 ++
.../webapp/tests/unit/adapters/yarn-app-test.js | 30 ++
.../unit/adapters/yarn-container-log-test.js | 73 +++++
.../tests/unit/adapters/yarn-node-app-test.js | 93 ++++++
.../unit/adapters/yarn-node-container-test.js | 93 ++++++
.../tests/unit/adapters/yarn-node-test.js | 42 +++
.../tests/unit/adapters/yarn-rm-node-test.js | 44 +++
.../tests/unit/controllers/yarn-apps-test.js | 30 ++
.../tests/unit/controllers/yarn-queues-test.js | 30 ++
.../webapp/tests/unit/mixins/charts-test.js | 30 ++
.../webapp/tests/unit/models/yarn-app-test.js | 30 ++
.../unit/models/yarn-container-log-test.js | 48 +++
.../tests/unit/models/yarn-node-app-test.js | 65 +++++
.../unit/models/yarn-node-container-test.js | 78 +++++
.../webapp/tests/unit/models/yarn-node-test.js | 58 ++++
.../tests/unit/models/yarn-rm-node-test.js | 95 ++++++
.../webapp/tests/unit/routes/yarn-apps-test.js | 29 ++
.../unit/routes/yarn-container-log-test.js | 120 ++++++++
.../tests/unit/routes/yarn-node-app-test.js | 56 ++++
.../tests/unit/routes/yarn-node-apps-test.js | 60 ++++
.../unit/routes/yarn-node-container-test.js | 61 ++++
.../unit/routes/yarn-node-containers-test.js | 68 +++++
.../webapp/tests/unit/routes/yarn-node-test.js | 84 ++++++
.../webapp/tests/unit/routes/yarn-nodes-test.js | 74 +++++
.../tests/unit/serializers/yarn-app-test.js | 33 +++
.../unit/serializers/yarn-container-log-test.js | 49 ++++
.../unit/serializers/yarn-node-app-test.js | 102 +++++++
.../serializers/yarn-node-container-test.js | 128 ++++++++
.../tests/unit/serializers/yarn-node-test.js | 69 +++++
.../tests/unit/serializers/yarn-rm-node-test.js | 153 ++++++++++
.../webapp/tests/unit/utils/converter-test.js | 52 ++++
.../main/webapp/tests/unit/utils/sorter-test.js | 26 ++
.../hadoop-yarn/hadoop-yarn-ui/testem.json | 12 -
.../hadoop-yarn/hadoop-yarn-ui/tests/.jshintrc | 52 ----
.../hadoop-yarn-ui/tests/helpers/resolver.js | 11 -
.../hadoop-yarn-ui/tests/helpers/start-app.js | 18 --
.../hadoop-yarn/hadoop-yarn-ui/tests/index.html | 33 ---
.../hadoop-yarn-ui/tests/test-helper.js | 6 -
.../hadoop-yarn-ui/tests/unit/.gitkeep | 0
.../tests/unit/adapters/yarn-app-test.js | 12 -
.../unit/adapters/yarn-container-log-test.js | 73 -----
.../tests/unit/adapters/yarn-node-app-test.js | 93 ------
.../unit/adapters/yarn-node-container-test.js | 93 ------
.../tests/unit/adapters/yarn-node-test.js | 42 ---
.../tests/unit/adapters/yarn-rm-node-test.js | 44 ---
.../tests/unit/controllers/yarn-apps-test.js | 12 -
.../tests/unit/controllers/yarn-queues-test.js | 12 -
.../tests/unit/mixins/charts-test.js | 12 -
.../tests/unit/models/yarn-app-test.js | 12 -
.../unit/models/yarn-container-log-test.js | 48 ---
.../tests/unit/models/yarn-node-app-test.js | 65 -----
.../unit/models/yarn-node-container-test.js | 78 -----
.../tests/unit/models/yarn-node-test.js | 58 ----
.../tests/unit/models/yarn-rm-node-test.js | 95 ------
.../tests/unit/routes/yarn-apps-test.js | 11 -
.../unit/routes/yarn-container-log-test.js | 120 --------
.../tests/unit/routes/yarn-node-app-test.js | 56 ----
.../tests/unit/routes/yarn-node-apps-test.js | 60 ----
.../unit/routes/yarn-node-container-test.js | 61 ----
.../unit/routes/yarn-node-containers-test.js | 68 -----
.../tests/unit/routes/yarn-node-test.js | 84 ------
.../tests/unit/routes/yarn-nodes-test.js | 74 -----
.../tests/unit/serializers/yarn-app-test.js | 15 -
.../unit/serializers/yarn-container-log-test.js | 49 ----
.../unit/serializers/yarn-node-app-test.js | 102 -------
.../serializers/yarn-node-container-test.js | 128 --------
.../tests/unit/serializers/yarn-node-test.js | 69 -----
.../tests/unit/serializers/yarn-rm-node-test.js | 153 ----------
.../tests/unit/utils/converter-test.js | 52 ----
.../tests/unit/utils/sorter-test.js | 26 --
.../hadoop-yarn/hadoop-yarn-ui/vendor/.gitkeep | 0
hadoop-yarn-project/hadoop-yarn/pom.xml | 1 +
317 files changed, 8974 insertions(+), 7308 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 998287d..94ab48d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,6 +21,19 @@ hadoop-hdfs-project/hadoop-hdfs-httpfs/downloads
hadoop-common-project/hadoop-common/src/test/resources/contract-test-options.xml
hadoop-tools/hadoop-openstack/src/test/resources/contract-test-options.xml
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/tla/yarnregistry.toolbox
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/dist
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tmp
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/node
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/node_modules
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower_components
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/.sass-cache
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/connect.lock
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/coverage/*
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/libpeerconnection.log
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webappnpm-debug.log
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapptestem.log
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/dist
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tmp
yarnregistry.pdf
hadoop-tools/hadoop-aws/src/test/resources/auth-keys.xml
hadoop-tools/hadoop-aws/src/test/resources/contract-test-options.xml
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/BUILDING.txt
----------------------------------------------------------------------
diff --git a/BUILDING.txt b/BUILDING.txt
index 9d297f7..4424579 100644
--- a/BUILDING.txt
+++ b/BUILDING.txt
@@ -15,6 +15,7 @@ Requirements:
* Internet connection for first build (to fetch all Maven and Hadoop dependencies)
* python (for releasedocs)
* bats (for shell code testing)
+* Node.js / bower / Ember-cli (for YARN UI v2 building)
----------------------------------------------------------------------------------
The easiest way to get an environment with all the appropriate tools is by means
@@ -119,7 +120,7 @@ Maven build goals:
* Run clover : mvn test -Pclover [-DcloverLicenseLocation=${user.name}/.clover.license]
* Run Rat : mvn apache-rat:check
* Build javadocs : mvn javadoc:javadoc
- * Build distribution : mvn package [-Pdist][-Pdocs][-Psrc][-Pnative][-Dtar][-Preleasedocs]
+ * Build distribution : mvn package [-Pdist][-Pdocs][-Psrc][-Pnative][-Dtar][-Preleasedocs][-Pyarn-ui]
* Change Hadoop version : mvn versions:set -DnewVersion=NEWVERSION
Build options:
@@ -129,6 +130,7 @@ Maven build goals:
* Use -Psrc to create a project source TAR.GZ
* Use -Dtar to create a TAR with the distribution (using -Pdist)
* Use -Preleasedocs to include the changelog and release docs (requires Internet connectivity)
+ * Use -Pyarn-ui to build YARN UI v2. (Requires Internet connectivity, and it is for dev use only)
Snappy build options:
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/LICENSE.txt
----------------------------------------------------------------------
diff --git a/LICENSE.txt b/LICENSE.txt
index 6910a09..45b6cdf 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1868,3 +1868,83 @@ representations with respect to the Work not specified here. Licensor shall not
be bound by any additional provisions that may appear in any communication from
You. This License may not be modified without the mutual written agreement of
the Licensor and You.
+
+For Apache Hadoop YARN Web UI component: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/
+---------------------------------------------------------------------
+The Apache Hadoop YARN Web UI component bundles the following files under the MIT License:
+
+ - ember v2.2.0 (http://emberjs.com/) - Copyright (c) 2014 Yehuda Katz, Tom Dale and Ember.js contributors
+ - ember-data v2.1.0 (https://github.com/emberjs/data) - Copyright (C) 2011-2014 Tilde, Inc. and contributors, Portions Copyright (C) 2011 LivingSocial Inc.
+ - ember-resolver v2.0.3 (https://github.com/ember-cli/ember-resolver) - Copyright (c) 2013 Stefan Penner and Ember App Kit Contributors
+ - bootstrap v3.3.6 (http://getbootstrap.com) - Copyright (c) 2011-2014 Twitter, Inc
+ - jquery v2.1.4 (http://jquery.org) - Copyright 2005, 2014 jQuery Foundation and other contributors
+ - jquery-ui v1.11.4 (http://jqueryui.com/) - Copyright 2014 jQuery Foundation and other contributors
+ - datatables v1.10.8 (https://datatables.net/)
+ - moment v2.10.6 (http://momentjs.com/) - Copyright (c) 2011-2015 Tim Wood, Iskren Chernev, Moment.js contributors
+ - em-helpers v0.5.8 (https://github.com/sreenaths/em-helpers)
+ - ember-cli-app-version v0.5.8 (https://github.com/EmberSherpa/ember-cli-app-version) - Authored by Taras Mankovski <ta...@gmail.com>
+ - ember-cli-babel v5.1.6 (https://github.com/babel/ember-cli-babel) - Authored by Stefan Penner <st...@gmail.com>
+ - ember-cli-content-security-policy v0.4.0 (https://github.com/rwjblue/ember-cli-content-security-policy)
+ - ember-cli-dependency-checker v1.2.0 (https://github.com/quaertym/ember-cli-dependency-checker) - Authored by Emre Unal
+ - ember-cli-htmlbars v1.0.2 (https://github.com/ember-cli/ember-cli-htmlbars) - Authored by Robert Jackson <me...@rwjblue.com>
+ - ember-cli-htmlbars-inline-precompile v0.3.1 (https://github.com/pangratz/ember-cli-htmlbars-inline-precompile) - Authored by Clemens M�ller <cm...@gmail.com>
+ - ember-cli-ic-ajax v0.2.1 (https://github.com/rwjblue/ember-cli-ic-ajax) - Authored by Robert Jackson <me...@rwjblue.com>
+ - ember-cli-inject-live-reload v1.4.0 (https://github.com/rwjblue/ember-cli-inject-live-reload) - Authored by Robert Jackson <me...@rwjblue.com>
+ - ember-cli-qunit v1.2.1 (https://github.com/ember-cli/ember-cli-qunit) - Authored by Robert Jackson <me...@rwjblue.com>
+ - ember-cli-release v0.2.8 (https://github.com/lytics/ember-cli-release) - Authored by Robert Jackson <me...@rwjblue.com>
+ - ember-cli-sri v1.2.1 (https://github.com/jonathanKingston/ember-cli-sri) - Authored by Jonathan Kingston
+ - ember-cli-uglify v1.2.0 (github.com/ember-cli/ember-cli-uglify) - Authored by Robert Jackson <me...@rwjblue.com>
+ - ember-d3 v0.1.0 (https://github.com/brzpegasus/ember-d3) - Authored by Estelle DeBlois
+ - select2 v4.0.0 (https://select2.github.io/)
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and assocated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+----
+The Apache Hadoop YARN Web UI component bundles the following files under the BSD License:
+
+(3-clause BSD license)
+ - D3 v3.5.6 (http://d3js.org/) - Copyright (c) 2010-2014, Michael Bostock
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this list
+ of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice, this
+ list of conditions and the following disclaimer in the documentation and/or
+ other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/dev-support/create-release.sh
----------------------------------------------------------------------
diff --git a/dev-support/create-release.sh b/dev-support/create-release.sh
new file mode 100755
index 0000000..792a805
--- /dev/null
+++ b/dev-support/create-release.sh
@@ -0,0 +1,144 @@
+#!/bin/bash
+# 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.
+
+
+# Function to probe the exit code of the script commands,
+# and stop in the case of failure with an contextual error
+# message.
+run() {
+ echo "\$ ${@}"
+ "${@}"
+ exitCode=$?
+ if [[ $exitCode != 0 ]]; then
+ echo
+ echo "Failed! running ${@} in `pwd`"
+ echo
+ exit $exitCode
+ fi
+}
+
+doMD5() {
+ MD5CMD="md5sum"
+ which $MD5CMD
+ if [[ $? != 0 ]]; then
+ MD5CMD="md5"
+ fi
+ run $MD5CMD ${1} > ${1}.md5
+}
+
+# If provided, the created release artifacts will be tagged with it
+# (use RC#, i.e: RC0). Do not use a label to create the final release
+# artifact.
+RC_LABEL=$1
+
+# Extract Hadoop version from POM
+HADOOP_VERSION=`cat pom.xml | grep "<version>" | head -1 | sed 's|^ *<version>||' | sed 's|</version>.*$||'`
+
+# Setup git
+GIT=${GIT:-git}
+
+echo
+echo "*****************************************************************"
+echo
+echo "Hadoop version to create release artifacts: ${HADOOP_VERSION}"
+echo
+echo "Release Candidate Label: ${RC_LABEL}"
+echo
+echo "*****************************************************************"
+echo
+
+if [[ ! -z ${RC_LABEL} ]]; then
+ RC_LABEL="-${RC_LABEL}"
+fi
+
+# Get Maven command
+if [ -z "$MAVEN_HOME" ]; then
+ MVN=mvn
+else
+ MVN=$MAVEN_HOME/bin/mvn
+fi
+
+ARTIFACTS_DIR="target/artifacts"
+
+# git clean to clear any remnants from previous build
+run ${GIT} clean -xdf
+
+# mvn clean for sanity
+run ${MVN} clean
+
+# Create staging dir for release artifacts
+run mkdir -p ${ARTIFACTS_DIR}
+
+# Create RAT report
+run ${MVN} apache-rat:check
+
+# Create SRC and BIN tarballs for release,
+# Using 'install\u2019 goal instead of 'package' so artifacts are available
+# in the Maven local cache for the site generation
+run ${MVN} install -Pdist,src,native,yarn-ui -DskipTests -Dtar
+
+# Create site for release
+run ${MVN} site site:stage -Pdist -Psrc
+run mkdir -p target/staging/hadoop-project/hadoop-project-dist/hadoop-yarn
+run mkdir -p target/staging/hadoop-project/hadoop-project-dist/hadoop-mapreduce
+run cp ./hadoop-common-project/hadoop-common/src/main/docs/releasenotes.html target/staging/hadoop-project/hadoop-project-dist/hadoop-common/
+run cp ./hadoop-common-project/hadoop-common/CHANGES.txt target/staging/hadoop-project/hadoop-project-dist/hadoop-common/
+run cp ./hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt target/staging/hadoop-project/hadoop-project-dist/hadoop-hdfs/
+run cp ./hadoop-yarn-project/CHANGES.txt target/staging/hadoop-project/hadoop-project-dist/hadoop-yarn/
+run cp ./hadoop-mapreduce-project/CHANGES.txt target/staging/hadoop-project/hadoop-project-dist/hadoop-mapreduce/
+run mv target/staging/hadoop-project target/r${HADOOP_VERSION}/
+run cd target/
+run tar czf hadoop-site-${HADOOP_VERSION}.tar.gz r${HADOOP_VERSION}/*
+run cd ..
+
+# Stage RAT report
+find . -name rat.txt | xargs -I% cat % > ${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}-rat.txt
+
+# Stage CHANGES.txt files
+run cp ./hadoop-common-project/hadoop-common/CHANGES.txt ${ARTIFACTS_DIR}/CHANGES-COMMON-${HADOOP_VERSION}${RC_LABEL}.txt
+run cp ./hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt ${ARTIFACTS_DIR}/CHANGES-HDFS-${HADOOP_VERSION}${RC_LABEL}.txt
+run cp ./hadoop-mapreduce-project/CHANGES.txt ${ARTIFACTS_DIR}/CHANGES-MAPREDUCE-${HADOOP_VERSION}${RC_LABEL}.txt
+run cp ./hadoop-yarn-project/CHANGES.txt ${ARTIFACTS_DIR}/CHANGES-YARN-${HADOOP_VERSION}${RC_LABEL}.txt
+
+# Prepare and stage BIN tarball
+run cd hadoop-dist/target/
+run tar -xzf hadoop-${HADOOP_VERSION}.tar.gz
+run cp -r ../../target/r${HADOOP_VERSION}/* hadoop-${HADOOP_VERSION}/share/doc/hadoop/
+run tar -czf hadoop-${HADOOP_VERSION}.tar.gz hadoop-${HADOOP_VERSION}
+run cd ../..
+run mv hadoop-dist/target/hadoop-${HADOOP_VERSION}.tar.gz ${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}.tar.gz
+
+# Stage SRC tarball
+run mv hadoop-dist/target/hadoop-${HADOOP_VERSION}-src.tar.gz ${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}-src.tar.gz
+
+# Stage SITE tarball
+run mv target/hadoop-site-${HADOOP_VERSION}.tar.gz ${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}-site.tar.gz
+
+# MD5 SRC and BIN tarballs
+doMD5 ${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}.tar.gz
+doMD5 ${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}-src.tar.gz
+
+run cd ${ARTIFACTS_DIR}
+ARTIFACTS_DIR=`pwd`
+echo
+echo "Congratulations, you have successfully built the release"
+echo "artifacts for Apache Hadoop ${HADOOP_VERSION}${RC_LABEL}"
+echo
+echo "The artifacts for this run are available at ${ARTIFACTS_DIR}:"
+run ls -1 ${ARTIFACTS_DIR}
+echo
+echo "Remember to sign them before staging them on the open"
+echo
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/dev-support/docker/Dockerfile
----------------------------------------------------------------------
diff --git a/dev-support/docker/Dockerfile b/dev-support/docker/Dockerfile
index 5a7f85a..e66fef2 100644
--- a/dev-support/docker/Dockerfile
+++ b/dev-support/docker/Dockerfile
@@ -133,6 +133,11 @@ RUN pip install python-dateutil
ENV MAVEN_OPTS -Xms256m -Xmx512m
###
+# Install node js tools for web UI frameowkr
+###
+RUN apt-get -y install nodejs && ln -s /usr/bin/nodejs /usr/bin/node && apt-get -y install npm && npm install -g bower
+
+###
# Everything past this point is either not needed for testing or breaks Yetus.
# So tell Yetus not to read the rest of the file:
# YETUS CUT HERE
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/YarnUI2.md
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/YarnUI2.md b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/YarnUI2.md
new file mode 100644
index 0000000..575ebc7
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/YarnUI2.md
@@ -0,0 +1,43 @@
+<!--
+ 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.
+-->
+
+Hadoop: YARN-UI V2
+=================
+*This is a WIP project, nobody should use it in production.*
+
+Prerequisites
+-------------
+
+You will need the following things properly installed on your computer.
+
+* Install Node.js with NPM: https://nodejs.org/download/
+* After Node.js installed, install bower: `npm install -g bower`.
+* Install Ember-cli: `npm install -g ember-cli`
+
+BUILD
+----
+* Please refer to BUILDING.txt in the top directory and pass -Pyarn-ui to build UI-related code
+* Execute `mvn test -Pyarn-ui` to run unit tests
+
+Try it
+------
+
+* Packaging and deploying Hadoop in this branch
+* In `hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/config.js`, change `timelineWebUrl` and `rmWebUrl` to your YARN RM/Timeline server web address.
+* If you are running YARN RM in your localhost, you should update `localBaseUrl` to `localhost:1337/`, install `npm install -g corsproxy` and run `corsproxy` to avoid CORS errors. More details: `https://www.npmjs.com/package/corsproxy`.
+* Run `ember serve` under `hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/`
+* Visit your app at [http://localhost:4200](http://localhost:4200).
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.bowerrc
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.bowerrc b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.bowerrc
deleted file mode 100644
index 959e169..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.bowerrc
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "directory": "bower_components",
- "analytics": false
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.editorconfig
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.editorconfig b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.editorconfig
deleted file mode 100644
index 47c5438..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.editorconfig
+++ /dev/null
@@ -1,34 +0,0 @@
-# EditorConfig helps developers define and maintain consistent
-# coding styles between different editors and IDEs
-# editorconfig.org
-
-root = true
-
-
-[*]
-end_of_line = lf
-charset = utf-8
-trim_trailing_whitespace = true
-insert_final_newline = true
-indent_style = space
-indent_size = 2
-
-[*.js]
-indent_style = space
-indent_size = 2
-
-[*.hbs]
-insert_final_newline = false
-indent_style = space
-indent_size = 2
-
-[*.css]
-indent_style = space
-indent_size = 2
-
-[*.html]
-indent_style = space
-indent_size = 2
-
-[*.{diff,md}]
-trim_trailing_whitespace = false
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.ember-cli
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.ember-cli b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.ember-cli
deleted file mode 100644
index 96bd287..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.ember-cli
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- /**
- Ember CLI sends analytics information by default. The data is completely
- anonymous, but there are times when you might want to disable this behavior.
-
- Setting `disableAnalytics` to true will prevent any data from being sent.
- */
- "disableAnalytics": false,
- "liveReload": true,
- "watcher": "polling"
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.gitignore
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.gitignore b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.gitignore
deleted file mode 100644
index 86fceae..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.gitignore
+++ /dev/null
@@ -1,17 +0,0 @@
-# See http://help.github.com/ignore-files/ for more about ignoring files.
-
-# compiled output
-/dist
-/tmp
-
-# dependencies
-/node_modules
-/bower_components
-
-# misc
-/.sass-cache
-/connect.lock
-/coverage/*
-/libpeerconnection.log
-npm-debug.log
-testem.log
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.jshintrc
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.jshintrc b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.jshintrc
deleted file mode 100644
index 08096ef..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.jshintrc
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "predef": [
- "document",
- "window",
- "-Promise"
- ],
- "browser": true,
- "boss": true,
- "curly": true,
- "debug": false,
- "devel": true,
- "eqeqeq": true,
- "evil": true,
- "forin": false,
- "immed": false,
- "laxbreak": false,
- "newcap": true,
- "noarg": true,
- "noempty": false,
- "nonew": false,
- "nomen": false,
- "onevar": false,
- "plusplus": false,
- "regexp": false,
- "undef": true,
- "sub": true,
- "strict": false,
- "white": false,
- "eqnull": true,
- "esnext": true,
- "unused": true
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.travis.yml
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.travis.yml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.travis.yml
deleted file mode 100644
index 66dd107..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.travis.yml
+++ /dev/null
@@ -1,23 +0,0 @@
----
-language: node_js
-node_js:
- - "0.12"
-
-sudo: false
-
-cache:
- directories:
- - node_modules
-
-before_install:
- - export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH
- - "npm config set spin false"
- - "npm install -g npm@^2"
-
-install:
- - npm install -g bower
- - npm install
- - bower install
-
-script:
- - npm test
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.watchmanconfig
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.watchmanconfig b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.watchmanconfig
deleted file mode 100644
index 5e9462c..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.watchmanconfig
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "ignore_dirs": ["tmp"]
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/README.md
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/README.md b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/README.md
deleted file mode 100644
index d5cba6e..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/README.md
+++ /dev/null
@@ -1,24 +0,0 @@
-# Yarn-ui
-*This is a WIP project, nobody should use it in production.*
-
-## Prerequisites
-
-You will need the following things properly installed on your computer.
-
-* Install Node.js with NPM: https://nodejs.org/download/
-* After Node.js installed, install bower: `npm install -g bower`.
-* Install Ember-cli: `npm install -g ember-cli`
-
-## Installation
-
-* Goto root directory of yarn-ui project: `hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui`
-* `npm install && bower install`, it will take a while to finish.
-
-## Try it
-
-* Packaging and deploying Hadoop in this branch (You can use latest trunk after YARN-4417 committed to trunk)
-* Modify `app/adapters/yarn-app.js`, change `host` to your YARN RM web address
-* If you running YARN RM in your localhost, you should install `npm install -g corsproxy` and run `corsproxy` to avoid CORS errors. More details: `https://www.npmjs.com/package/corsproxy`. And the `host` of `app/adapters/yarn-app.js` should start with `localhost:1337`.
-* Run `ember server`
-* Visit your app at [http://localhost:4200](http://localhost:4200).
-
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-info.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-info.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-info.js
deleted file mode 100644
index 5a0d2d3..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-info.js
+++ /dev/null
@@ -1,20 +0,0 @@
-import DS from 'ember-data';
-import Config from 'yarn-ui/config';
-
-export default DS.JSONAPIAdapter.extend({
- headers: {
- Accept: 'application/json'
- },
- host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
- namespace: 'ws/v1/cluster', // common const
- pathForType(modelName) {
- return ''; // move to some common place, return path by modelname.
- },
- ajax(url, method, hash) {
- hash = hash || {};
- hash.crossDomain = true;
- hash.xhrFields = {withCredentials: true};
- hash.targetServer = "RM";
- return this._super(url, method, hash);
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-metric.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-metric.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-metric.js
deleted file mode 100644
index d392c9b..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-metric.js
+++ /dev/null
@@ -1,20 +0,0 @@
-import DS from 'ember-data';
-import Config from 'yarn-ui/config';
-
-export default DS.JSONAPIAdapter.extend({
- headers: {
- Accept: 'application/json'
- },
- host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
- namespace: 'ws/v1/cluster/metrics', // common const
- pathForType(modelName) {
- return ''; // move to some common place, return path by modelname.
- },
- ajax(url, method, hash) {
- hash = hash || {};
- hash.crossDomain = true;
- hash.xhrFields = {withCredentials: true};
- hash.targetServer = "RM";
- return this._super(url, method, hash);
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app-attempt.js
deleted file mode 100644
index 4e40744..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app-attempt.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import DS from 'ember-data';
-import Converter from 'yarn-ui/utils/converter';
-import Config from 'yarn-ui/config';
-
-export default DS.JSONAPIAdapter.extend({
- headers: {
- Accept: 'application/json'
- },
- host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
- namespace: 'ws/v1/cluster', // common const
-
- urlForQuery(query, modelName) {
- var url = this._buildURL();
- return url + '/apps/' + query.appId + "/appattempts";
- },
-
- urlForFindRecord(id, modelName, snapshot) {
- var url = this._buildURL();
- var url = url + '/apps/' +
- Converter.attemptIdToAppId(id) + "/appattempts/" + id;
- console.log(url);
- return url;
- },
-
- ajax(url, method, hash) {
- hash = {};
- hash.crossDomain = true;
- hash.xhrFields = {withCredentials: true};
- hash.targetServer = "RM";
- return this._super(url, method, hash);
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app.js
deleted file mode 100644
index faff3e7..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import DS from 'ember-data';
-import Config from 'yarn-ui/config';
-
-export default DS.JSONAPIAdapter.extend({
- headers: {
- Accept: 'application/json'
- },
- host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
- namespace: 'ws/v1/cluster', // common const
- pathForType(modelName) {
- return 'apps'; // move to some common place, return path by modelname.
- },
- /*
- urlForQuery(query, modelName) {
- var url = this._buildURL();
- return url + '/apps/' + query.appId + "/appattempts";
- },
- */
- ajax(url, method, hash) {
- hash = hash || {};
- hash.crossDomain = true;
- hash.xhrFields = {withCredentials: true};
- hash.targetServer = "RM";
- return this._super(url, method, hash);
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container-log.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container-log.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container-log.js
deleted file mode 100644
index 7838c98..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container-log.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * 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.
- */
-
-import DS from 'ember-data';
-import Ember from 'ember';
-import Converter from 'yarn-ui/utils/converter';
-
-/**
- * REST URL's response when fetching container logs will be
- * in plain text format and not JSON.
- */
-export default DS.RESTAdapter.extend({
- headers: {
- Accept: 'text/plain'
- },
- host: 'http://localhost:1337/',
- namespace: 'ws/v1/node',
-
- urlForFindRecord(id, modelName, snapshot) {
- var splits = Converter.splitForContainerLogs(id);
- var nodeHttpAddr = splits[0];
- var containerId = splits[1];
- var filename = splits[2];
- this.host = this.host + nodeHttpAddr;
- var url = this._buildURL();
- url = url + "/containerlogs/" + containerId + "/" + filename;
- return url;
- },
-
- ajax(url, method, hash) {
- hash = hash || {};
- hash.crossDomain = true;
- hash.xhrFields = {withCredentials: true};
- hash.targetServer = "NM";
- return this._super(url, method, hash);
- },
-
- /**
- * Override options so that result is not expected to be JSON
- */
- ajaxOptions: function (url, type, options) {
- var hash = options || {};
- hash.url = url;
- hash.type = type;
- // Make sure jQuery does not try to convert response to JSON.
- hash.dataType = 'text';
- hash.context = this;
-
- var headers = Ember.get(this, 'headers');
- if (headers != undefined) {
- hash.beforeSend = function (xhr) {
- Object.keys(headers).forEach(function (key) {
- return xhr.setRequestHeader(key, headers[key]);
- });
- };
- }
- return hash;
- },
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container.js
deleted file mode 100644
index d941c38..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container.js
+++ /dev/null
@@ -1,43 +0,0 @@
-import DS from 'ember-data';
-import Converter from 'yarn-ui/utils/converter';
-import Config from 'yarn-ui/config';
-
-export default DS.JSONAPIAdapter.extend({
- headers: {
- Accept: 'application/json'
- },
- rmHost: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT,
- tsHost: 'http://localhost:1337/' + Config.TS_HOST + ':' + Config.TS_PORT,
- host: function() {
- return undefined
- }.property(),
- rmNamespace: 'ws/v1/cluster',
- tsNamespace: 'ws/v1/applicationhistory',
- namespace: function() {
- return undefined
- }.property(),
-
- urlForQuery(query, modelName) {
- if (query.is_rm) {
- this.set("host", this.rmHost);
- this.set("namespace", this.rmNamespace);
- } else {
- this.set("host", this.tsHost);
- this.set("namespace", this.tsNamespace);
- }
-
- var url = this._buildURL();
- url = url + '/apps/' + Converter.attemptIdToAppId(query.app_attempt_id)
- + "/appattempts/" + query.app_attempt_id + "/containers";
- console.log(url);
- return url;
- },
-
- ajax(url, method, hash) {
- hash = {};
- hash.crossDomain = true;
- hash.xhrFields = {withCredentials: true};
- hash.targetServer = "RM";
- return this._super(url, method, hash);
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-app.js
deleted file mode 100644
index 0c60d1f..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-app.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * 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.
- */
-
-import DS from 'ember-data';
-
-export default DS.JSONAPIAdapter.extend({
- headers: {
- Accept: 'application/json'
- },
- host: 'http://localhost:1337/',
- namespace: 'ws/v1/node',
-
- urlForQuery(query) {
- this.host = this.host + query.nodeAddr;
- var url = this._buildURL();
- url = url + "/apps";
- return url;
- },
-
- urlForQueryRecord: function (query) {
- this.host = this.host + query.nodeAddr;
- var url = this._buildURL();
- url = url + "/apps/" + query.appId;
- return url;
- },
-
- query: function (store, type, query) {
- var url = this.urlForQuery(query);
- // Query params not required.
- query = null;
- return this.ajax(url, 'GET', { data: query });
- },
-
- queryRecord: function (store, type, query) {
- var url = this.urlForQueryRecord(query);
- // Query params not required.
- query = null;
- return this.ajax(url, 'GET', { data: query });
- },
-
- ajax(url, method, hash) {
- hash = hash || {};
- hash.crossDomain = true;
- hash.xhrFields = {withCredentials: true};
- hash.targetServer = "NM";
- return this._super(url, method, hash);
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-container.js
deleted file mode 100644
index e8bf7b7..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-container.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * 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.
- */
-
-import DS from 'ember-data';
-
-export default DS.JSONAPIAdapter.extend({
- headers: {
- Accept: 'application/json'
- },
- host: 'http://localhost:1337/',
- namespace: 'ws/v1/node',
-
- urlForQuery(query) {
- this.host = this.host + query.nodeHttpAddr;
- var url = this._buildURL();
- url = url + "/containers";
- return url;
- },
-
- urlForQueryRecord(query) {
- this.host = this.host + query.nodeHttpAddr;
- var url = this._buildURL();
- url = url + "/containers/" + query.containerId;
- return url;
- },
-
- query: function (store, type, query) {
- var url = this.urlForQuery(query);
- // Query params not required.
- query = null;
- return this.ajax(url, 'GET', { data: query });
- },
-
- queryRecord: function (store, type, query) {
- var url = this.urlForQueryRecord(query);
- // Query params not required.
- query = null;
- console.log(url);
- return this.ajax(url, 'GET', { data: query });
- },
-
- ajax(url, method, hash) {
- hash = hash || {};
- hash.crossDomain = true;
- hash.xhrFields = {withCredentials: true};
- hash.targetServer = "NM";
- return this._super(url, method, hash);
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node.js
deleted file mode 100644
index 64f524a..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.
- */
-
-import DS from 'ember-data';
-
-export default DS.JSONAPIAdapter.extend({
- headers: {
- Accept: 'application/json'
- },
- host: 'http://localhost:1337/',
- namespace: 'ws/v1/node',
-
- urlForFindRecord(id, modelName, snapshot) {
- this.host = this.host + id;
- var url = this._buildURL();
- return url;
- },
- ajax(url, method, hash) {
- hash = hash || {};
- hash.crossDomain = true;
- hash.xhrFields = {withCredentials: true};
- hash.targetServer = "NM";
- return this._super(url, method, hash);
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-queue.js
deleted file mode 100644
index 0f6eb65..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-queue.js
+++ /dev/null
@@ -1,20 +0,0 @@
-import DS from 'ember-data';
-import Config from 'yarn-ui/config';
-
-export default DS.JSONAPIAdapter.extend({
- headers: {
- Accept: 'application/json'
- },
- host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
- namespace: 'ws/v1/cluster', // common const
- pathForType(modelName) {
- return 'scheduler'; // move to some common place, return path by modelname.
- },
- ajax(url, method, hash) {
- hash = hash || {};
- hash.crossDomain = true;
- hash.xhrFields = {withCredentials: true};
- hash.targetServer = "RM";
- return this._super(url, method, hash);
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-rm-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-rm-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-rm-node.js
deleted file mode 100644
index c6ad6f3..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-rm-node.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * 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.
- */
-
-import DS from 'ember-data';
-import Config from 'yarn-ui/config';
-
-export default DS.JSONAPIAdapter.extend({
- headers: {
- Accept: 'application/json'
- },
- host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT,
- namespace: 'ws/v1/cluster',
- pathForType(modelName) {
- return 'nodes';
- },
-
- urlForFindRecord(id, modelName, snapshot) {
- var url = this._buildURL();
- url = url + "/nodes/" + id;
- return url;
- },
-
- ajax(url, method, hash) {
- hash = hash || {};
- hash.crossDomain = true;
- hash.xhrFields = {withCredentials: true};
- hash.targetServer = "RM";
- return this._super(url, method, hash);
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/app.js
deleted file mode 100644
index ff28ecf..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/app.js
+++ /dev/null
@@ -1,20 +0,0 @@
-import Ember from 'ember';
-import Resolver from 'ember/resolver';
-import loadInitializers from 'ember/load-initializers';
-import config from './config/environment';
-import Sorter from 'yarn-ui/utils/sorter';
-
-var App;
-
-Ember.MODEL_FACTORY_INJECTIONS = true;
-
-App = Ember.Application.extend({
- modulePrefix: config.modulePrefix,
- podModulePrefix: config.podModulePrefix,
- Resolver: Resolver
-});
-
-loadInitializers(App, config.modulePrefix);
-Sorter.initDataTableSorter();
-
-export default App;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/.gitkeep
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/.gitkeep b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/.gitkeep
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/app-attempt-table.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/app-attempt-table.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/app-attempt-table.js
deleted file mode 100644
index aff0493..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/app-attempt-table.js
+++ /dev/null
@@ -1,4 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Component.extend({
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/app-table.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/app-table.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/app-table.js
deleted file mode 100644
index aff0493..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/app-table.js
+++ /dev/null
@@ -1,4 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Component.extend({
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/bar-chart.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/bar-chart.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/bar-chart.js
deleted file mode 100644
index f24e947..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/bar-chart.js
+++ /dev/null
@@ -1,104 +0,0 @@
-import Ember from 'ember';
-import BaseChartComponent from 'yarn-ui/components/base-chart-component';
-
-export default BaseChartComponent.extend({
- // data:
- // [{label=label1, value=value1}, ...]
- // ...
- renderBarChart: function(data, title, textWidth = 50) {
- var g = this.chart.g;
- var layout = this.getLayout();
- this.renderTitleAndBG(g, title, layout);
-
- var maxValue = -1;
- for (var i = 0; i < data.length; i++) {
- if (data[i] instanceof Array) {
- if (data[i][0].value > maxValue) {
- maxValue = data[i][0].value;
- }
- } else {
- if (data[i].value > maxValue) {
- maxValue = data[i].value;
- }
- }
- }
-
- var singleBarHeight = 30;
-
- // 50 is for text
- var maxBarWidth = layout.x2 - layout.x1 - 2 * layout.margin - textWidth - 50;
-
- // 30 is for title
- var maxBarsHeight = layout.y2 - layout.y1 - 2 * layout.margin - 30;
- var gap = (maxBarsHeight - data.length * singleBarHeight) / (data.length -
- 1);
-
- var xScaler = d3.scale.linear()
- .domain([0, maxValue])
- .range([0, maxBarWidth]);
-
- // show bar text
- for (var i = 0; i < data.length; i++) {
- g.append("text")
- .text(
- function() {
- return data[i].label;
- })
- .attr("y", function() {
- return layout.y1 + singleBarHeight / 2 + layout.margin + (gap +
- singleBarHeight) * i + 30;
- })
- .attr("x", layout.x1 + layout.margin);
- }
-
- // show bar
- var bar = g.selectAll("bars")
- .data(data)
- .enter()
- .append("rect")
- .attr("y", function(d, i) {
- return layout.y1 + 30 + layout.margin + (gap + singleBarHeight) * i;
- })
- .attr("x", layout.x1 + layout.margin + textWidth)
- .attr("height", singleBarHeight)
- .attr("fill", function(d, i) {
- return this.colors[i];
- }.bind(this))
- .attr("width", 0);
-
- this.bindTooltip(bar);
-
- bar.transition()
- .duration(500)
- .attr("width", function(d) {
- var w;
- w = xScaler(d.value);
- // At least each item has 3 px
- w = Math.max(w, 3);
- return w;
- });
-
- // show bar value
- for (var i = 0; i < data.length; i++) {
- g.append("text")
- .text(
- function() {
- return data[i].value;
- })
- .attr("y", function() {
- return layout.y1 + singleBarHeight / 2 + layout.margin + (gap +
- singleBarHeight) * i + 30;
- })
- .attr("x", layout.x1 + layout.margin + textWidth + 15 + xScaler(data[i].value));
- }
- },
-
- draw: function() {
- this.initChart();
- this.renderBarChart(this.get("data"), this.get("title"), this.get("textWidth"));
- },
-
- didInsertElement: function() {
- this.draw();
- },
-})
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/base-chart-component.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/base-chart-component.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/base-chart-component.js
deleted file mode 100644
index acf2b5f..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/base-chart-component.js
+++ /dev/null
@@ -1,109 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Component.extend({
- chart: undefined,
- tooltip : undefined,
- colors: d3.scale.category10().range(),
-
- initChart: function() {
- this.chart = {
- svg: undefined,
- g: undefined,
- h: 0,
- w: 0,
- tooltip: undefined
- };
-
- // Init tooltip if it is not initialized
- this.tooltip = d3.select("#chart-tooltip");
- if (!this.tooltip) {
- this.tooltip = d3.select("body")
- .append("div")
- .attr("class", "tooltip")
- .attr("id", "chart-tooltip")
- .style("opacity", 0);
- }
-
- // Init svg
- var svg = this.chart.svg;
- if (svg) {
- svg.remove();
- }
-
- var parentId = this.get("parentId");
- var parent = d3.select("#" + parentId);
- var bbox = parent.node().getBoundingClientRect();
- this.chart.w = bbox.width - 30;
-
- var ratio = 0.75; // 4:3 by default
- if (this.get("ratio")) {
- ratio = this.get("ratio");
- }
- this.chart.h = bbox.width * ratio;
-
- if (this.get("maxHeight")) {
- this.chart.h = Math.min(this.get("maxHeight"), this.chart.h);
- }
-
- this.chart.svg = parent.append("svg")
- .attr("width", this.chart.w)
- .attr("height", this.chart.h);
-
- this.chart.g = this.chart.svg.append("g");
- },
-
- renderTitleAndBG: function(g, title, layout) {
- var bg = g.append("g");
- bg.append("text")
- .text(title)
- .attr("x", (layout.x1 + layout.x2) / 2)
- .attr("y", layout.y1 + layout.margin + 20)
- .attr("class", "chart-title");
-
- bg.append("rect")
- .attr("x", layout.x1)
- .attr("y", layout.y1)
- .attr("width", layout.x2 - layout.x1)
- .attr("height", layout.y2 - layout.y1)
- .attr("class", "chart-frame");
- },
-
- bindTooltip: function(d) {
- d.on("mouseover", function(d) {
- this.tooltip
- .style("left", (d3.event.pageX) + "px")
- .style("top", (d3.event.pageY - 28) + "px");
- }.bind(this))
- .on("mousemove", function(d) {
- // Handle pie chart case
- var data = d;
- if (d.data) {
- data = d.data;
- }
-
- this.tooltip.style("opacity", .9);
- this.tooltip.html(data.label + " = " + data.value)
- .style("left", (d3.event.pageX) + "px")
- .style("top", (d3.event.pageY - 28) + "px");
- }.bind(this))
- .on("mouseout", function(d) {
- this.tooltip.style("opacity", 0);
- }.bind(this));
- },
-
- getLayout: function() {
- var x1 = 0;
- var y1 = 0;
- var x2 = this.chart.w;
- var y2 = this.chart.h;
-
- var layout = {
- x1: x1,
- y1: y1,
- x2: x2 - 10,
- y2: y2 - 10,
- margin: 10
- };
- return layout;
- },
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/container-table.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/container-table.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/container-table.js
deleted file mode 100644
index aff0493..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/container-table.js
+++ /dev/null
@@ -1,4 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Component.extend({
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/donut-chart.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/donut-chart.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/donut-chart.js
deleted file mode 100644
index 608b0c1..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/donut-chart.js
+++ /dev/null
@@ -1,148 +0,0 @@
-import Ember from 'ember';
-import BaseChartComponent from 'yarn-ui/components/base-chart-component';
-
-export default BaseChartComponent.extend({
- /*
- * data = [{label="xx", value=},{...}]
- */
- renderDonutChart: function(data, title, showLabels = false,
- middleLabel = "Total", middleValue = undefined) {
- var g = this.chart.g;
- var layout = this.getLayout();
- this.renderTitleAndBG(g, title, layout);
-
- var total = 0;
- var allZero = true;
- for (var i = 0; i < data.length; i++) {
- total += data[i].value;
- if (data[i].value > 1e-6) {
- allZero = false;
- }
- }
-
- if (!middleValue) {
- middleValue = total;
- }
-
- //Width and height
- var h = layout.y2 - layout.y1;
-
- // 50 is for title
- var outerRadius = (h - 50 - 2 * layout.margin) / 2;
- var innerRadius = outerRadius * 0.618;
- var arc = d3.svg.arc()
- .innerRadius(innerRadius)
- .outerRadius(outerRadius);
-
- var cx;
- var cy = layout.y1 + 50 + layout.margin + outerRadius;
- if (showLabels) {
- cx = layout.x1 + layout.margin + outerRadius;
- } else {
- cx = (layout.x1 + layout.x2) / 2;
- }
-
- var pie = d3.layout.pie();
- pie.sort(null);
- pie.value(function(d) {
- var v = d.value;
- // make sure it > 0
- v = Math.max(v, 1e-6);
- return v;
- });
-
- //Set up groups
- var arcs = g
- .selectAll("g.arc")
- .data(pie(data))
- .enter()
- .append("g")
- .attr("class", "arc")
- .attr("transform", "translate(" + cx + "," + cy + ")");
-
- function tweenPie(finish) {
- var start = {
- startAngle: 0,
- endAngle: 0
- };
- var i = d3.interpolate(start, finish);
- return function(d) {
- return arc(i(d));
- };
- }
-
- //Draw arc paths
- var path = arcs.append("path")
- .attr("fill", function(d, i) {
- if (d.value > 1e-6) {
- return this.colors[i];
- } else {
- return "white";
- }
- }.bind(this))
- .attr("d", arc)
- .attr("stroke", function(d, i) {
- if (allZero) {
- return this.colors[i];
- }
- }.bind(this))
- .attr("stroke-dasharray", function(d, i) {
- if (d.value <= 1e-6) {
- return "10,10";
- }
- }.bind(this));
- this.bindTooltip(path);
-
- // Show labels
- if (showLabels) {
- var lx = layout.x1 + layout.margin + outerRadius * 2 + 30;
- var squareW = 15;
- var margin = 10;
-
- var select = g.selectAll(".rect")
- .data(data)
- .enter();
- select.append("rect")
- .attr("fill", function(d, i) {
- return this.colors[i];
- }.bind(this))
- .attr("x", lx)
- .attr("y", function(d, i) {
- return layout.y1 + 50 + (squareW + margin) * i + layout.margin;
- })
- .attr("width", squareW)
- .attr("height", squareW);
- select.append("text")
- .attr("x", lx + squareW + margin)
- .attr("y", function(d, i) {
- return layout.y1 + 50 + (squareW + margin) * i + layout.margin + squareW / 2;
- })
- .text(function(d) {
- return d.label + ' = ' + d.value;
- });
- }
-
- if (middleLabel) {
- var highLightColor = this.colors[0];
- g.append("text").text(middleLabel).attr("x", cx).attr("y", cy - 10).
- attr("class", "donut-highlight-text").attr("fill", highLightColor);
- g.append("text").text(middleValue).attr("x", cx).attr("y", cy + 20).
- attr("class", "donut-highlight-text").attr("fill", highLightColor).
- style("font-size", "30px");
- }
-
- path.transition()
- .duration(500)
- .attrTween('d', tweenPie);
- },
-
- draw: function() {
- this.initChart();
- this.renderDonutChart(this.get("data"), this.get("title"), this.get("showLabels"),
- this.get("middleLabel"), this.get("middleValue"));
- },
-
- didInsertElement: function() {
- this.draw();
- },
-})
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/item-selector.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/item-selector.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/item-selector.js
deleted file mode 100644
index a18ccae..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/item-selector.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Component.extend({
- didInsertElement: function() {
- $(".js-example-basic-single").select2(
- {
- width: '100%',
- placeholder: "Select a queue"
- });
- var elementId = this.get("element-id");
- var prefix = this.get("prefix");
-
- var element = d3.select("#" + elementId);
-
- if (element) {
- this.get("model").forEach(function(o) {
- element.append("option").attr("value", o.get("name")).text(prefix + o.get("name"));
- });
- }
- }
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-configuration-table.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-configuration-table.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-configuration-table.js
deleted file mode 100644
index aff0493..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-configuration-table.js
+++ /dev/null
@@ -1,4 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Component.extend({
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-navigator.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-navigator.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-navigator.js
deleted file mode 100644
index aff0493..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-navigator.js
+++ /dev/null
@@ -1,4 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Component.extend({
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-view.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-view.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-view.js
deleted file mode 100644
index c1fd8ff..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-view.js
+++ /dev/null
@@ -1,272 +0,0 @@
-import Ember from 'ember';
-import ChartUtilsMixin from 'yarn-ui/mixins/charts-utils';
-
-export default Ember.Component.extend(ChartUtilsMixin, {
- queues: {
- data: undefined,
- foldedQueues: {},
- selectedQueueCircle: undefined,
- maxDepth: -1,
- },
-
- queueColors: d3.scale.category20().range(),
-
- renderQueue: function(now, depth, sequence) {
- if (depth > this.queues.maxDepth) {
- this.queues.maxDepth = depth;
- }
-
- var cx = 20 + depth * 30;
- var cy = 20 + sequence * 30;
- var name = now.get("name");
-
- var g = this.queues.dataGroup.append("g")
- .attr("id", "queue-" + name + "-g");
-
- var folded = this.queues.foldedQueues[name];
- var isParentQueue = false;
-
- // render its children
- var children = [];
- var childrenNames = now.get("children");
- if (childrenNames) {
- childrenNames.forEach(function(name) {
- isParentQueue = true;
- var child = this.queues.data[name];
- if (child) {
- children.push(child);
- }
- }.bind(this));
- }
- if (folded) {
- children = [];
- }
- var linefunction = d3.svg.line()
- .interpolate("basis")
- .x(function(d) {
- return d.x;
- })
- .y(function(d) {
- return d.y;
- });
-
- for (var i = 0; i < children.length; i++) {
- sequence = sequence + 1;
- // Get center of children queue
- var cc = this.renderQueue(children[i],
- depth + 1, sequence);
- g.append("path")
- .attr("class", "queue")
- .attr("d", linefunction([{
- x: cx,
- y: cy
- }, {
- x: cc.x - 20,
- y: cc.y
- }, cc]));
- }
-
- var circle = g.append("circle")
- .attr("cx", cx)
- .attr("cy", cy)
- .attr("class", "queue");
-
- circle.on('mouseover', function() {
- circle.style("fill", this.queueColors[1]);
- }.bind(this));
- circle.on('mouseout', function() {
- if (circle != this.queues.selectedQueueCircle) {
- circle.style("fill", this.queueColors[0]);
- }
- }.bind(this));
- circle.on('click', function() {
- circle.style("fill", this.queueColors[2]);
- var pre = this.queues.selectedQueueCircle;
- this.queues.selectedQueueCircle = circle;
- if (pre) {
- pre.on('mouseout')();
- }
- this.renderCharts(name);
- }.bind(this));
- circle.on('dblclick', function() {
- if (!isParentQueue) {
- return;
- }
-
- if (this.queues.foldedQueues[name]) {
- delete this.queues.foldedQueues[name];
- } else {
- this.queues.foldedQueues[name] = now;
- }
- this.renderQueues();
- }.bind(this));
-
- var text = name;
- if (folded) {
- text = name + " (+)";
- }
-
- // print queue's name
- g.append("text")
- .attr("x", cx + 30)
- .attr("y", cy + 5)
- .text(text)
- .attr("class", "queue");
-
- return {
- x: cx,
- y: cy
- };
- },
-
- renderQueues: function() {
- if (this.queues.dataGroup) {
- this.queues.dataGroup.remove();
- }
- // render queues
- this.queues.dataGroup = this.canvas.svg.append("g")
- .attr("id", "queues-g");
- var rootQueue = undefined;
-
- if (this.queues.data) {
- this.renderQueue(this.queues.data['root'], 0, 0);
-
- }
- },
-
- draw: function() {
- this.queues.data = {};
- this.get("model")
- .forEach(function(o) {
- this.queues.data[o.id] = o;
- }.bind(this));
-
- // get w/h of the svg
- var bbox = d3.select("#main-container")
- .node()
- .getBoundingClientRect();
- this.canvas.w = bbox.width;
- this.canvas.h = Math.max(Object.keys(this.queues.data)
- .length * 35, 1500);
-
- this.canvas.svg = d3.select("#main-container")
- .append("svg")
- .attr("width", this.canvas.w)
- .attr("height", this.canvas.h)
- .attr("id", "main-svg");
-
- this.renderBackground();
-
- this.renderQueues();
- this.renderCharts("root");
- },
-
- didInsertElement: function() {
- this.draw();
- },
-
- /*
- * data = [{label="xx", value=},{...}]
- */
- renderTable: function(data, title, layout) {
- d3.select("#main-svg")
- .append('table')
- .selectAll('tr')
- .data(data)
- .enter()
- .append('tr')
- .selectAll('td')
- .data(function(d) {
- return d;
- })
- .enter()
- .append('td')
- .text(function(d) {
- return d;
- });
- },
-
- renderQueueCapacities: function(queue, layout) {
- // Render bar chart
- this.renderBarChart(this.charts.g, [{
- label: "Cap",
- value: queue.get("capacity")
- }, {
- label: "MaxCap",
- value: queue.get("maxCapacity")
- }, {
- label: "UsedCap",
- value: queue.get("usedCapacity")
- }], "Queue Capacities", layout, 60);
- },
-
- renderChildrenCapacities: function(queue, layout) {
- var data = [];
- var children = queue.get("children");
- if (children) {
- for (var i = 0; i < children.length; i++) {
- var child = this.queues.data[children[i]];
- data.push({
- label: child.get("name"),
- value: child.get("capacity")
- });
- }
- }
-
- this.renderDonutChart(this.charts.g, data, "Children Capacities", layout, true);
- },
-
- renderChildrenUsedCapacities: function(queue, layout) {
- var data = [];
- var children = queue.get("children");
- if (children) {
- for (var i = 0; i < children.length; i++) {
- var child = this.queues.data[children[i]];
- data.push({
- label: child.get("name"),
- value: child.get("usedCapacity")
- });
- }
- }
-
- this.renderDonutChart(this.charts.g, data, "Children Used Capacities", layout, true);
- },
-
- renderLeafQueueUsedCapacities: function(layout) {
- var leafQueueUsedCaps = [];
- for (var queueName in this.queues.data) {
- var q = this.queues.data[queueName];
- if ((!q.get("children")) || q.get("children")
- .length == 0) {
- // it's a leafqueue
- leafQueueUsedCaps.push({
- label: q.get("name"),
- value: q.get("usedCapacity")
- });
- }
- }
-
- this.renderDonutChart(this.charts.g, leafQueueUsedCaps, "LeafQueues Used Capacities",
- layout, true);
- },
-
- renderCharts: function(queueName) {
- this.charts.leftBannerLen = this.queues.maxDepth * 30 + 100;
- this.initCharts();
-
- var queue = this.queues.data[queueName];
- var idx = 0;
-
- if (queue.get("name") == "root") {
- this.renderLeafQueueUsedCapacities(this.getLayout(idx++));
- }
- if (queue.get("name") != "root") {
- this.renderQueueCapacities(queue, this.getLayout(idx++));
- }
- if (queue.get("children") && queue.get("children")
- .length > 0) {
- this.renderChildrenCapacities(queue, this.getLayout(idx++));
- this.renderChildrenUsedCapacities(queue, this.getLayout(idx++));
- }
- },
-});
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[32/50] [abbrv] hadoop git commit: YARN-4517. Add nodes page and fix
bunch of license issues. (Varun Saxena via wangda)
Posted by wa...@apache.org.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/error.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/error.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/error.hbs
new file mode 100644
index 0000000..c546bf7
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/error.hbs
@@ -0,0 +1,19 @@
+{{!--
+ 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.
+--}}
+
+<h3 align = "center">Sorry, Error Occured.</h3>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/notfound.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/notfound.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/notfound.hbs
new file mode 100644
index 0000000..588ea44
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/notfound.hbs
@@ -0,0 +1,20 @@
+{{!--
+ 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.
+--}}
+
+<h2 align = "center">404, Not Found</h2>
+<h4 align = "center">Please Check your URL</h4>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-apps.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-apps.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-apps.hbs
index e58d6bd..3a79080 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-apps.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-apps.hbs
@@ -1,3 +1,3 @@
{{app-table table-id="apps-table" arr=model}}
-{{simple-table table-id="apps-table" bFilter=true colTypes="elapsed-time" colTargets="7"}}
-{{outlet}}
\ No newline at end of file
+{{simple-table table-id="apps-table" bFilter=true colsOrder="0,desc" colTypes="natural elapsed-time" colTargets="0 7"}}
+{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-container-log.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-container-log.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-container-log.hbs
new file mode 100644
index 0000000..9cc3b0f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-container-log.hbs
@@ -0,0 +1,36 @@
+{{!--
+ 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.
+--}}
+
+<div class="col-md-12 container-fluid">
+ {{node-menu path="yarnContainerLog" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
+ <div class="col-md-10">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h5 align="center"><b>{{model.containerLog.logFileName}} for {{model.containerLog.containerID}}</b></h5>
+ </div>
+ <div class="panel-body">
+ {{#if model.containerLog.logs}}
+ <pre>{{model.containerLog.logs}}</pre>
+ {{else}}
+ <p>No logs were written in {{model.containerLog.logFileName}}.</p>
+ {{/if}}
+ </div>
+ </div>
+ </div>
+</div>
+{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-app.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-app.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-app.hbs
new file mode 100644
index 0000000..4da64b8
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-app.hbs
@@ -0,0 +1,60 @@
+{{!--
+ 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.
+--}}
+
+<div class="col-md-12 container-fluid">
+ <div class="row">
+ {{node-menu path="yarnNodeApp" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
+ <div class="col-md-10 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading"><b>Application Information</b></div>
+ <table class="table">
+ <tbody>
+ <tr>
+ <td>Application ID</td>
+ <td>{{model.nodeApp.appId}}</td>
+ </tr>
+ <tr>
+ <td>Application State</td>
+ <td>{{model.nodeApp.state}}</td>
+ </tr>
+ <tr>
+ <td>User</td>
+ <td>{{model.nodeApp.user}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <table id="node-app-table" class="display table table-striped table-bordered" cellspacing="0">
+ <thead>
+ <tr>
+ <th>Containers for {{model.nodeApp.appId}}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#each model.nodeApp.containers as |container|}}
+ <tr>
+ <td><a href="yarnNodeContainer/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{container}}">{{container}}</a></td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+ {{simple-table table-id="node-app-table" bFilter=true colsOrder="0,desc" colTypes="natural" colTargets="0"}}
+ </div>
+ </div>
+ </div>
+{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-apps.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-apps.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-apps.hbs
new file mode 100644
index 0000000..c195397
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-apps.hbs
@@ -0,0 +1,51 @@
+{{!--
+ 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.
+--}}
+
+<div class="col-md-12 container-fluid">
+ <div class="row">
+ {{node-menu path="yarnNodeApps" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
+ <div class="col-md-10 container-fluid">
+ <table id="node-apps-table" class="display table table-striped table-bordered" cellspacing="0" width="100%">
+ <thead>
+ <tr>
+ <th>Application ID</th>
+ <th>State</th>
+ <th>User</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#if model.apps}}
+ {{#each model.apps as |app|}}
+ {{#if app.isDummyApp}}
+ <tr><td colspan="3" align="center">No apps found on this node</td></tr>
+ {{else}}
+ <tr>
+ <td><a href="yarnNodeApp/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{app.appId}}">{{app.appId}}</a></td>
+ <td><span class={{app.appStateStyle}}>{{app.state}}</span></td>
+ <td>{{app.user}}</td>
+ </tr>
+ {{/if}}
+ {{/each}}
+ {{/if}}
+ </tbody>
+ </table>
+ {{simple-table table-id="node-apps-table" bFilter=true colsOrder="0,desc" colTypes="natural" colTargets="0"}}
+ </div>
+ </div>
+</div>
+{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-container.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-container.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-container.hbs
new file mode 100644
index 0000000..fbbb2fc
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-container.hbs
@@ -0,0 +1,70 @@
+{{!--
+ 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.
+--}}
+
+<div class="col-md-12 container-fluid">
+ <div class="row">
+ {{node-menu path="yarnNodeContainer" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
+ <div class="col-md-10 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading"><b>Container Information</b></div>
+ <table class="table">
+ <tbody>
+ <tr>
+ <td>Container ID</td>
+ <td>{{model.nodeContainer.containerId}}</td>
+ </tr>
+ <tr>
+ <td>Container State</td>
+ <td>{{model.nodeContainer.state}}</td>
+ </tr>
+ <tr>
+ <td>Exit Code</td>
+ <td>{{model.nodeContainer.exitCode}}</td>
+ </tr>
+ <tr>
+ <td>Diagnostics</td>
+ <td>{{model.nodeContainer.diagnostics}}</td>
+ </tr>
+ <tr>
+ <td>User</td>
+ <td>{{model.nodeContainer.user}}</td>
+ </tr>
+ <tr>
+ <td>Total Memory Needed</td>
+ <td>{{model.nodeContainer.totalMemoryNeeded}} MB</td>
+ </tr>
+ <tr>
+ <td>Total VCores Needed</td>
+ <td>{{model.nodeContainer.totalVCoresNeeded}}</td>
+ </tr>
+ <tr>
+ <td>Link to Logs</td>
+ <td>
+ {{log-files-comma nodeId=model.nodeInfo.id
+ nodeAddr=model.nodeInfo.addr
+ containerId=model.nodeContainer.containerId
+ logFiles=model.nodeContainer.containerLogFiles}}
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+ </div>
+{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-containers.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-containers.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-containers.hbs
new file mode 100644
index 0000000..ca80ccd
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-containers.hbs
@@ -0,0 +1,58 @@
+{{!--
+ 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.
+--}}
+
+<div class="col-md-12 container-fluid">
+ <div class="row">
+ {{node-menu path="yarnNodeContainers" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
+ <div class="col-md-10 container-fluid">
+ <table id="node-containers-table" class="display table table-striped table-bordered" cellspacing="0" width="100%">
+ <thead>
+ <tr>
+ <th>Container ID</th>
+ <th>Container State</th>
+ <th>User</th>
+ <th>Logs</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#if model.containers}}
+ {{#each model.containers as |container|}}
+ {{#if container.isDummyContainer}}
+ <tr><td colspan="4" align="center">No containers found on this node</td></tr>
+ {{else}}
+ <tr>
+ <td><a href="yarnNodeContainer/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{container.containerId}}">{{container.containerId}}</a></td>
+ <td><span class={{container.containerStateStyle}}>{{container.state}}</span></td>
+ <td>{{container.user}}</td>
+ <td>
+ {{log-files-comma nodeId=model.nodeInfo.id
+ nodeAddr=model.nodeInfo.addr
+ containerId=container.containerId
+ logFiles=container.containerLogFiles}}
+ </td>
+ </tr>
+ {{/if}}
+ {{/each}}
+ {{/if}}
+ </tbody>
+ </table>
+ {{simple-table table-id="node-containers-table" bFilter=true colsOrder="0,desc" colTypes="natural" colTargets="0"}}
+ </div>
+ </div>
+</div>
+{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node.hbs
new file mode 100644
index 0000000..a036076
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node.hbs
@@ -0,0 +1,94 @@
+{{!--
+ 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.
+--}}
+
+<div class="col-md-12 container-fluid">
+ <div class="row">
+ {{node-menu path="yarnNode" nodeId=model.rmNode.id nodeAddr=model.node.id}}
+ <div class="col-md-10 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">Node Information</div>
+ <table class="table">
+ <tbody>
+ <tr>
+ <td>Total Vmem allocated for Containers</td>
+ <td>{{divide num=model.node.totalVmemAllocatedContainersMB den=1024}} GB</td>
+ </tr>
+ <tr>
+ <td>Vmem enforcement enabled</td>
+ <td>{{model.node.vmemCheckEnabled}}</td>
+ </tr>
+ <tr>
+ <td>Total Pmem allocated for Containers</td>
+ <td>{{divide num=model.node.totalPmemAllocatedContainersMB den=1024}} GB</td>
+ </tr>
+ <tr>
+ <td>Pmem enforcement enabled</td>
+ <td>{{model.node.pmemCheckEnabled}}</td>
+ </tr>
+ <tr>
+ <td>Total VCores allocated for Containers</td>
+ <td>{{model.node.totalVCoresAllocatedContainers}}</td>
+ </tr>
+ <tr>
+ <td>Node Healthy Status</td>
+ <td>{{model.node.nodeHealthy}}</td>
+ </tr>
+ <tr>
+ <td>Last Node Health Report Time</td>
+ <td>{{model.node.lastNodeUpdateTime}}</td>
+ </tr>
+ <tr>
+ <td>Node Health Report</td>
+ <td>{{model.node.healthReport}}</td>
+ </tr>
+ <tr>
+ <td>Node Manager Start Time</td>
+ <td>{{model.node.nmStartupTime}}</td>
+ </tr>
+ <tr>
+ <td>Node Manager Version</td>
+ <td>{{model.node.nodeManagerBuildVersion}}</td>
+ </tr>
+ <tr>
+ <td>Hadoop Version</td>
+ <td>{{model.node.hadoopBuildVersion}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div class="col-lg-4 container-fluid" id="mem-donut-chart">
+ {{donut-chart data=model.rmNode.getMemoryDataForDonutChart
+ title="Resource - Memory (in MB)"
+ showLabels=true
+ parentId="mem-donut-chart"
+ ratio=0.55
+ maxHeight=350}}
+ </div>
+
+ <div class="col-lg-4 container-fluid" id="vcore-donut-chart">
+ {{donut-chart data=model.rmNode.getVCoreDataForDonutChart
+ title="Resource - VCores"
+ showLabels=true
+ parentId="vcore-donut-chart"
+ ratio=0.55
+ maxHeight=350}}
+ </div>
+ </div>
+ </div>
+</div>
+{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-nodes.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-nodes.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-nodes.hbs
new file mode 100644
index 0000000..bf2a098
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-nodes.hbs
@@ -0,0 +1,65 @@
+{{!--
+ 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.
+--}}
+
+<table id="nodes-table" class="display table table-striped table-bordered" cellspacing="0" width="100%">
+ <thead>
+ <tr>
+ <th>Node Labels</th>
+ <th>Rack</th>
+ <th>Node State</th>
+ <th>Node Address</th>
+ <th>Node HTTP Address</th>
+ <th>Last Health Update</th>
+ <th>Health-Report</th>
+ <th>Containers</th>
+ <th>Mem Used</th>
+ <th>Mem Avail</th>
+ <th>VCores Used</th>
+ <th>VCores Avail</th>
+ <th>Version</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#if model}}
+ {{#each model as |node|}}
+ {{#if node.isDummyNode}}
+ <tr><td colspan="13" align="center">No nodes found on this cluster</td></tr>
+ {{else}}
+ <tr>
+ <td>{{node.nodeLabelsAsString}}</td>
+ <td>{{node.rack}}</td>
+ <td><span class={{node.nodeStateStyle}}>{{node.state}}</span></td>
+ <td>{{node.id}}</td>
+ {{node-link nodeId=node.id nodeHTTPAddress=node.nodeHTTPAddress nodeState=node.state}}
+ <td>{{node.lastHealthUpdate}}</td>
+ <td>{{node.healthReport}}</td>
+ <td>{{node.numContainers}}</td>
+ <td>{{divide num=node.usedMemoryMB den=1024}} GB</td>
+ <td>{{divide num=node.availMemoryMB den=1024}} GB</td>
+ <td>{{node.usedVirtualCores}}</td>
+ <td>{{node.availableVirtualCores}}</td>
+ <td>{{node.version}}</td>
+ </tr>
+ {{/if}}
+ {{/each}}
+ {{/if}}
+ </tbody>
+</table>
+
+{{simple-table table-id="nodes-table" bFilter=true}}
+{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/converter.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/converter.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/converter.js
index 41e6c9c..0f49a58 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/converter.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/converter.js
@@ -1,3 +1,5 @@
+import Constants from 'yarn-ui/constants';
+
export default {
containerIdToAttemptId: function(containerId) {
if (containerId) {
@@ -70,5 +72,20 @@ export default {
var ts = moment(date, "YYYY/MM/DD HH:mm:ss").valueOf();
return ts;
}
- }
-}
+ },
+ splitForContainerLogs: function(id) {
+ if (id) {
+ var splits = id.split(Constants.PARAM_SEPARATOR);
+ var splitLen = splits.length;
+ if (splitLen < 3) {
+ return null;
+ }
+ var fileName = splits[2];
+ var index;
+ for (index = 3; index < splitLen; index++) {
+ fileName = fileName + Constants.PARAM_SEPARATOR + splits[index];
+ }
+ return [splits[0], splits[1], fileName];
+ }
+ },
+};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/sorter.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/sorter.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/sorter.js
index 981429b..a9a5f7f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/sorter.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/sorter.js
@@ -1,15 +1,55 @@
import Converter from 'yarn-ui/utils/converter';
+import Ember from 'ember';
export default {
_initElapsedTimeSorter: function() {
- jQuery.extend(jQuery.fn.dataTableExt.oSort, {
+ Ember.$.extend(Ember.$.fn.dataTableExt.oSort, {
"elapsed-time-pre": function (a) {
return Converter.padding(Converter.elapsedTimeToMs(a), 20);
},
});
},
+ _initNaturalSorter: function() {
+ Ember.$.extend(Ember.$.fn.dataTableExt.oSort, {
+ "natural-asc": function (a, b) {
+ return naturalSort(a,b);
+ },
+ "natural-desc": function (a, b) {
+ return naturalSort(a,b) * -1;
+ },
+ });
+ },
+
initDataTableSorter: function() {
this._initElapsedTimeSorter();
+ this._initNaturalSorter();
},
+};
+
+/**
+ * Natural sort implementation.
+ * Typically used to sort application Ids'.
+ */
+function naturalSort(a, b) {
+ var diff = a.length - b.length;
+ if (diff != 0) {
+ var splitA = a.split("_");
+ var splitB = b.split("_");
+ if (splitA.length != splitB.length) {
+ return a.localeCompare(b);
+ }
+ for (var i = 1; i < splitA.length; i++) {
+ var splitdiff = splitA[i].length - splitB[i].length;
+ if (splitdiff != 0) {
+ return splitdiff;
+ }
+ var splitCompare = splitA[i].localeCompare(splitB[i]);
+ if (splitCompare != 0) {
+ return splitCompare;
+ }
+ }
+ return diff;
+ }
+ return a.localeCompare(b);
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/bower.json
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/bower.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/bower.json
index ec587bb..de66650 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/bower.json
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/bower.json
@@ -9,7 +9,7 @@
"ember-qunit": "0.4.9",
"ember-qunit-notifications": "0.0.7",
"ember-resolver": "~0.1.18",
- "jquery": "^1.11.3",
+ "jquery": "1.11.3",
"loader.js": "ember-cli/loader.js#3.2.1",
"qunit": "~1.18.0",
"bootstrap": "~3.3.2",
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/config/environment.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/config/environment.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/config/environment.js
index b898e0d..bb4f8d2 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/config/environment.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/config/environment.js
@@ -12,7 +12,6 @@ module.exports = function(environment) {
// e.g. 'with-controller': true
}
},
-
APP: {
// Here you can pass flags/options to your application instance
// when it is created
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-container-log-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-container-log-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-container-log-test.js
new file mode 100644
index 0000000..e6e7b43
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-container-log-test.js
@@ -0,0 +1,73 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+import Constants from 'yarn-ui/constants';
+
+moduleFor('adapter:yarn-container-log', 'Unit | Adapter | ContainerLog', {
+});
+
+test('Basic creation', function(assert) {
+ let adapter = this.subject();
+
+ assert.ok(adapter);
+ assert.ok(adapter.urlForFindRecord);
+ assert.ok(adapter.ajax);
+ assert.ok(adapter.headers);
+ assert.ok(adapter.host);
+ assert.ok(adapter.namespace);
+ assert.equal(adapter.headers.Accept, "text/plain");
+ assert.equal(adapter.namespace, "ws/v1/node");
+});
+
+test('urlForFindRecord test', function(assert) {
+ let adapter = this.subject();
+ let host = adapter.host;
+ assert.equal(adapter.urlForFindRecord("localhost:8042" +
+ Constants.PARAM_SEPARATOR + "container_e27_11111111111_0001_01_000001" +
+ Constants.PARAM_SEPARATOR + "syslog"),
+ host + "localhost:8042/ws/v1/node/containerlogs/" +
+ "container_e27_11111111111_0001_01_000001/syslog");
+});
+
+test('ajaxOptions test', function(assert) {
+ let adapter = this.subject();
+ var hash = adapter.ajaxOptions('/containerlogs', 'type', {});
+ assert.equal(hash.dataType, 'text');
+});
+
+test('findRecord test', function(assert) {
+ let adapter = this.subject(),
+ testModel = { modelName: "testModel" },
+ testStore = {},
+ testSnapshot = {};
+ let host = adapter.host;
+ let testId = "localhost:8042" + Constants.PARAM_SEPARATOR +
+ "container_e27_11111111111_0001_01_000001" + Constants.PARAM_SEPARATOR +
+ "syslog";
+ assert.expect(2);
+
+ adapter.ajax = function (url, method) {
+ assert.equal(url, host + "localhost:8042/ws/v1/node/containerlogs/" +
+ "container_e27_11111111111_0001_01_000001/syslog");
+ assert.equal(method, 'GET');
+ };
+
+ adapter.findRecord(testStore, testModel, testId, testSnapshot);
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-app-test.js
new file mode 100644
index 0000000..3a25996
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-app-test.js
@@ -0,0 +1,93 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('adapter:yarn-node-app', 'Unit | Adapter | NodeApp', {
+});
+
+test('Basic creation', function(assert) {
+ let adapter = this.subject();
+ assert.expect(11);
+ assert.ok(adapter);
+ assert.ok(adapter.urlForQueryRecord);
+ assert.ok(adapter.queryRecord);
+ assert.ok(adapter.urlForQuery);
+ assert.ok(adapter.query);
+ assert.ok(adapter.ajax);
+ assert.ok(adapter.headers);
+ assert.ok(adapter.host);
+ assert.ok(adapter.namespace);
+ assert.equal("application/json", adapter.headers.Accept);
+ assert.equal("ws/v1/node", adapter.namespace);
+});
+
+test('urlForQueryRecord test', function(assert) {
+ let adapter = this.subject();
+ let host = adapter.host;
+ assert.equal(
+ host + "localhost:8042/ws/v1/node/apps/application_1111111111_1111",
+ adapter.urlForQueryRecord(
+ {nodeAddr: "localhost:8042", appId: "application_1111111111_1111"}));
+});
+
+test('urlForQuery test', function(assert) {
+ let adapter = this.subject();
+ let host = adapter.host;
+ assert.equal(host + "localhost:8042/ws/v1/node/apps",
+ adapter.urlForQuery({nodeAddr: "localhost:8042"}));
+});
+
+test('query test', function(assert) {
+ let adapter = this.subject(),
+ testModel = { modelName: "testModel" },
+ testStore = {},
+ testQuery = {nodeAddr: "localhost:8042"};
+ let host = adapter.host;
+ assert.expect(3);
+
+ adapter.ajax = function (url, method, hash) {
+ assert.equal(host + "localhost:8042/ws/v1/node/apps", url);
+ assert.equal('GET', method);
+ assert.equal(null, hash.data);
+ };
+
+ adapter.query(testStore, testModel, testQuery);
+});
+
+test('queryRecord test', function(assert) {
+ let adapter = this.subject(),
+ testModel = { modelName: "testModel" },
+ testStore = {},
+ testQuery = {
+ nodeAddr: "localhost:8042",
+ appId: "application_1111111111_1111"
+ };
+ let host = adapter.host;
+ assert.expect(3);
+
+ adapter.ajax = function (url, method, hash) {
+ assert.equal(
+ host + "localhost:8042/ws/v1/node/apps/application_1111111111_1111",
+ url);
+ assert.equal('GET', method);
+ assert.equal(null, hash.data);
+ };
+
+ adapter.queryRecord(testStore, testModel, testQuery);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-container-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-container-test.js
new file mode 100644
index 0000000..7d2bb2d
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-container-test.js
@@ -0,0 +1,93 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('adapter:yarn-node-container', 'Unit | Adapter | NodeContainer', {
+});
+
+test('Basic creation', function(assert) {
+ let adapter = this.subject();
+ assert.expect(11);
+ assert.ok(adapter);
+ assert.ok(adapter.urlForQueryRecord);
+ assert.ok(adapter.queryRecord);
+ assert.ok(adapter.urlForQuery);
+ assert.ok(adapter.query);
+ assert.ok(adapter.ajax);
+ assert.ok(adapter.headers);
+ assert.ok(adapter.host);
+ assert.ok(adapter.namespace);
+ assert.equal("application/json", adapter.headers.Accept);
+ assert.equal("ws/v1/node", adapter.namespace);
+});
+
+test('urlForQueryRecord test', function(assert) {
+ let adapter = this.subject();
+ let host = adapter.host;
+ assert.equal(host + "localhost:8042/ws/v1/node/containers/" +
+ "container_e27_11111111111_0001_01_000001",
+ adapter.urlForQueryRecord(
+ {nodeHttpAddr: "localhost:8042",
+ containerId: "container_e27_11111111111_0001_01_000001"}));
+});
+
+test('urlForQuery test', function(assert) {
+ let adapter = this.subject();
+ let host = adapter.host;
+ assert.equal(host + "localhost:8042/ws/v1/node/containers",
+ adapter.urlForQuery({nodeHttpAddr: "localhost:8042"}));
+});
+
+test('query test', function(assert) {
+ let adapter = this.subject(),
+ testModel = { modelName: "testModel" },
+ testStore = {},
+ testQuery = {nodeHttpAddr: "localhost:8042"};
+ let host = adapter.host;
+ assert.expect(3);
+
+ adapter.ajax = function (url, method, hash) {
+ assert.equal(host + "localhost:8042/ws/v1/node/containers", url);
+ assert.equal('GET', method);
+ assert.equal(null, hash.data);
+ };
+
+ adapter.query(testStore, testModel, testQuery);
+});
+
+test('queryRecord test', function(assert) {
+ let adapter = this.subject(),
+ testModel = { modelName: "testModel" },
+ testStore = {},
+ testQuery = {
+ nodeHttpAddr: "localhost:8042",
+ containerId: "container_e27_11111111111_0001_01_000001"
+ };
+ let host = adapter.host;
+ assert.expect(3);
+
+ adapter.ajax = function (url, method, hash) {
+ assert.equal(host + "localhost:8042/ws/v1/node/containers/" +
+ "container_e27_11111111111_0001_01_000001", url);
+ assert.equal('GET', method);
+ assert.equal(null, hash.data);
+ };
+
+ adapter.queryRecord(testStore, testModel, testQuery);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-test.js
new file mode 100644
index 0000000..15aefef
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-test.js
@@ -0,0 +1,42 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('adapter:yarn-node', 'Unit | Adapter | Node', {
+});
+
+test('Basic creation', function(assert) {
+ let adapter = this.subject();
+
+ assert.ok(adapter);
+ assert.ok(adapter.urlForFindRecord);
+ assert.ok(adapter.ajax);
+ assert.ok(adapter.headers);
+ assert.ok(adapter.host);
+ assert.ok(adapter.namespace);
+ assert.equal(adapter.headers.Accept, "application/json");
+ assert.equal(adapter.namespace, "ws/v1/node");
+});
+
+test('urlForFindRecord test', function(assert) {
+ let adapter = this.subject();
+ let host = adapter.host;
+ assert.equal(adapter.urlForFindRecord("localhost:8042"),
+ host + "localhost:8042/ws/v1/node");
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-rm-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-rm-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-rm-node-test.js
new file mode 100644
index 0000000..bf009d4
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-rm-node-test.js
@@ -0,0 +1,44 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('adapter:yarn-rm-node', 'Unit | Adapter | RMNode', {
+ // Specify the other units that are required for this test.
+ // needs: ['serializer:foo']
+});
+
+test('Basic creation', function(assert) {
+ let adapter = this.subject();
+
+ assert.ok(adapter);
+ assert.ok(adapter.urlForFindRecord);
+ assert.ok(adapter.ajax);
+ assert.ok(adapter.headers);
+ assert.ok(adapter.host);
+ assert.ok(adapter.namespace);
+ assert.equal(adapter.headers.Accept, "application/json");
+ assert.equal(adapter.namespace, "ws/v1/cluster");
+});
+
+test('urlForFindRecord test', function(assert) {
+ let adapter = this.subject();
+ let host = adapter.host;
+ assert.equal(adapter.urlForFindRecord("localhost:8042"),
+ host + "/ws/v1/cluster/nodes/localhost:8042");
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-container-log-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-container-log-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-container-log-test.js
new file mode 100644
index 0000000..45808a5
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-container-log-test.js
@@ -0,0 +1,48 @@
+/**
+ * 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.
+ */
+
+import { moduleForModel, test } from 'ember-qunit';
+
+moduleForModel('yarn-container-log', 'Unit | Model | ContainerLog', {
+ // Specify the other units that are required for this test.
+ needs: []
+});
+
+test('Basic creation test', function(assert) {
+ let model = this.subject();
+ assert.ok(model);
+ assert.ok(model._notifyProperties);
+ assert.ok(model.didLoad);
+ assert.ok(model.logs);
+ assert.ok(model.containerID);
+ assert.ok(model.logFileName);
+});
+
+test('test fields', function(assert) {
+ let model = this.subject();
+
+ Ember.run(function () {
+ model.set("logs", "This is syslog");
+ model.set("containerID", "container_e32_1456000363780_0002_01_000001");
+ model.set("logFileName", "syslog");
+ assert.equal(model.get("logs"), "This is syslog");
+ assert.equal(model.get("containerID"), "container_e32_1456000363780_0002_01_000001");
+ assert.equal(model.get("logFileName"), "syslog");
+ });
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-app-test.js
new file mode 100644
index 0000000..7e2e62f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-app-test.js
@@ -0,0 +1,65 @@
+/**
+ * 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.
+ */
+
+import { moduleForModel, test } from 'ember-qunit';
+
+moduleForModel('yarn-node-app', 'Unit | Model | NodeApp', {
+ // Specify the other units that are required for this test.
+ needs: []
+});
+
+test('Basic creation test', function(assert) {
+ let model = this.subject();
+
+ assert.ok(model);
+ assert.ok(model._notifyProperties);
+ assert.ok(model.didLoad);
+ assert.ok(model.appId);
+ assert.ok(model.state);
+ assert.ok(model.user);
+ assert.ok(model.containers);
+});
+
+test('test fields', function(assert) {
+ let model = this.subject();
+
+ assert.expect(9);
+ Ember.run(function () {
+ model.set("appId", "application_1456251210105_0002");
+ model.set("id", "application_1456251210105_0002");
+ model.set("state", "RUNNING");
+ model.set("user", "hadoop");
+ model.set("containers", ["container_e38_1456251210105_0002_01_000001",
+ "container_e38_1456251210105_0002_01_000002"]);
+ assert.equal(model.get("appId"), "application_1456251210105_0002");
+ assert.equal(model.get("state"), "RUNNING");
+ assert.equal(model.get("user"), "hadoop");
+ assert.deepEqual(model.get("containers"),
+ ["container_e38_1456251210105_0002_01_000001",
+ "container_e38_1456251210105_0002_01_000002"]);
+ assert.equal(model.get("appStateStyle"), "label label-primary");
+ assert.equal(model.get("isDummyApp"), false);
+ model.set("id", "dummy");
+ assert.equal(model.get("isDummyApp"), true);
+ model.set("state", "FINISHED");
+ assert.equal(model.get("appStateStyle"), "label label-success");
+ model.set("state", "NEW");
+ assert.equal(model.get("appStateStyle"), "label label-default");
+ });
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-container-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-container-test.js
new file mode 100644
index 0000000..88bf233
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-container-test.js
@@ -0,0 +1,78 @@
+/**
+ * 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.
+ */
+
+import { moduleForModel, test } from 'ember-qunit';
+
+moduleForModel('yarn-node-container', 'Unit | Model | NodeContainer', {
+ // Specify the other units that are required for this test.
+ needs: []
+});
+
+test('Basic creation test', function(assert) {
+ let model = this.subject();
+
+ assert.ok(model);
+ assert.ok(model._notifyProperties);
+ assert.ok(model.didLoad);
+ assert.ok(model.containerId);
+ assert.ok(model.state);
+ assert.ok(model.user);
+ assert.ok(model.exitCode);
+ assert.ok(model.totalMemoryNeeded);
+ assert.ok(model.totalVCoresNeeded);
+ assert.ok(model.containerLogFiles);
+ assert.ok(model.isDummyContainer);
+ assert.ok(model.containerStateStyle);
+});
+
+test('test fields', function(assert) {
+ let model = this.subject();
+
+ Ember.run(function () {
+ model.set("containerId", "container_e32_1456000363780_0002_01_000003");
+ model.set("state", "RUNNING");
+ model.set("exitCode", "-1000");
+ model.set("user", "hadoop");
+ model.set("id", "container_e32_1456000363780_0002_01_000003");
+ model.set("totalMemoryNeeded", 1024);
+ model.set("totalVCoresNeeded", 1);
+ model.set("containerLogFiles", ["syslog", "stderr", "stdout"]);
+ assert.equal(model.get("containerId"), "container_e32_1456000363780_0002_01_000003");
+ assert.equal(model.get("id"), "container_e32_1456000363780_0002_01_000003");
+ assert.equal(model.get("totalMemoryNeeded"), 1024);
+ assert.equal(model.get("totalVCoresNeeded"), 1);
+ assert.equal(model.get("user"), "hadoop");
+ assert.equal(model.get("exitCode"), "-1000");
+ assert.equal(model.get("containerLogFiles").length, 3);
+ assert.deepEqual(model.get("containerLogFiles"), ["syslog", "stderr", "stdout"]);
+ assert.equal(model.get("isDummyContainer"), false);
+ assert.equal(model.get("containerStateStyle"), "label label-primary");
+ model.set("id", "dummy");
+ assert.equal(model.get("isDummyContainer"), true);
+ model.set("state", "EXITED_WITH_SUCCESS");
+ assert.equal(model.get("containerStateStyle"), "label label-success");
+ model.set("state", "EXITED_WITH_FAILURE");
+ assert.equal(model.get("containerStateStyle"), "label label-danger");
+ model.set("state", "DONE");
+ model.set("exitCode", "0");
+ assert.equal(model.get("containerStateStyle"), "label label-success");
+ model.set("exitCode", "-105");
+ assert.equal(model.get("containerStateStyle"), "label label-danger");
+ });
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-test.js
new file mode 100644
index 0000000..5877589
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-test.js
@@ -0,0 +1,58 @@
+/**
+ * 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.
+ */
+
+import { moduleForModel, test } from 'ember-qunit';
+
+moduleForModel('yarn-node', 'Unit | Model | Node', {
+ // Specify the other units that are required for this test.
+ needs: []
+});
+
+test('Basic creation test', function(assert) {
+ let model = this.subject();
+
+ assert.ok(model);
+ assert.ok(model._notifyProperties);
+ assert.ok(model.didLoad);
+ assert.ok(model.totalVmemAllocatedContainersMB);
+ assert.ok(model.vmemCheckEnabled);
+ assert.ok(model.pmemCheckEnabled);
+ assert.ok(model.nodeHealthy);
+ assert.ok(model.lastNodeUpdateTime);
+ assert.ok(model.healthReport);
+ assert.ok(model.nmStartupTime);
+ assert.ok(model.nodeManagerBuildVersion);
+ assert.ok(model.hadoopBuildVersion);
+});
+
+test('test fields', function(assert) {
+ let model = this.subject();
+
+ assert.expect(4);
+ Ember.run(function () {
+ model.set("totalVmemAllocatedContainersMB", 4096);
+ model.set("totalPmemAllocatedContainersMB", 2048);
+ model.set("totalVCoresAllocatedContainers", 4);
+ model.set("hadoopBuildVersion", "3.0.0-SNAPSHOT");
+ assert.equal(model.get("totalVmemAllocatedContainersMB"), 4096);
+ assert.equal(model.get("totalPmemAllocatedContainersMB"), 2048);
+ assert.equal(model.get("totalVCoresAllocatedContainers"), 4);
+ assert.equal(model.get("hadoopBuildVersion"), "3.0.0-SNAPSHOT");
+ });
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-rm-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-rm-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-rm-node-test.js
new file mode 100644
index 0000000..4fd2517
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-rm-node-test.js
@@ -0,0 +1,95 @@
+/**
+ * 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.
+ */
+
+import { moduleForModel, test } from 'ember-qunit';
+
+moduleForModel('yarn-rm-node', 'Unit | Model | RMNode', {
+ // Specify the other units that are required for this test.
+ needs: []
+});
+
+test('Basic creation test', function(assert) {
+ let model = this.subject();
+
+ assert.ok(model);
+ assert.ok(model._notifyProperties);
+ assert.ok(model.didLoad);
+ assert.ok(model.rack);
+ assert.ok(model.state);
+ assert.ok(model.nodeHostName);
+ assert.ok(model.nodeHTTPAddress);
+ assert.ok(model.lastHealthUpdate);
+ assert.ok(model.healthReport);
+ assert.ok(model.numContainers);
+ assert.ok(model.usedMemoryMB);
+ assert.ok(model.availMemoryMB);
+ assert.ok(model.usedVirtualCores);
+ assert.ok(model.availableVirtualCores);
+ assert.ok(model.version);
+ assert.ok(model.nodeLabels);
+ assert.ok(model.nodeLabelsAsString);
+ assert.ok(model.nodeStateStyle);
+ assert.ok(model.isDummyNode);
+ assert.ok(model.getMemoryDataForDonutChart);
+ assert.ok(model.getVCoreDataForDonutChart);
+});
+
+test('test fields', function(assert) {
+ let model = this.subject();
+
+ Ember.run(function () {
+ model.set("rack", "/default-rack");
+ model.set("state", "RUNNING");
+ model.set("nodeHostName", "localhost");
+ model.set("id", "localhost:64318");
+ model.set("nodeHTTPAddress", "localhost:8042");
+ model.set("usedMemoryMB", 1024);
+ model.set("availMemoryMB", 7168);
+ model.set("usedVirtualCores", 1);
+ model.set("availableVirtualCores", 7);
+ model.set("nodeLabels", ["x"]);
+ assert.equal(model.get("rack"), "/default-rack");
+ assert.equal(model.get("state"), "RUNNING");
+ assert.equal(model.get("nodeHostName"), "localhost");
+ assert.equal(model.get("id"), "localhost:64318");
+ assert.equal(model.get("nodeHTTPAddress"), "localhost:8042");
+ assert.equal(model.get("usedMemoryMB"), 1024);
+ assert.equal(model.get("availMemoryMB"), 7168);
+ assert.equal(model.get("usedVirtualCores"), 1);
+ assert.equal(model.get("availableVirtualCores"), 7);
+ assert.equal(model.get("isDummyNode"), false);
+ assert.deepEqual(model.get("nodeLabels"), ["x"]);
+ assert.equal(model.get("nodeLabelsAsString"), "x");
+ assert.deepEqual(model.get("nodeStateStyle"), "label label-success");
+ assert.deepEqual(model.get("getMemoryDataForDonutChart"),
+ [{label: "Used", value: 1024}, {label: "Available", value: 7168}]);
+ assert.deepEqual(model.get("getVCoreDataForDonutChart"),
+ [{label: "Used", value: 1}, {label: "Available", value: 7}]);
+ model.set("state", "SHUTDOWN");
+ assert.deepEqual(model.get("nodeStateStyle"), "label label-danger");
+ model.set("state", "REBOOTED");
+ assert.deepEqual(model.get("nodeStateStyle"), "label label-warning");
+ model.set("state", "NEW");
+ assert.deepEqual(model.get("nodeStateStyle"), "label label-default");
+ model.set("nodeLabels", ["x","y"]);
+ assert.equal(model.get("nodeLabelsAsString"), "x");
+ model.set("nodeLabels", undefined);
+ assert.equal(model.get("nodeLabelsAsString"), "");
+ });
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-container-log-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-container-log-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-container-log-test.js
new file mode 100644
index 0000000..4e68da0
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-container-log-test.js
@@ -0,0 +1,120 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+import Constants from 'yarn-ui/constants';
+
+moduleFor('route:yarn-container-log', 'Unit | Route | ContainerLog', {
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+});
+
+test('Test getting container log', function(assert) {
+ var response = {
+ logs: "This is syslog",
+ containerID: "container_e32_1456000363780_0002_01_000001",
+ logFileName: "syslog"};
+ var store = {
+ findRecord: function(type) {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response);
+ }
+ )}
+ };
+ assert.expect(6);
+ var route = this.subject();
+ route.set('store', store);
+ var model = route.model({node_id: "localhost:64318",
+ node_addr: "localhost:8042",
+ container_id: "container_e32_1456000363780_0002_01_000001",
+ filename: "syslog"});
+ model.then(function(value) {
+ assert.ok(value);
+ assert.ok(value.containerLog);
+ assert.deepEqual(value.containerLog, response);
+ assert.ok(value.nodeInfo);
+ assert.equal(value.nodeInfo.addr, 'localhost:8042');
+ assert.equal(value.nodeInfo.id, 'localhost:64318');
+ });
+});
+
+/**
+ * This can happen when an empty response is sent from server
+ */
+test('Test non HTTP error while getting container log', function(assert) {
+ var error = {};
+ var response = {
+ logs: "",
+ containerID: "container_e32_1456000363780_0002_01_000001",
+ logFileName: "syslog"};
+ var store = {
+ findRecord: function(type) {
+ return new Ember.RSVP.Promise(function(resolve, reject) {
+ reject(error);
+ }
+ )}
+ };
+ assert.expect(6);
+ var route = this.subject();
+ route.set('store', store);
+ var model = route.model({node_id: "localhost:64318",
+ node_addr: "localhost:8042",
+ container_id: "container_e32_1456000363780_0002_01_000001",
+ filename: "syslog"});
+ model.then(function(value) {
+ assert.ok(value);
+ assert.ok(value.containerLog);
+ assert.deepEqual(value.containerLog, response);
+ assert.ok(value.nodeInfo);
+ assert.equal(value.nodeInfo.addr, 'localhost:8042');
+ assert.equal(value.nodeInfo.id, 'localhost:64318');
+ });
+});
+
+test('Test HTTP error while getting container log', function(assert) {
+ var error = {errors: [{status: 404, responseText: 'Not Found'}]};
+ var response = {
+ logs: "",
+ containerID: "container_e32_1456000363780_0002_01_000001",
+ logFileName: "syslog"};
+ var store = {
+ findRecord: function(type) {
+ return new Ember.RSVP.Promise(function(resolve, reject) {
+ reject(error);
+ }
+ )}
+ };
+ assert.expect(5);
+ var route = this.subject();
+ route.set('store', store);
+ var model = route.model({node_id: "localhost:64318",
+ node_addr: "localhost:8042",
+ container_id: "container_e32_1456000363780_0002_01_000001",
+ filename: "syslog"});
+ model.then(function(value) {
+ assert.ok(value);
+ assert.ok(value.errors);
+ assert.equal(value.errors.length, 1);
+ assert.equal(value.errors[0].status, 404);
+ assert.equal(value.errors[0].responseText, 'Not Found');
+ });
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-app-test.js
new file mode 100644
index 0000000..8e5acf9
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-app-test.js
@@ -0,0 +1,56 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:yarn-node-app', 'Unit | Route | NodeApp', {
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+});
+
+test('Test getting specific app on a node', function(assert) {
+ var response =
+ {id:"application_1456251210105_0001", state:"FINISHED", user:"root"};
+ var store = {
+ queryRecord: function(type, query) {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response);
+ });
+ }
+ };
+ assert.expect(6);
+ var route = this.subject();
+ route.set('store', store);
+ var model =
+ route.model({node_id:"localhost:64318", node_addr:"localhost:8042",
+ app_id:"application_1456251210105_0001"}).
+ then(
+ function(value){
+ assert.ok(value);
+ assert.ok(value.nodeApp);
+ assert.deepEqual(value.nodeApp, response);
+ assert.ok(value.nodeInfo);
+ assert.equal(value.nodeInfo.addr, 'localhost:8042');
+ assert.equal(value.nodeInfo.id, 'localhost:64318');
+ }
+ );
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-apps-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-apps-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-apps-test.js
new file mode 100644
index 0000000..44d9995
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-apps-test.js
@@ -0,0 +1,60 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:yarn-node-apps', 'Unit | Route | NodeApps', {
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+});
+
+test('Test getting apps on a node', function(assert) {
+ var response = [
+ {id:"application_1456251210105_0001", state:"FINISHED", user:"root"},
+ {id:"application_1456251210105_0002", state:"RUNNING",user:"root",
+ containerids:["container_e38_1456251210105_0002_01_000001",
+ "container_e38_1456251210105_0002_01_000002"]}];
+ var store = {
+ query: function(type, query) {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response.slice());
+ });
+ }
+ };
+ assert.expect(8);
+ var route = this.subject();
+ route.set('store', store);
+ var model =
+ route.model({node_id:"localhost:64318", node_addr:"localhost:8042"}).
+ then(
+ function(value){
+ assert.ok(value);
+ assert.ok(value.apps);
+ assert.equal(value.apps.length, 2);
+ assert.deepEqual(response[0], value.apps[0]);
+ assert.deepEqual(response[1], value.apps[1]);
+ assert.ok(value.nodeInfo);
+ assert.equal(value.nodeInfo.addr, 'localhost:8042');
+ assert.equal(value.nodeInfo.id, 'localhost:64318');
+ }
+ );
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-container-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-container-test.js
new file mode 100644
index 0000000..f0b68fc
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-container-test.js
@@ -0,0 +1,61 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:yarn-node-container', 'Unit | Route | NodeContainer', {
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+});
+
+test('Test getting specific container on a node', function(assert) {
+ var response =
+ {id: "container_e32_1456000363780_0002_01_000001", state: "RUNNING",
+ exitCode:-1000,diagnostics:"",user:"root",totalMemoryNeededMB:2048,
+ totalVCoresNeeded:1,containerLogsLink: "http://localhost:8042/node/" +
+ "containerlogs/container_e32_1456000363780_0002_01_000001/root",
+ nodeId: "localhost:64318", containerLogFiles:["syslog","stderr",
+ "stdout"]};
+ var store = {
+ queryRecord: function(type, query) {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response);
+ });
+ }
+ };
+ assert.expect(6);
+ var route = this.subject();
+ route.set('store', store);
+ var model =
+ route.model({node_id:"localhost:64318", node_addr:"localhost:8042",
+ container_id:"container_e32_1456000363780_0002_01_000001"}).
+ then(
+ function(value){
+ assert.ok(value);
+ assert.ok(value.nodeContainer);
+ assert.deepEqual(value.nodeContainer, response);
+ assert.ok(value.nodeInfo);
+ assert.equal(value.nodeInfo.addr, 'localhost:8042');
+ assert.equal(value.nodeInfo.id, 'localhost:64318');
+ }
+ );
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-containers-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-containers-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-containers-test.js
new file mode 100644
index 0000000..8359713
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-containers-test.js
@@ -0,0 +1,68 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:yarn-node-containers', 'Unit | Route | NodeContainers', {
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+});
+
+test('Test getting apps on a node', function(assert) {
+ var response =
+ [{id: "container_e32_1456000363780_0002_01_000001", state: "RUNNING",
+ exitCode:-1000,diagnostics:"",user:"root",totalMemoryNeededMB:2048,
+ totalVCoresNeeded:1,containerLogsLink: "http://localhost:8042/node/" +
+ "containerlogs/container_e32_1456000363780_0002_01_000001/root",
+ nodeId: "localhost:64318", containerLogFiles:["syslog","stderr",
+ "stdout"]},
+ {id:"container_e32_1456000363780_0002_01_000003", state:"RUNNING",
+ exitCode:-1000, diagnostics:"", user:"root", totalMemoryNeededMB:1024,
+ totalVCoresNeeded:1,containerLogsLink:"http://localhost:8042/node" +
+ "/containerlogs/container_e32_1456000363780_0002_01_000003/root",
+ nodeId:"localhost:64318",containerLogFiles:["syslog","stderr",
+ "syslog.shuffle","stdout"]}];
+ var store = {
+ query: function(type, query) {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response.slice());
+ });
+ }
+ };
+ assert.expect(8);
+ var route = this.subject();
+ route.set('store', store);
+ var model =
+ route.model({node_id:"localhost:64318", node_addr:"localhost:8042"}).
+ then(
+ function(value){
+ assert.ok(value);
+ assert.ok(value.containers);
+ assert.equal(value.containers.length, 2);
+ assert.deepEqual(value.containers[0], response[0]);
+ assert.deepEqual(value.containers[1], response[1]);
+ assert.ok(value.nodeInfo);
+ assert.equal(value.nodeInfo.addr, 'localhost:8042');
+ assert.equal(value.nodeInfo.id, 'localhost:64318');
+ }
+ );
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-test.js
new file mode 100644
index 0000000..4e82f1b
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-test.js
@@ -0,0 +1,84 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+import Ember from 'ember';
+
+moduleFor('route:yarn-node', 'Unit | Route | Node', {
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+});
+
+test('Test getting a node', function(assert) {
+ var nodeResponse =
+ {healthReport: "Healthy", totalVmemAllocatedContainersMB: 344064,
+ totalPmemAllocatedContainersMB: 163840,
+ totalVCoresAllocatedContainers: 160,
+ vmemCheckEnabled: true, pmemCheckEnabled: true,
+ lastNodeUpdateTime: 1456250210310, nodeHealthy: true,
+ nodeManagerVersion: "3.0.0-SNAPSHOT",
+ nodeManagerBuildVersion: "3.0.0-SNAPSHOT",
+ nodeManagerVersionBuiltOn: "2000-01-01T00:00Z",
+ hadoopVersion: "3.0.0-SNAPSHOT",
+ hadoopBuildVersion: "3.0.0-SNAPSHOT",
+ hadoopVersionBuiltOn: "2000-01-01T00:00Z",
+ id: "localhost:64318", nodeHostName: "192.168.0.102",
+ nmStartupTime: 1456250208231};
+ var rmNodeResponse =
+ {rack: "/default-rack", state: "RUNNING", id: "localhost:64318",
+ nodeHostName: "localhost", nodeHTTPAddress: "localhost:8042",
+ lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
+ healthReport: "", numContainers: 0, usedMemoryMB: 0,
+ availMemoryMB: 163840, usedVirtualCores: 0,
+ availableVirtualCores: 160,
+ resourceUtilization: {
+ nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
+ nodeCPUUsage: 0.14995001256465912,
+ aggregatedContainersPhysicalMemoryMB: 0,
+ aggregatedContainersVirtualMemoryMB: 0,
+ containersCPUUsage: 0
+ }};
+
+ // Create store which returns appropriate responses.
+ var store = {
+ findRecord: function(type) {
+ if (type == 'yarnNode') {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(nodeResponse);
+ });
+ } else if (type == 'yarnRmNode') {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(rmNodeResponse);
+ });
+ }
+ }
+ };
+ var route = this.subject();
+ assert.expect(4);
+ route.set('store', store);
+ var model = route.model(
+ {node_addr:"localhost:8042", node_id:"localhost:64318"})._result;
+ assert.ok(model.node);
+ assert.deepEqual(model.node, nodeResponse);
+ assert.ok(model.rmNode);
+ assert.deepEqual(model.rmNode, rmNodeResponse);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-nodes-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-nodes-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-nodes-test.js
new file mode 100644
index 0000000..baa5bd6
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-nodes-test.js
@@ -0,0 +1,74 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+import Ember from 'ember';
+
+moduleFor('route:yarn-nodes', 'Unit | Route | Nodes', {
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+});
+
+test('Test getting nodes', function(assert) {
+ var response = [{
+ rack: "/default-rack", state: "RUNNING", id: "192.168.1.1:64318",
+ nodeHostName: "192.168.1.1", nodeHTTPAddress: "192.168.1.1:8042",
+ lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
+ healthReport: "", numContainers: 0, usedMemoryMB: 0,
+ availMemoryMB: 163840, usedVirtualCores: 0,
+ availableVirtualCores: 160,
+ resourceUtilization: {
+ nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
+ nodeCPUUsage: 0.14995001256465912,
+ aggregatedContainersPhysicalMemoryMB: 0,
+ aggregatedContainersVirtualMemoryMB: 0,
+ containersCPUUsage: 0
+ }},
+ {rack: "/default-rack", state: "RUNNING", id: "192.168.1.2:64318",
+ nodeHostName: "192.168.1.2", nodeHTTPAddress: "192.168.1.2:8042",
+ lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
+ healthReport: "", numContainers: 0, usedMemoryMB: 0,
+ availMemoryMB: 163840, usedVirtualCores: 0,
+ availableVirtualCores: 160,
+ resourceUtilization: {
+ nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
+ nodeCPUUsage: 0.14995001256465912,
+ aggregatedContainersPhysicalMemoryMB: 0,
+ aggregatedContainersVirtualMemoryMB: 0,
+ containersCPUUsage: 0
+ }}];
+ var store = {
+ findAll: function(type) {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response);
+ });
+ }
+ };
+ var route = this.subject();
+ route.set('store', store);
+ var model = route.model()._result;
+ assert.expect(4);
+ assert.ok(model);
+ assert.equal(model.length, 2);
+ assert.deepEqual(response[0], model[0]);
+ assert.deepEqual(response[1], model[1]);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-container-log-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-container-log-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-container-log-test.js
new file mode 100644
index 0000000..2349dc2
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-container-log-test.js
@@ -0,0 +1,49 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('serializer:yarn-container-log', 'Unit | Serializer | ContainerLog', {
+});
+
+test('Basic creation test', function(assert) {
+ let serializer = this.subject();
+
+ assert.ok(serializer);
+ assert.ok(serializer.normalizeSingleResponse);
+});
+
+test('normalizeSingleResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-container-log"
+ },
+ payload = "This is syslog";
+ var id = "localhost:64318!container_e32_1456000363780_0002_01_000001!syslog";
+ assert.expect(6);
+ var response =
+ serializer.normalizeSingleResponse({}, modelClass, payload, id, null);
+ assert.ok(response.data);
+ assert.equal(response.data.id, id);
+ assert.equal(response.data.type, modelClass.modelName);
+ assert.equal(response.data.attributes.logs, payload);
+ assert.equal(response.data.attributes.containerID,
+ "container_e32_1456000363780_0002_01_000001");
+ assert.equal(response.data.attributes.logFileName, "syslog");
+});
+
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[33/50] [abbrv] hadoop git commit: YARN-4517. Add nodes page and fix
bunch of license issues. (Varun Saxena via wangda)
Posted by wa...@apache.org.
YARN-4517. Add nodes page and fix bunch of license issues. (Varun Saxena via wangda)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/d5bd55bf
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/d5bd55bf
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/d5bd55bf
Branch: refs/heads/YARN-3368
Commit: d5bd55bf8a741766d0d219fdd037b1e816507fdb
Parents: 906fc27
Author: Wangda Tan <wa...@apache.org>
Authored: Mon Mar 21 13:13:02 2016 -0700
Committer: Wangda Tan <wa...@apache.org>
Committed: Tue Aug 9 14:44:56 2016 -0700
----------------------------------------------------------------------
.../hadoop-yarn-ui/app/adapters/cluster-info.js | 5 +-
.../app/adapters/cluster-metric.js | 5 +-
.../app/adapters/yarn-app-attempt.js | 3 +-
.../hadoop-yarn-ui/app/adapters/yarn-app.js | 3 +-
.../app/adapters/yarn-container-log.js | 74 +++++++++
.../app/adapters/yarn-container.js | 5 +-
.../app/adapters/yarn-node-app.js | 63 ++++++++
.../app/adapters/yarn-node-container.js | 64 ++++++++
.../hadoop-yarn-ui/app/adapters/yarn-node.js | 40 +++++
.../hadoop-yarn-ui/app/adapters/yarn-queue.js | 3 +-
.../hadoop-yarn-ui/app/adapters/yarn-rm-node.js | 45 ++++++
.../app/components/simple-table.js | 38 ++++-
.../hadoop-yarn/hadoop-yarn-ui/app/config.js | 27 ++++
.../hadoop-yarn/hadoop-yarn-ui/app/constants.js | 24 +++
.../app/controllers/application.js | 55 +++++++
.../hadoop-yarn-ui/app/helpers/divide.js | 31 ++++
.../app/helpers/log-files-comma.js | 48 ++++++
.../hadoop-yarn-ui/app/helpers/node-link.js | 37 +++++
.../hadoop-yarn-ui/app/helpers/node-menu.js | 66 ++++++++
.../hadoop-yarn-ui/app/models/yarn-app.js | 14 +-
.../app/models/yarn-container-log.js | 25 +++
.../hadoop-yarn-ui/app/models/yarn-node-app.js | 44 ++++++
.../app/models/yarn-node-container.js | 57 +++++++
.../hadoop-yarn-ui/app/models/yarn-node.js | 33 ++++
.../hadoop-yarn-ui/app/models/yarn-rm-node.js | 92 +++++++++++
.../hadoop-yarn/hadoop-yarn-ui/app/router.js | 13 ++
.../hadoop-yarn-ui/app/routes/application.js | 38 +++++
.../hadoop-yarn-ui/app/routes/index.js | 29 ++++
.../hadoop-yarn-ui/app/routes/yarn-apps.js | 4 +-
.../app/routes/yarn-container-log.js | 55 +++++++
.../hadoop-yarn-ui/app/routes/yarn-node-app.js | 29 ++++
.../hadoop-yarn-ui/app/routes/yarn-node-apps.js | 29 ++++
.../app/routes/yarn-node-container.js | 30 ++++
.../app/routes/yarn-node-containers.js | 28 ++++
.../hadoop-yarn-ui/app/routes/yarn-node.js | 29 ++++
.../hadoop-yarn-ui/app/routes/yarn-nodes.js | 25 +++
.../app/serializers/yarn-container-log.js | 39 +++++
.../app/serializers/yarn-node-app.js | 86 +++++++++++
.../app/serializers/yarn-node-container.js | 74 +++++++++
.../hadoop-yarn-ui/app/serializers/yarn-node.js | 56 +++++++
.../app/serializers/yarn-rm-node.js | 77 ++++++++++
.../app/templates/application.hbs | 4 +-
.../hadoop-yarn-ui/app/templates/error.hbs | 19 +++
.../hadoop-yarn-ui/app/templates/notfound.hbs | 20 +++
.../hadoop-yarn-ui/app/templates/yarn-apps.hbs | 4 +-
.../app/templates/yarn-container-log.hbs | 36 +++++
.../app/templates/yarn-node-app.hbs | 60 ++++++++
.../app/templates/yarn-node-apps.hbs | 51 +++++++
.../app/templates/yarn-node-container.hbs | 70 +++++++++
.../app/templates/yarn-node-containers.hbs | 58 +++++++
.../hadoop-yarn-ui/app/templates/yarn-node.hbs | 94 ++++++++++++
.../hadoop-yarn-ui/app/templates/yarn-nodes.hbs | 65 ++++++++
.../hadoop-yarn-ui/app/utils/converter.js | 21 ++-
.../hadoop-yarn-ui/app/utils/sorter.js | 42 ++++-
.../hadoop-yarn/hadoop-yarn-ui/bower.json | 2 +-
.../hadoop-yarn-ui/config/environment.js | 1 -
.../unit/adapters/yarn-container-log-test.js | 73 +++++++++
.../tests/unit/adapters/yarn-node-app-test.js | 93 +++++++++++
.../unit/adapters/yarn-node-container-test.js | 93 +++++++++++
.../tests/unit/adapters/yarn-node-test.js | 42 +++++
.../tests/unit/adapters/yarn-rm-node-test.js | 44 ++++++
.../unit/models/yarn-container-log-test.js | 48 ++++++
.../tests/unit/models/yarn-node-app-test.js | 65 ++++++++
.../unit/models/yarn-node-container-test.js | 78 ++++++++++
.../tests/unit/models/yarn-node-test.js | 58 +++++++
.../tests/unit/models/yarn-rm-node-test.js | 95 ++++++++++++
.../unit/routes/yarn-container-log-test.js | 120 +++++++++++++++
.../tests/unit/routes/yarn-node-app-test.js | 56 +++++++
.../tests/unit/routes/yarn-node-apps-test.js | 60 ++++++++
.../unit/routes/yarn-node-container-test.js | 61 ++++++++
.../unit/routes/yarn-node-containers-test.js | 68 +++++++++
.../tests/unit/routes/yarn-node-test.js | 84 ++++++++++
.../tests/unit/routes/yarn-nodes-test.js | 74 +++++++++
.../unit/serializers/yarn-container-log-test.js | 49 ++++++
.../unit/serializers/yarn-node-app-test.js | 102 +++++++++++++
.../serializers/yarn-node-container-test.js | 128 ++++++++++++++++
.../tests/unit/serializers/yarn-node-test.js | 69 +++++++++
.../tests/unit/serializers/yarn-rm-node-test.js | 153 +++++++++++++++++++
.../tests/unit/utils/converter-test.js | 48 +++++-
.../tests/unit/utils/sorter-test.js | 26 ++++
80 files changed, 3840 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-info.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-info.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-info.js
index ef65792..5a0d2d3 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-info.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-info.js
@@ -1,10 +1,11 @@
import DS from 'ember-data';
+import Config from 'yarn-ui/config';
export default DS.JSONAPIAdapter.extend({
headers: {
Accept: 'application/json'
},
- host: 'http://localhost:1337/localhost:8088', // configurable
+ host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
namespace: 'ws/v1/cluster', // common const
pathForType(modelName) {
return ''; // move to some common place, return path by modelname.
@@ -16,4 +17,4 @@ export default DS.JSONAPIAdapter.extend({
hash.targetServer = "RM";
return this._super(url, method, hash);
}
-});
\ No newline at end of file
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-metric.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-metric.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-metric.js
index d0f084c..d392c9b 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-metric.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-metric.js
@@ -1,10 +1,11 @@
import DS from 'ember-data';
+import Config from 'yarn-ui/config';
export default DS.JSONAPIAdapter.extend({
headers: {
Accept: 'application/json'
},
- host: 'http://localhost:1337/localhost:8088', // configurable
+ host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
namespace: 'ws/v1/cluster/metrics', // common const
pathForType(modelName) {
return ''; // move to some common place, return path by modelname.
@@ -16,4 +17,4 @@ export default DS.JSONAPIAdapter.extend({
hash.targetServer = "RM";
return this._super(url, method, hash);
}
-});
\ No newline at end of file
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app-attempt.js
index 3c95d64..4e40744 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app-attempt.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app-attempt.js
@@ -1,11 +1,12 @@
import DS from 'ember-data';
import Converter from 'yarn-ui/utils/converter';
+import Config from 'yarn-ui/config';
export default DS.JSONAPIAdapter.extend({
headers: {
Accept: 'application/json'
},
- host: 'http://localhost:1337/localhost:8088', // configurable
+ host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
namespace: 'ws/v1/cluster', // common const
urlForQuery(query, modelName) {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app.js
index e1108be..faff3e7 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app.js
@@ -1,10 +1,11 @@
import DS from 'ember-data';
+import Config from 'yarn-ui/config';
export default DS.JSONAPIAdapter.extend({
headers: {
Accept: 'application/json'
},
- host: 'http://localhost:1337/localhost:8088', // configurable
+ host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
namespace: 'ws/v1/cluster', // common const
pathForType(modelName) {
return 'apps'; // move to some common place, return path by modelname.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container-log.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container-log.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container-log.js
new file mode 100644
index 0000000..7838c98
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container-log.js
@@ -0,0 +1,74 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Ember from 'ember';
+import Converter from 'yarn-ui/utils/converter';
+
+/**
+ * REST URL's response when fetching container logs will be
+ * in plain text format and not JSON.
+ */
+export default DS.RESTAdapter.extend({
+ headers: {
+ Accept: 'text/plain'
+ },
+ host: 'http://localhost:1337/',
+ namespace: 'ws/v1/node',
+
+ urlForFindRecord(id, modelName, snapshot) {
+ var splits = Converter.splitForContainerLogs(id);
+ var nodeHttpAddr = splits[0];
+ var containerId = splits[1];
+ var filename = splits[2];
+ this.host = this.host + nodeHttpAddr;
+ var url = this._buildURL();
+ url = url + "/containerlogs/" + containerId + "/" + filename;
+ return url;
+ },
+
+ ajax(url, method, hash) {
+ hash = hash || {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "NM";
+ return this._super(url, method, hash);
+ },
+
+ /**
+ * Override options so that result is not expected to be JSON
+ */
+ ajaxOptions: function (url, type, options) {
+ var hash = options || {};
+ hash.url = url;
+ hash.type = type;
+ // Make sure jQuery does not try to convert response to JSON.
+ hash.dataType = 'text';
+ hash.context = this;
+
+ var headers = Ember.get(this, 'headers');
+ if (headers != undefined) {
+ hash.beforeSend = function (xhr) {
+ Object.keys(headers).forEach(function (key) {
+ return xhr.setRequestHeader(key, headers[key]);
+ });
+ };
+ }
+ return hash;
+ },
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container.js
index fe09f59..d941c38 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container.js
@@ -1,12 +1,13 @@
import DS from 'ember-data';
import Converter from 'yarn-ui/utils/converter';
+import Config from 'yarn-ui/config';
export default DS.JSONAPIAdapter.extend({
headers: {
Accept: 'application/json'
},
- rmHost: 'http://localhost:1337/localhost:8088',
- tsHost: 'http://localhost:1337/localhost:8188',
+ rmHost: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT,
+ tsHost: 'http://localhost:1337/' + Config.TS_HOST + ':' + Config.TS_PORT,
host: function() {
return undefined
}.property(),
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-app.js
new file mode 100644
index 0000000..0c60d1f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-app.js
@@ -0,0 +1,63 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.JSONAPIAdapter.extend({
+ headers: {
+ Accept: 'application/json'
+ },
+ host: 'http://localhost:1337/',
+ namespace: 'ws/v1/node',
+
+ urlForQuery(query) {
+ this.host = this.host + query.nodeAddr;
+ var url = this._buildURL();
+ url = url + "/apps";
+ return url;
+ },
+
+ urlForQueryRecord: function (query) {
+ this.host = this.host + query.nodeAddr;
+ var url = this._buildURL();
+ url = url + "/apps/" + query.appId;
+ return url;
+ },
+
+ query: function (store, type, query) {
+ var url = this.urlForQuery(query);
+ // Query params not required.
+ query = null;
+ return this.ajax(url, 'GET', { data: query });
+ },
+
+ queryRecord: function (store, type, query) {
+ var url = this.urlForQueryRecord(query);
+ // Query params not required.
+ query = null;
+ return this.ajax(url, 'GET', { data: query });
+ },
+
+ ajax(url, method, hash) {
+ hash = hash || {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "NM";
+ return this._super(url, method, hash);
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-container.js
new file mode 100644
index 0000000..e8bf7b7
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-container.js
@@ -0,0 +1,64 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.JSONAPIAdapter.extend({
+ headers: {
+ Accept: 'application/json'
+ },
+ host: 'http://localhost:1337/',
+ namespace: 'ws/v1/node',
+
+ urlForQuery(query) {
+ this.host = this.host + query.nodeHttpAddr;
+ var url = this._buildURL();
+ url = url + "/containers";
+ return url;
+ },
+
+ urlForQueryRecord(query) {
+ this.host = this.host + query.nodeHttpAddr;
+ var url = this._buildURL();
+ url = url + "/containers/" + query.containerId;
+ return url;
+ },
+
+ query: function (store, type, query) {
+ var url = this.urlForQuery(query);
+ // Query params not required.
+ query = null;
+ return this.ajax(url, 'GET', { data: query });
+ },
+
+ queryRecord: function (store, type, query) {
+ var url = this.urlForQueryRecord(query);
+ // Query params not required.
+ query = null;
+ console.log(url);
+ return this.ajax(url, 'GET', { data: query });
+ },
+
+ ajax(url, method, hash) {
+ hash = hash || {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "NM";
+ return this._super(url, method, hash);
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node.js
new file mode 100644
index 0000000..64f524a
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node.js
@@ -0,0 +1,40 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.JSONAPIAdapter.extend({
+ headers: {
+ Accept: 'application/json'
+ },
+ host: 'http://localhost:1337/',
+ namespace: 'ws/v1/node',
+
+ urlForFindRecord(id, modelName, snapshot) {
+ this.host = this.host + id;
+ var url = this._buildURL();
+ return url;
+ },
+ ajax(url, method, hash) {
+ hash = hash || {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "NM";
+ return this._super(url, method, hash);
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-queue.js
index 39cf796..0f6eb65 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-queue.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-queue.js
@@ -1,10 +1,11 @@
import DS from 'ember-data';
+import Config from 'yarn-ui/config';
export default DS.JSONAPIAdapter.extend({
headers: {
Accept: 'application/json'
},
- host: 'http://localhost:1337/localhost:8088', // configurable
+ host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
namespace: 'ws/v1/cluster', // common const
pathForType(modelName) {
return 'scheduler'; // move to some common place, return path by modelname.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-rm-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-rm-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-rm-node.js
new file mode 100644
index 0000000..c6ad6f3
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-rm-node.js
@@ -0,0 +1,45 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Config from 'yarn-ui/config';
+
+export default DS.JSONAPIAdapter.extend({
+ headers: {
+ Accept: 'application/json'
+ },
+ host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT,
+ namespace: 'ws/v1/cluster',
+ pathForType(modelName) {
+ return 'nodes';
+ },
+
+ urlForFindRecord(id, modelName, snapshot) {
+ var url = this._buildURL();
+ url = url + "/nodes/" + id;
+ return url;
+ },
+
+ ajax(url, method, hash) {
+ hash = hash || {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "RM";
+ return this._super(url, method, hash);
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/simple-table.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/simple-table.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/simple-table.js
index ed8ff9b..447533e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/simple-table.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/simple-table.js
@@ -7,24 +7,52 @@ export default Ember.Component.extend({
var info = this.get("info") ? true : this.get("info");
var bFilter = this.get("bFilter") ? true : this.get("bFilter");
+ // Defines sorter for the columns if not default.
+ // Can also specify a custom sorter.
+ var i;
var colDefs = [];
if (this.get("colTypes")) {
var typesArr = this.get("colTypes").split(' ');
var targetsArr = this.get("colTargets").split(' ');
- for (var i = 0; i < typesArr.length; i++) {
+ for (i = 0; i < typesArr.length; i++) {
+ console.log(typesArr[i] + " " + targetsArr[i]);
colDefs.push({
type: typesArr[i],
targets: parseInt(targetsArr[i])
});
}
}
-
- $('#' + this.get('table-id')).DataTable({
+ // Defines initial column and sort order.
+ var orderArr = [];
+ if (this.get("colsOrder")) {
+ var cols = this.get("colsOrder").split(' ');
+ for (i = 0; i < cols.length; i++) {
+ var col = cols[i].split(',');
+ if (col.length != 2) {
+ continue;
+ }
+ var order = col[1].trim();
+ if (order != 'asc' && order != 'desc') {
+ continue;
+ }
+ var colOrder = [];
+ colOrder.push(parseInt(col[0]));
+ colOrder.push(order);
+ orderArr.push(colOrder);
+ }
+ }
+ if (orderArr.length == 0) {
+ var defaultOrder = [0, 'asc'];
+ orderArr.push(defaultOrder);
+ }
+ console.log(orderArr[0]);
+ Ember.$('#' + this.get('table-id')).DataTable({
"paging": paging,
"ordering": ordering,
"info": info,
"bFilter": bFilter,
- columnDefs: colDefs
+ "order": orderArr,
+ "columnDefs": colDefs
});
}
-});
\ No newline at end of file
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/config.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/config.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/config.js
new file mode 100644
index 0000000..224c65a
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/config.js
@@ -0,0 +1,27 @@
+/**
+ * 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.
+ */
+
+/**
+ * Host and port configurations
+ */
+export default {
+ RM_HOST: 'localhost',
+ RM_PORT: '8088',
+ TS_HOST: 'localhost',
+ TS_PORT: '8188',
+};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/constants.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/constants.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/constants.js
new file mode 100644
index 0000000..d2937a0
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/constants.js
@@ -0,0 +1,24 @@
+/**
+ * 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.
+ */
+
+/**
+ * Application level global constants go here.
+ */
+export default {
+ PARAM_SEPARATOR: '!',
+};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/application.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/application.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/application.js
new file mode 100644
index 0000000..3c68365
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/application.js
@@ -0,0 +1,55 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+/**
+ * Base controller for application.
+ */
+export default Ember.Controller.extend({
+ /**
+ * Output main top UI menu which is common across all pages.
+ * Menu item will be made active based on current path.
+ */
+ outputMainMenu: function(){
+ var path = this.get('currentPath');
+ var html = '<li';
+ if (path == 'yarnQueue') {
+ html = html + ' class="active"';
+ }
+ html = html + '><a href="yarnQueue/root">Queues<span class="sr-only">' +
+ '(current)</span></a></li><li';
+ if (path.lastIndexOf('yarnApp', 0) == 0) {
+ html = html + ' class="active"';
+ }
+ html = html + '><a href="yarnApps">Applications<span class="sr-only">' +
+ '(current)</span></a></li><li';
+ if (path == 'clusterOverview') {
+ html = html + ' class="active"';
+ }
+ html = html + '><a href="clusterOverview">Cluster Overview<span class=' +
+ '"sr-only">(current)</span></a></li><li';
+ if (path.lastIndexOf('yarnNode', 0) == 0) {
+ html = html + ' class="active"';
+ }
+ html = html + '><a href="yarnNodes">Nodes<span class="sr-only">' +
+ '(current)</span></a></li>';
+ return Ember.String.htmlSafe(html);
+ }.property('currentPath')
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/divide.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/divide.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/divide.js
new file mode 100644
index 0000000..fcf64dd
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/divide.js
@@ -0,0 +1,31 @@
+/**
+ * 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.
+ */
+import Ember from 'ember';
+
+/**
+ * Helper assumes values are numeric. num means numerator and
+ * den means denominator.
+ */
+export default Ember.Helper.helper(function(params,hash) {
+ var num = hash.num;
+ var den = hash.den;
+ if (den == 0) {
+ return 0;
+ }
+ return Math.floor(num/den);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/log-files-comma.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/log-files-comma.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/log-files-comma.js
new file mode 100644
index 0000000..8c29b34
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/log-files-comma.js
@@ -0,0 +1,48 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+/**
+ * Represent log files as comma separated list.
+ */
+export default Ember.Helper.helper(function(params,hash) {
+ var logFiles = hash.logFiles;
+ if (logFiles == null) {
+ return "";
+ }
+ var logFilesLen = logFiles.length;
+ if (logFilesLen == 0) {
+ return "";
+ }
+ var nodeId = hash.nodeId;
+ var nodeAddr = hash.nodeAddr;
+ var containerId = hash.containerId;
+ var html = '<td>';
+ var logFilesCommaSeparated = "";
+ for (var i = 0; i < logFilesLen; i++) {
+ html = html + '<a href="yarnContainerLog/' + nodeId + '/' +
+ nodeAddr + '/' + containerId + '/' + logFiles[i] + '">' + logFiles[i] +
+ '</a>';
+ if (i != logFilesLen - 1) {
+ html = html + ",";
+ }
+ }
+ html = html + '</td>';
+ return Ember.String.htmlSafe(html);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-link.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-link.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-link.js
new file mode 100644
index 0000000..99d975b
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-link.js
@@ -0,0 +1,37 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+/**
+ * Generate link to node page if its not SHUTDOWN or LOST.
+ */
+export default Ember.Helper.helper(function(params,hash) {
+ var nodeState = hash.nodeState;
+ var nodeHTTPAddress = hash.nodeHTTPAddress;
+ var nodeId = hash.nodeId;
+ var html = '<td>';
+ if (nodeState == "SHUTDOWN" || nodeState == "LOST") {
+ html = html + nodeHTTPAddress;
+ } else {
+ html = html + '<a href="yarnNode/' + nodeId + "/" + nodeHTTPAddress + '">' +
+ nodeHTTPAddress + '</a>';
+ }
+ html = html + '</td>';
+ return Ember.String.htmlSafe(html);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-menu.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-menu.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-menu.js
new file mode 100644
index 0000000..589111f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-menu.js
@@ -0,0 +1,66 @@
+/**
+ * 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.
+ */
+import Ember from 'ember';
+
+/**
+ * Create left hand side node manager menu with menu item activated based
+ * on page being accessed.
+ */
+export default Ember.Helper.helper(function(params,hash) {
+ // Place a menu within a panel inside col-md-2 container.
+ var nodeIdSplitAtPort = hash.nodeId;
+ var portIndex = nodeIdSplitAtPort.indexOf(':');
+ if (portIndex != -1) {
+ nodeIdSplitAtPort = nodeIdSplitAtPort.substring(0, portIndex) +
+ ':​' + nodeIdSplitAtPort.substring(portIndex + 1);
+ }
+ var normalizedNodeId = '';
+ var splitsAlongDots = nodeIdSplitAtPort.split('.');
+ if (splitsAlongDots) {
+ var len = splitsAlongDots.length;
+ for (var i = 0; i < len; i++) {
+ normalizedNodeId = normalizedNodeId + splitsAlongDots[i];
+ if (i != len - 1) {
+ normalizedNodeId = normalizedNodeId + '.​';
+ }
+ }
+ } else {
+ normalizedNodeId = nodeIdSplitAtPort;
+ }
+
+ var html = '<div class="col-md-2 container-fluid"><div class="panel panel-default">'+
+ '<div class="panel-heading"><h4>Node Manager<br>(' + normalizedNodeId + ')</h4></div>'+
+ '<div class="panel-body"><ul class="nav nav-pills nav-stacked" id="stacked-menu">' +
+ '<ul class="nav nav-pills nav-stacked collapse in"><li';
+ if (hash.path == 'yarnNode') {
+ html = html + ' class="active"';
+ }
+ html = html + '><a href="yarnNode/' + hash.nodeId + '/' + hash.nodeAddr +
+ '">Node Information</a></li><li';
+ if (hash.path == 'yarnNodeApps') {
+ html = html + ' class="active"';
+ }
+ html = html + '><a href="yarnNodeApps/' + hash.nodeId + '/' + hash.nodeAddr +
+ '">List of Applications</a></li><li';
+ if (hash.path == 'yarnNodeContainers') {
+ html = html + ' class="active"';
+ }
+ html = html + '><a href="yarnNodeContainers/' +hash.nodeId + '/' + hash.nodeAddr +
+ '">List of Containers</a></li></ul></ul></div>';
+ return Ember.String.htmlSafe(html);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app.js
index cb79be1..fec2bd3 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app.js
@@ -2,12 +2,12 @@ import Converter from 'yarn-ui/utils/converter';
import DS from 'ember-data';
export default DS.Model.extend({
- appName: DS.attr('string'),
- user: DS.attr('string'),
- queue: DS.attr('string'),
- state: DS.attr('string'),
- startTime: DS.attr('string'),
- elapsedTime: DS.attr('string'),
+ appName: DS.attr('string'),
+ user: DS.attr('string'),
+ queue: DS.attr('string'),
+ state: DS.attr('string'),
+ startTime: DS.attr('string'),
+ elapsedTime: DS.attr('string'),
finalStatus: DS.attr('string'),
finishedTime: DS.attr('finishedTime'),
progress: DS.attr('number'),
@@ -62,4 +62,4 @@ export default DS.Model.extend({
return "label label-" + style;
}.property("finalStatus")
-});
\ No newline at end of file
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-container-log.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-container-log.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-container-log.js
new file mode 100644
index 0000000..31cf61e
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-container-log.js
@@ -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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ logs: DS.attr('string'),
+ containerID: DS.attr('string'),
+ logFileName: DS.attr('string')
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-app.js
new file mode 100644
index 0000000..6dc69ae
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-app.js
@@ -0,0 +1,44 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ appId: DS.attr('string'),
+ state: DS.attr('string'),
+ user: DS.attr('string'),
+ containers: DS.attr('array'),
+ /**
+ * Indicates no rows were retrieved from backend
+ */
+ isDummyApp: function() {
+ return this.get('id') == "dummy";
+ }.property("id"),
+
+ appStateStyle: function() {
+ var style = "default";
+ var appState = this.get("state");
+ if (appState == "RUNNING" || appState == "FINISHING_CONTAINERS_WAIT" ||
+ appState == "APPLICATION_RESOURCES_CLEANINGUP") {
+ style = "primary";
+ } else if (appState == "FINISHED") {
+ style = "success";
+ }
+ return "label label-" + style;
+ }.property("state")
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-container.js
new file mode 100644
index 0000000..3ba3216
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-container.js
@@ -0,0 +1,57 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ containerId: DS.attr('string'),
+ state: DS.attr('string'),
+ user: DS.attr('string'),
+ exitCode: DS.attr('string'),
+ diagnostics: DS.attr('string'),
+ totalMemoryNeeded: DS.attr('number'),
+ totalVCoresNeeded: DS.attr('number'),
+ containerLogFiles: DS.attr('array'),
+
+ /**
+ * Indicates that there was no container retrieved from backend.
+ */
+ isDummyContainer: function() {
+ return this.get('id') == "dummy";
+ }.property("id"),
+
+ containerStateStyle: function() {
+ var style = "primary";
+ var containerState = this.get('state');
+ var containerExitCode = this.get('exitCode');
+ if (containerState == "DONE") {
+ if (containerExitCode == "0") {
+ style = "success";
+ } else if (containerExitCode != "N/A") {
+ style = "danger";
+ }
+ }
+ if (containerState == "EXITED_WITH_SUCCESS") {
+ style = "success";
+ }
+ if (containerState == "EXITED_WITH_FAILURE") {
+ style = "danger";
+ }
+ return "label label-" + style;
+ }.property("state", "exitCode")
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node.js
new file mode 100644
index 0000000..4753983
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node.js
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ totalVmemAllocatedContainersMB: DS.attr('number'),
+ totalPmemAllocatedContainersMB: DS.attr('number'),
+ totalVCoresAllocatedContainers: DS.attr('number'),
+ vmemCheckEnabled: DS.attr('boolean'),
+ pmemCheckEnabled: DS.attr('boolean'),
+ nodeHealthy: DS.attr('boolean'),
+ lastNodeUpdateTime: DS.attr('string'),
+ healthReport: DS.attr('string'),
+ nmStartupTime: DS.attr('string'),
+ nodeManagerBuildVersion: DS.attr('string'),
+ hadoopBuildVersion: DS.attr('string'),
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-rm-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-rm-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-rm-node.js
new file mode 100644
index 0000000..9a1082c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-rm-node.js
@@ -0,0 +1,92 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ rack: DS.attr('string'),
+ state: DS.attr('string'),
+ nodeHostName: DS.attr('string'),
+ nodeHTTPAddress: DS.attr('string'),
+ lastHealthUpdate: DS.attr('string'),
+ healthReport: DS.attr('string'),
+ numContainers: DS.attr('number'),
+ usedMemoryMB: DS.attr('number'),
+ availMemoryMB: DS.attr('number'),
+ usedVirtualCores: DS.attr('number'),
+ availableVirtualCores: DS.attr('number'),
+ version: DS.attr('string'),
+ nodeLabels: DS.attr('array'),
+
+ nodeLabelsAsString: function() {
+ var labels = this.get("nodeLabels");
+ var labelToReturn = "";
+ // Only one label per node supported.
+ if (labels && labels.length > 0) {
+ labelToReturn = labels[0];
+ }
+ return labelToReturn;
+ }.property("nodeLabels"),
+
+ /**
+ * Indicates no rows were retrieved from backend
+ */
+ isDummyNode: function() {
+ return this.get('id') == "dummy";
+ }.property("id"),
+
+ nodeStateStyle: function() {
+ var style = "default";
+ var nodeState = this.get("state");
+ if (nodeState == "REBOOTED") {
+ style = "warning";
+ } else if (nodeState == "UNHEALTHY" || nodeState == "DECOMMISSIONED" ||
+ nodeState == "LOST" || nodeState == "SHUTDOWN") {
+ style = "danger";
+ } else if (nodeState == "RUNNING") {
+ style = "success";
+ }
+ return "label label-" + style;
+ }.property("state"),
+
+ getMemoryDataForDonutChart: function() {
+ var arr = [];
+ arr.push({
+ label: "Used",
+ value: this.get("usedMemoryMB")
+ });
+ arr.push({
+ label: "Available",
+ value: this.get("availMemoryMB")
+ });
+ return arr;
+ }.property("availMemoryMB", "usedMemoryMB"),
+
+ getVCoreDataForDonutChart: function() {
+ var arr = [];
+ arr.push({
+ label: "Used",
+ value: this.get("usedVirtualCores")
+ });
+ arr.push({
+ label: "Available",
+ value: this.get("availableVirtualCores")
+ });
+ return arr;
+ }.property("availableVirtualCores", "usedVirtualCores"),
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/router.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/router.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/router.js
index c31190f..5db083e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/router.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/router.js
@@ -7,10 +7,23 @@ var Router = Ember.Router.extend({
Router.map(function() {
this.route('yarnApps');
+ this.route('yarnNodes');
+ this.route('yarnNode', { path: '/yarnNode/:node_id/:node_addr' });
+ this.route('yarnNodeApps', { path: '/yarnNodeApps/:node_id/:node_addr' });
+ this.route('yarnNodeApp',
+ { path: '/yarnNodeApp/:node_id/:node_addr/:app_id' });
+ this.route('yarnNodeContainers',
+ { path: '/yarnNodeContainers/:node_id/:node_addr' });
+ this.route('yarnNodeContainer',
+ { path: '/yarnNodeContainer/:node_id/:node_addr/:container_id' });
+ this.route('yarnContainerLog', { path:
+ '/yarnContainerLog/:node_id/:node_addr/:container_id/:filename' });
this.route('yarnQueue', { path: '/yarnQueue/:queue_name' });
this.route('clusterOverview');
this.route('yarnApp', { path: '/yarnApp/:app_id' });
this.route('yarnAppAttempt', { path: '/yarnAppAttempt/:app_attempt_id'});
+ this.route('error');
+ this.route('notfound', { path: '*:' });
});
export default Router;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/application.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/application.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/application.js
new file mode 100644
index 0000000..b7a5754
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/application.js
@@ -0,0 +1,38 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ actions: {
+ /**
+ * Base error handler for the application.
+ * If specific routes do not handle the error, it will bubble up to
+ * this handler. Here we redirect to either 404 page or a generic
+ * error handler page.
+ */
+ error: function (error) {
+ if (error && error.errors[0] &&
+ error.errors[0].status == 404) {
+ this.intermediateTransitionTo('/notfound');
+ } else {
+ this.intermediateTransitionTo('/error');
+ }
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/index.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/index.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/index.js
new file mode 100644
index 0000000..b228ff4
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/index.js
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ /**
+ * Redirect root URL to cluster overview page.
+ */
+ beforeModel: function() {
+ this.replaceWith('clusterOverview');
+ }
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-apps.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-apps.js
index 79d184f..2787f5b 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-apps.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-apps.js
@@ -2,7 +2,7 @@ import Ember from 'ember';
export default Ember.Route.extend({
model() {
- var apps = this.store.findAll('yarnApp');
- return apps
+ var apps = this.store.findAll('yarnApp');
+ return apps;
}
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-container-log.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-container-log.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-container-log.js
new file mode 100644
index 0000000..c324025
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-container-log.js
@@ -0,0 +1,55 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import Constants from 'yarn-ui/constants';
+
+export default Ember.Route.extend({
+ model(param) {
+ var id = param.node_addr + Constants.PARAM_SEPARATOR + param.container_id +
+ Constants.PARAM_SEPARATOR + param.filename;
+ return Ember.RSVP.hash({
+ containerLog: this.store.findRecord('yarnContainerLog', id),
+ nodeInfo: { id: param.node_id, addr: param.node_addr }
+ }).then(function(hash) {
+ // Just return as its success.
+ return hash;
+ }, function(reason) {
+ if (reason.errors && reason.errors[0]) {
+ // This means HTTP error response was sent by adapter.
+ return reason;
+ } else {
+ // Assume empty response received from server.
+ return { nodeInfo: { id: param.node_id, addr: param.node_addr },
+ containerLog: { logs: "", containerID: param.container_id,
+ logFileName: param.filename}};
+ }
+ });
+ },
+
+ afterModel(model) {
+ // Handle errors and redirect if promise is rejected.
+ if (model.errors && model.errors[0]) {
+ if (model.errors[0].status == 404) {
+ this.replaceWith('/notfound');
+ } else {
+ this.replaceWith('/error');
+ }
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-app.js
new file mode 100644
index 0000000..63b1f2a
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-app.js
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ return Ember.RSVP.hash({
+ nodeApp: this.store.queryRecord('yarnNodeApp',
+ { nodeAddr : param.node_addr, appId: param.app_id }),
+ nodeInfo: { id: param.node_id, addr: param.node_addr }
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-apps.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-apps.js
new file mode 100644
index 0000000..ffb5b7b
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-apps.js
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ // Get all apps running on a specific node. Node is contacted by using node_addr.
+ return Ember.RSVP.hash({
+ apps: this.store.query('yarnNodeApp', { nodeAddr: param.node_addr }),
+ nodeInfo: { id: param.node_id, addr: param.node_addr }
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-container.js
new file mode 100644
index 0000000..2022662
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-container.js
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ // Get a specific container running on a specific node.
+ return Ember.RSVP.hash({
+ nodeContainer: this.store.queryRecord('yarnNodeContainer',
+ { nodeHttpAddr: param.node_addr, containerId: param.container_id }),
+ nodeInfo: { id: param.node_id, addr: param.node_addr }
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-containers.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-containers.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-containers.js
new file mode 100644
index 0000000..9a69729
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-containers.js
@@ -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.
+ */
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ // Get all containers running on specific node.
+ return Ember.RSVP.hash({
+ containers: this.store.query('yarnNodeContainer', { nodeHttpAddr: param.node_addr }),
+ nodeInfo: { id: param.node_id, addr: param.node_addr }
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node.js
new file mode 100644
index 0000000..7c58b94
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node.js
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ // Fetches data from both NM and RM. RM is queried to get node usage info.
+ return Ember.RSVP.hash({
+ node: this.store.findRecord('yarnNode', param.node_addr),
+ rmNode: this.store.findRecord('yarnRmNode', param.node_id)
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-nodes.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-nodes.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-nodes.js
new file mode 100644
index 0000000..f33eef8
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-nodes.js
@@ -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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model() {
+ return this.store.findAll('yarnRmNode');
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-container-log.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-container-log.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-container-log.js
new file mode 100644
index 0000000..9e10615
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-container-log.js
@@ -0,0 +1,39 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Converter from 'yarn-ui/utils/converter';
+
+export default DS.JSONAPISerializer.extend({
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // Convert plain text response into JSON.
+ // ID is of the form nodeAddress!containerId!fileName
+ var splits = Converter.splitForContainerLogs(id);
+ var convertedPayload = {
+ id: id,
+ type: primaryModelClass.modelName,
+ attributes: {
+ logs: payload,
+ containerID: splits[1],
+ logFileName: splits[2]
+ }
+ };
+ return { data: convertedPayload };
+ },
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-app.js
new file mode 100644
index 0000000..8b1f152
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-app.js
@@ -0,0 +1,86 @@
+/**
+ * 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.
+ */
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Ember from 'ember';
+
+export default DS.JSONAPISerializer.extend({
+ internalNormalizeSingleResponse(store, primaryModelClass, payload) {
+ if (payload.app) {
+ payload = payload.app;
+ }
+
+ var fixedPayload = {
+ id: payload.id,
+ type: primaryModelClass.modelName,
+ attributes: {
+ appId: payload.id,
+ state: payload.state,
+ user: payload.user,
+ containers: payload.containerids
+ }
+ };
+ return fixedPayload;
+ },
+
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // payload is of the form {"app":{}}
+ var p = this.internalNormalizeSingleResponse(store,
+ primaryModelClass, payload);
+ return { data: p };
+ },
+
+ normalizeArrayResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // expected return response is of the form { data: [ {}, {} ] }
+ var normalizedArrayResponse = {};
+ // payload is of the form { "apps" : { "app": [ {},{},{} ] } }
+ if (payload.apps) {
+ normalizedArrayResponse.data = payload.apps.app.map(singleApp => {
+ return this.internalNormalizeSingleResponse(store, primaryModelClass,
+ singleApp);
+ }, this);
+ } else {
+ // No container reported inside containers.
+ // Response of the form { "apps": null }
+ normalizedArrayResponse.data = Ember.makeArray({
+ id: "dummy",
+ type: primaryModelClass.modelName,
+ attributes: {}});
+ }
+ return normalizedArrayResponse;
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-container.js
new file mode 100644
index 0000000..528f2fe
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-container.js
@@ -0,0 +1,74 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Ember from 'ember';
+
+export default DS.JSONAPISerializer.extend({
+ internalNormalizeSingleResponse(store, primaryModelClass, payload) {
+ if (payload.container) {
+ payload = payload.container;
+ }
+ var fixedPayload = {
+ id: payload.id,
+ type: primaryModelClass.modelName,
+ attributes: {
+ containerId: payload.id,
+ state: payload.state,
+ user: payload.user,
+ diagnostics: payload.diagnostics,
+ exitCode: payload.exitCode,
+ totalMemoryNeeded: payload.totalMemoryNeededMB,
+ totalVCoresNeeded: payload.totalVCoresNeeded,
+ containerLogFiles: payload.containerLogFiles
+ }
+ };
+
+ return fixedPayload;
+ },
+
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // payload is of the form {"container":{}}
+ var p = this.internalNormalizeSingleResponse(store,
+ primaryModelClass, payload);
+ return { data: p };
+ },
+
+ normalizeArrayResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // expected return response is of the form { data: [ {}, {} ] }
+ var normalizedArrayResponse = {};
+ if (payload.containers) {
+ // payload is of the form { "containers" : { "container": [ {},{},{} ] } }
+ normalizedArrayResponse.data =
+ payload.containers.container.map(singleContainer => {
+ return this.internalNormalizeSingleResponse(store, primaryModelClass,
+ singleContainer);
+ }, this);
+ } else {
+ // No container reported inside containers.
+ // Response of the form { "containers": null }
+ normalizedArrayResponse.data = Ember.makeArray({
+ id: "dummy",
+ type: primaryModelClass.modelName,
+ attributes: {}});
+ }
+ return normalizedArrayResponse;
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node.js
new file mode 100644
index 0000000..19308e2
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node.js
@@ -0,0 +1,56 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Converter from 'yarn-ui/utils/converter';
+
+export default DS.JSONAPISerializer.extend({
+ internalNormalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ if (payload.nodeInfo) {
+ payload = payload.nodeInfo;
+ }
+
+ var fixedPayload = {
+ id: id,
+ type: primaryModelClass.modelName,
+ attributes: {
+ totalVmemAllocatedContainersMB: payload.totalVmemAllocatedContainersMB,
+ totalPmemAllocatedContainersMB: payload.totalPmemAllocatedContainersMB,
+ totalVCoresAllocatedContainers: payload.totalVCoresAllocatedContainers,
+ vmemCheckEnabled: payload.vmemCheckEnabled,
+ pmemCheckEnabled: payload.pmemCheckEnabled,
+ nodeHealthy: payload.nodeHealthy,
+ lastNodeUpdateTime: Converter.timeStampToDate(payload.lastNodeUpdateTime),
+ healthReport: payload.healthReport,
+ nmStartupTime: Converter.timeStampToDate(payload.nmStartupTime),
+ nodeManagerBuildVersion: payload.nodeManagerBuildVersion,
+ hadoopBuildVersion: payload.hadoopBuildVersion
+ }
+ };
+ return fixedPayload;
+ },
+
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // payload is of the form {"nodeInfo":{}}
+ var p = this.internalNormalizeSingleResponse(store,
+ primaryModelClass, payload, id, requestType);
+ return { data: p };
+ },
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-rm-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-rm-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-rm-node.js
new file mode 100644
index 0000000..6cb9320
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-rm-node.js
@@ -0,0 +1,77 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import DS from 'ember-data';
+import Converter from 'yarn-ui/utils/converter';
+
+export default DS.JSONAPISerializer.extend({
+ internalNormalizeSingleResponse(store, primaryModelClass, payload, id) {
+ if (payload.node) {
+ payload = payload.node;
+ }
+
+ var fixedPayload = {
+ id: id,
+ type: primaryModelClass.modelName,
+ attributes: {
+ rack: payload.rack,
+ state: payload.state,
+ nodeHostName: payload.nodeHostName,
+ nodeHTTPAddress: payload.nodeHTTPAddress,
+ lastHealthUpdate: Converter.timeStampToDate(payload.lastHealthUpdate),
+ healthReport: payload.healthReport,
+ numContainers: payload.numContainers,
+ usedMemoryMB: payload.usedMemoryMB,
+ availMemoryMB: payload.availMemoryMB,
+ usedVirtualCores: payload.usedVirtualCores,
+ availableVirtualCores: payload.availableVirtualCores,
+ version: payload.version,
+ nodeLabels: payload.nodeLabels
+ }
+ };
+ return fixedPayload;
+ },
+
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // payload is of the form {"nodeInfo":{}}
+ var p = this.internalNormalizeSingleResponse(store,
+ primaryModelClass, payload, id);
+ return { data: p };
+ },
+
+ normalizeArrayResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // expected response is of the form { data: [ {}, {} ] }
+ var normalizedArrayResponse = {};
+ if (payload.nodes) {
+ // payload is of the form { "nodes": { "node": [ {},{},{} ] } }
+ normalizedArrayResponse.data = payload.nodes.node.map(singleNode => {
+ return this.internalNormalizeSingleResponse(store, primaryModelClass,
+ singleNode, singleNode.id);
+ }, this);
+ } else {
+ normalizedArrayResponse.data = Ember.makeArray({
+ id: "dummy",
+ type: primaryModelClass.modelName,
+ attributes: {}});
+ }
+ return normalizedArrayResponse;
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/application.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/application.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/application.hbs
index 252ca74..a9de203 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/application.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/application.hbs
@@ -14,9 +14,7 @@
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
- <li class="active"><a href="yarnQueue/root">Queues<span class="sr-only">(current)</span></a></li>
- <li class="active"><a href="yarnApps">Applications<span class="sr-only">(current)</span></a></li>
- <li class="active"><a href="clusterOverview">Cluster Overview<span class="sr-only">(current)</span></a></li>
+ {{outputMainMenu}}
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[41/50] [abbrv] hadoop git commit: YARN-4849. [YARN-3368] cleanup
code base, integrate web UI related build to mvn, and fix licenses. (wangda)
Posted by wa...@apache.org.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/simple-table.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/simple-table.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/simple-table.js
deleted file mode 100644
index 447533e..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/simple-table.js
+++ /dev/null
@@ -1,58 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Component.extend({
- didInsertElement: function() {
- var paging = this.get("paging") ? true : this.get("paging");
- var ordering = this.get("ordering") ? true : this.get("ordering");
- var info = this.get("info") ? true : this.get("info");
- var bFilter = this.get("bFilter") ? true : this.get("bFilter");
-
- // Defines sorter for the columns if not default.
- // Can also specify a custom sorter.
- var i;
- var colDefs = [];
- if (this.get("colTypes")) {
- var typesArr = this.get("colTypes").split(' ');
- var targetsArr = this.get("colTargets").split(' ');
- for (i = 0; i < typesArr.length; i++) {
- console.log(typesArr[i] + " " + targetsArr[i]);
- colDefs.push({
- type: typesArr[i],
- targets: parseInt(targetsArr[i])
- });
- }
- }
- // Defines initial column and sort order.
- var orderArr = [];
- if (this.get("colsOrder")) {
- var cols = this.get("colsOrder").split(' ');
- for (i = 0; i < cols.length; i++) {
- var col = cols[i].split(',');
- if (col.length != 2) {
- continue;
- }
- var order = col[1].trim();
- if (order != 'asc' && order != 'desc') {
- continue;
- }
- var colOrder = [];
- colOrder.push(parseInt(col[0]));
- colOrder.push(order);
- orderArr.push(colOrder);
- }
- }
- if (orderArr.length == 0) {
- var defaultOrder = [0, 'asc'];
- orderArr.push(defaultOrder);
- }
- console.log(orderArr[0]);
- Ember.$('#' + this.get('table-id')).DataTable({
- "paging": paging,
- "ordering": ordering,
- "info": info,
- "bFilter": bFilter,
- "order": orderArr,
- "columnDefs": colDefs
- });
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/timeline-view.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/timeline-view.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/timeline-view.js
deleted file mode 100644
index fe402bb..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/timeline-view.js
+++ /dev/null
@@ -1,250 +0,0 @@
-import Ember from 'ember';
-import Converter from 'yarn-ui/utils/converter';
-
-export default Ember.Component.extend({
- canvas: {
- svg: undefined,
- h: 0,
- w: 0,
- tooltip: undefined
- },
-
- clusterMetrics: undefined,
- modelArr: [],
- colors: d3.scale.category10().range(),
- _selected: undefined,
-
- selected: function() {
- return this._selected;
- }.property(),
-
- tableComponentName: function() {
- return "app-attempt-table";
- }.property(),
-
- setSelected: function(d) {
- if (this._selected == d) {
- return;
- }
-
- // restore color
- if (this._selected) {
- var dom = d3.select("#timeline-bar-" + this._selected.get("id"));
- dom.attr("fill", this.colors[0]);
- }
-
- this._selected = d;
- this.set("selected", d);
- dom = d3.select("#timeline-bar-" + d.get("id"));
- dom.attr("fill", this.colors[1]);
- },
-
- getPerItemHeight: function() {
- var arrSize = this.modelArr.length;
-
- if (arrSize < 20) {
- return 30;
- } else if (arrSize < 100) {
- return 10;
- } else {
- return 2;
- }
- },
-
- getPerItemGap: function() {
- var arrSize = this.modelArr.length;
-
- if (arrSize < 20) {
- return 5;
- } else if (arrSize < 100) {
- return 1;
- } else {
- return 1;
- }
- },
-
- getCanvasHeight: function() {
- return (this.getPerItemHeight() + this.getPerItemGap()) * this.modelArr.length + 200;
- },
-
- draw: function(start, end) {
- // get w/h of the svg
- var bbox = d3.select("#" + this.get("parent-id"))
- .node()
- .getBoundingClientRect();
- this.canvas.w = bbox.width;
- this.canvas.h = this.getCanvasHeight();
-
- this.canvas.svg = d3.select("#" + this.get("parent-id"))
- .append("svg")
- .attr("width", this.canvas.w)
- .attr("height", this.canvas.h)
- .attr("id", this.get("my-id"));
- this.renderTimeline(start, end);
- },
-
- renderTimeline: function(start, end) {
- var border = 30;
- var singleBarHeight = this.getPerItemHeight();
- var gap = this.getPerItemGap();
- var textWidth = 50;
- /*
- start-time end-time
- |--------------------------------------|
- ==============
- ==============
- ==============
- ===============
- */
- var xScaler = d3.scale.linear()
- .domain([start, end])
- .range([0, this.canvas.w - 2 * border - textWidth]);
-
- /*
- * Render frame of timeline view
- */
- this.canvas.svg.append("line")
- .attr("x1", border + textWidth)
- .attr("y1", border - 5)
- .attr("x2", this.canvas.w - border)
- .attr("y2", border - 5)
- .attr("class", "chart");
-
- this.canvas.svg.append("line")
- .attr("x1", border + textWidth)
- .attr("y1", border - 10)
- .attr("x2", border + textWidth)
- .attr("y2", border - 5)
- .attr("class", "chart");
-
- this.canvas.svg.append("line")
- .attr("x1", this.canvas.w - border)
- .attr("y1", border - 10)
- .attr("x2", this.canvas.w - border)
- .attr("y2", border - 5)
- .attr("class", "chart");
-
- this.canvas.svg.append("text")
- .text(Converter.timeStampToDate(start))
- .attr("y", border - 15)
- .attr("x", border + textWidth)
- .attr("class", "bar-chart-text")
- .attr("text-anchor", "left");
-
- this.canvas.svg.append("text")
- .text(Converter.timeStampToDate(end))
- .attr("y", border - 15)
- .attr("x", this.canvas.w - border)
- .attr("class", "bar-chart-text")
- .attr("text-anchor", "end");
-
- // show bar
- var bar = this.canvas.svg.selectAll("bars")
- .data(this.modelArr)
- .enter()
- .append("rect")
- .attr("y", function(d, i) {
- return border + (gap + singleBarHeight) * i;
- })
- .attr("x", function(d, i) {
- return border + textWidth + xScaler(d.get("startTs"));
- })
- .attr("height", singleBarHeight)
- .attr("fill", function(d, i) {
- return this.colors[0];
- }.bind(this))
- .attr("width", function(d, i) {
- var finishedTs = xScaler(d.get("finishedTs"));
- finishedTs = finishedTs > 0 ? finishedTs : xScaler(end);
- return finishedTs - xScaler(d.get("startTs"));
- })
- .attr("id", function(d, i) {
- return "timeline-bar-" + d.get("id");
- });
- bar.on("click", function(d) {
- this.setSelected(d);
- }.bind(this));
-
- this.bindTooltip(bar);
-
- if (this.modelArr.length <= 20) {
- // show bar texts
- for (var i = 0; i < this.modelArr.length; i++) {
- this.canvas.svg.append("text")
- .text(this.modelArr[i].get(this.get("label")))
- .attr("y", border + (gap + singleBarHeight) * i + singleBarHeight / 2)
- .attr("x", border)
- .attr("class", "bar-chart-text");
- }
- }
- },
-
- bindTooltip: function(d) {
- d.on("mouseover", function(d) {
- this.tooltip
- .style("left", (d3.event.pageX) + "px")
- .style("top", (d3.event.pageY - 28) + "px");
- }.bind(this))
- .on("mousemove", function(d) {
- this.tooltip.style("opacity", .9);
- this.tooltip.html(d.get("tooltipLabel"))
- .style("left", (d3.event.pageX) + "px")
- .style("top", (d3.event.pageY - 28) + "px");
- }.bind(this))
- .on("mouseout", function(d) {
- this.tooltip.style("opacity", 0);
- }.bind(this));
- },
-
- initTooltip: function() {
- this.tooltip = d3.select("body")
- .append("div")
- .attr("class", "tooltip")
- .attr("id", "chart-tooltip")
- .style("opacity", 0);
- },
-
- didInsertElement: function() {
- // init tooltip
- this.initTooltip();
-
- // init model
- if (this.get("rmModel")) {
- this.get("rmModel").forEach(function(o) {
- this.modelArr.push(o);
- }.bind(this));
- }
-
- if (this.get("tsModel")) {
- this.get("tsModel").forEach(function(o) {
- this.modelArr.push(o);
- }.bind(this));
- }
-
- this.modelArr.sort(function(a, b) {
- var tsA = a.get("startTs");
- var tsB = b.get("startTs");
-
- return tsA - tsB;
- });
- if (this.modelArr.length > 0) {
- var begin = this.modelArr[0].get("startTs");
- }
- var end = 0;
- for (var i = 0; i < this.modelArr.length; i++) {
- var ts = this.modelArr[i].get("finishedTs");
- if (ts > end) {
- end = ts;
- }
- }
- if (end < begin) {
- end = Date.now();
- }
-
- this.draw(begin, end);
-
- if (this.modelArr.length > 0) {
- this.setSelected(this.modelArr[0]);
- }
- },
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/tree-selector.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/tree-selector.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/tree-selector.js
deleted file mode 100644
index 470deaf..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/tree-selector.js
+++ /dev/null
@@ -1,257 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Component.extend({
- // Map: <queue-name, queue>
- map : undefined,
-
- // Normalized data for d3
- treeData: undefined,
-
- // folded queues, folded[<queue-name>] == true means <queue-name> is folded
- foldedQueues: { },
-
- // maxDepth
- maxDepth: 0,
-
- // num of leaf queue, folded queue is treated as leaf queue
- numOfLeafQueue: 0,
-
- // mainSvg
- mainSvg: undefined,
-
- // Init data
- initData: function() {
- this.map = { };
- this.treeData = { };
- this.maxDepth = 0;
- this.numOfLeafQueue = 0;
-
- this.get("model")
- .forEach(function(o) {
- this.map[o.id] = o;
- }.bind(this));
-
- var selected = this.get("selected");
-
- this.initQueue("root", 1, this.treeData);
- },
-
- // get Children array of given queue
- getChildrenNamesArray: function(q) {
- var namesArr = [];
-
- // Folded queue's children is empty
- if (this.foldedQueues[q.get("name")]) {
- return namesArr;
- }
-
- var names = q.get("children");
- if (names) {
- names.forEach(function(name) {
- namesArr.push(name);
- });
- }
-
- return namesArr;
- },
-
- // Init queues
- initQueue: function(queueName, depth, node) {
- if ((!queueName) || (!this.map[queueName])) {
- // Queue is not existed
- return;
- }
-
- if (depth > this.maxDepth) {
- this.maxDepth = this.maxDepth + 1;
- }
-
- var queue = this.map[queueName];
-
- var names = this.getChildrenNamesArray(queue);
-
- node.name = queueName;
- node.parent = queue.get("parent");
- node.queueData = queue;
-
- if (names.length > 0) {
- node.children = [];
-
- names.forEach(function(name) {
- var childQueueData = {};
- node.children.push(childQueueData);
- this.initQueue(name, depth + 1, childQueueData);
- }.bind(this));
- } else {
- this.numOfLeafQueue = this.numOfLeafQueue + 1;
- }
- },
-
- update: function(source, root, tree, diagonal) {
- var duration = 300;
- var i = 0;
-
- // Compute the new tree layout.
- var nodes = tree.nodes(root).reverse();
- var links = tree.links(nodes);
-
- // Normalize for fixed-depth.
- nodes.forEach(function(d) { d.y = d.depth * 200; });
-
- // Update the nodes\u2026
- var node = this.mainSvg.selectAll("g.node")
- .data(nodes, function(d) { return d.id || (d.id = ++i); });
-
- // Enter any new nodes at the parent's previous position.
- var nodeEnter = node.enter().append("g")
- .attr("class", "node")
- .attr("transform", function(d) { return "translate(" + source.y0 + "," + source.x0 + ")"; })
- .on("click", function(d,i){
- if (d.queueData.get("name") != this.get("selected")) {
- document.location.href = "yarnQueue/" + d.queueData.get("name");
- }
- }.bind(this));
- // .on("click", click);
-
- nodeEnter.append("circle")
- .attr("r", 1e-6)
- .style("fill", function(d) {
- var usedCap = d.queueData.get("usedCapacity");
- if (usedCap <= 60.0) {
- return "LimeGreen";
- } else if (usedCap <= 100.0) {
- return "DarkOrange";
- } else {
- return "LightCoral";
- }
- });
-
- // append percentage
- nodeEnter.append("text")
- .attr("x", function(d) { return 0; })
- .attr("dy", ".35em")
- .attr("text-anchor", function(d) { return "middle"; })
- .text(function(d) {
- var usedCap = d.queueData.get("usedCapacity");
- if (usedCap >= 100.0) {
- return usedCap.toFixed(0) + "%";
- } else {
- return usedCap.toFixed(1) + "%";
- }
- })
- .style("fill-opacity", 1e-6);
-
- // append queue name
- nodeEnter.append("text")
- .attr("x", function(d) { return 40; })
- .attr("dy", ".35em")
- .attr("text-anchor", function(d) { return "start"; })
- .text(function(d) { return d.name; })
- .style("fill-opacity", 1e-6);
-
- // Transition nodes to their new position.
- var nodeUpdate = node.transition()
- .duration(duration)
- .attr("transform", function(d) { return "translate(" + d.y + "," + d.x + ")"; });
-
- nodeUpdate.select("circle")
- .attr("r", 20)
- .attr("href",
- function(d) {
- return "yarnQueues/" + d.queueData.get("name");
- })
- .style("stroke", function(d) {
- if (d.queueData.get("name") == this.get("selected")) {
- return "red";
- } else {
- return "gray";
- }
- }.bind(this));
-
- nodeUpdate.selectAll("text")
- .style("fill-opacity", 1);
-
- // Transition exiting nodes to the parent's new position.
- var nodeExit = node.exit().transition()
- .duration(duration)
- .attr("transform", function(d) { return "translate(" + source.y + "," + source.x + ")"; })
- .remove();
-
- nodeExit.select("circle")
- .attr("r", 1e-6);
-
- nodeExit.select("text")
- .style("fill-opacity", 1e-6);
-
- // Update the links\u2026
- var link = this.mainSvg.selectAll("path.link")
- .data(links, function(d) { return d.target.id; });
-
- // Enter any new links at the parent's previous position.
- link.enter().insert("path", "g")
- .attr("class", "link")
- .attr("d", function(d) {
- var o = {x: source.x0, y: source.y0};
- return diagonal({source: o, target: o});
- });
-
- // Transition links to their new position.
- link.transition()
- .duration(duration)
- .attr("d", diagonal);
-
- // Transition exiting nodes to the parent's new position.
- link.exit().transition()
- .duration(duration)
- .attr("d", function(d) {
- var o = {x: source.x, y: source.y};
- return diagonal({source: o, target: o});
- })
- .remove();
-
- // Stash the old positions for transition.
- nodes.forEach(function(d) {
- d.x0 = d.x;
- d.y0 = d.y;
- });
- },
-
- reDraw: function() {
- this.initData();
-
- var margin = {top: 20, right: 120, bottom: 20, left: 120};
- var treeWidth = this.maxDepth * 200;
- var treeHeight = this.numOfLeafQueue * 80;
- var width = treeWidth + margin.left + margin.right;
- var height = treeHeight + margin.top + margin.bottom;
- var layout = { };
-
- if (this.mainSvg) {
- this.mainSvg.remove();
- }
-
- this.mainSvg = d3.select("#" + this.get("parentId")).append("svg")
- .attr("width", width)
- .attr("height", height)
- .attr("class", "tree-selector")
- .append("g")
- .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
-
- var tree = d3.layout.tree().size([treeHeight, treeWidth]);
-
- var diagonal = d3.svg.diagonal()
- .projection(function(d) { return [d.y, d.x]; });
-
- var root = this.treeData;
- root.x0 = height / 2;
- root.y0 = 0;
-
- d3.select(self.frameElement).style("height", height);
-
- this.update(root, root, tree, diagonal);
- },
-
- didInsertElement: function() {
- this.reDraw();
- }
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/config.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/config.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/config.js
deleted file mode 100644
index 224c65a..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/config.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * 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.
- */
-
-/**
- * Host and port configurations
- */
-export default {
- RM_HOST: 'localhost',
- RM_PORT: '8088',
- TS_HOST: 'localhost',
- TS_PORT: '8188',
-};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/constants.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/constants.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/constants.js
deleted file mode 100644
index d2937a0..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/constants.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * 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.
- */
-
-/**
- * Application level global constants go here.
- */
-export default {
- PARAM_SEPARATOR: '!',
-};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/.gitkeep
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/.gitkeep b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/.gitkeep
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/application.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/application.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/application.js
deleted file mode 100644
index 3c68365..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/application.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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.
- */
-
-import Ember from 'ember';
-
-/**
- * Base controller for application.
- */
-export default Ember.Controller.extend({
- /**
- * Output main top UI menu which is common across all pages.
- * Menu item will be made active based on current path.
- */
- outputMainMenu: function(){
- var path = this.get('currentPath');
- var html = '<li';
- if (path == 'yarnQueue') {
- html = html + ' class="active"';
- }
- html = html + '><a href="yarnQueue/root">Queues<span class="sr-only">' +
- '(current)</span></a></li><li';
- if (path.lastIndexOf('yarnApp', 0) == 0) {
- html = html + ' class="active"';
- }
- html = html + '><a href="yarnApps">Applications<span class="sr-only">' +
- '(current)</span></a></li><li';
- if (path == 'clusterOverview') {
- html = html + ' class="active"';
- }
- html = html + '><a href="clusterOverview">Cluster Overview<span class=' +
- '"sr-only">(current)</span></a></li><li';
- if (path.lastIndexOf('yarnNode', 0) == 0) {
- html = html + ' class="active"';
- }
- html = html + '><a href="yarnNodes">Nodes<span class="sr-only">' +
- '(current)</span></a></li>';
- return Ember.String.htmlSafe(html);
- }.property('currentPath')
-});
-
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/cluster-overview.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/cluster-overview.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/cluster-overview.js
deleted file mode 100644
index 5c3c825..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/cluster-overview.js
+++ /dev/null
@@ -1,5 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Controller.extend({
- loading: true,
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/yarn-apps.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/yarn-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/yarn-apps.js
deleted file mode 100644
index 55ff9aa..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/yarn-apps.js
+++ /dev/null
@@ -1,4 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Controller.extend({
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/yarn-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/yarn-queue.js
deleted file mode 100644
index b16864e..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/yarn-queue.js
+++ /dev/null
@@ -1,6 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Controller.extend({
- needReload: true,
- selectedQueue: undefined,
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/.gitkeep
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/.gitkeep b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/.gitkeep
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/divide.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/divide.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/divide.js
deleted file mode 100644
index fcf64dd..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/divide.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * 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.
- */
-import Ember from 'ember';
-
-/**
- * Helper assumes values are numeric. num means numerator and
- * den means denominator.
- */
-export default Ember.Helper.helper(function(params,hash) {
- var num = hash.num;
- var den = hash.den;
- if (den == 0) {
- return 0;
- }
- return Math.floor(num/den);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/log-files-comma.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/log-files-comma.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/log-files-comma.js
deleted file mode 100644
index 8c29b34..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/log-files-comma.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.
- */
-
-import Ember from 'ember';
-
-/**
- * Represent log files as comma separated list.
- */
-export default Ember.Helper.helper(function(params,hash) {
- var logFiles = hash.logFiles;
- if (logFiles == null) {
- return "";
- }
- var logFilesLen = logFiles.length;
- if (logFilesLen == 0) {
- return "";
- }
- var nodeId = hash.nodeId;
- var nodeAddr = hash.nodeAddr;
- var containerId = hash.containerId;
- var html = '<td>';
- var logFilesCommaSeparated = "";
- for (var i = 0; i < logFilesLen; i++) {
- html = html + '<a href="yarnContainerLog/' + nodeId + '/' +
- nodeAddr + '/' + containerId + '/' + logFiles[i] + '">' + logFiles[i] +
- '</a>';
- if (i != logFilesLen - 1) {
- html = html + ",";
- }
- }
- html = html + '</td>';
- return Ember.String.htmlSafe(html);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-link.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-link.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-link.js
deleted file mode 100644
index 99d975b..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-link.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * 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.
- */
-
-import Ember from 'ember';
-
-/**
- * Generate link to node page if its not SHUTDOWN or LOST.
- */
-export default Ember.Helper.helper(function(params,hash) {
- var nodeState = hash.nodeState;
- var nodeHTTPAddress = hash.nodeHTTPAddress;
- var nodeId = hash.nodeId;
- var html = '<td>';
- if (nodeState == "SHUTDOWN" || nodeState == "LOST") {
- html = html + nodeHTTPAddress;
- } else {
- html = html + '<a href="yarnNode/' + nodeId + "/" + nodeHTTPAddress + '">' +
- nodeHTTPAddress + '</a>';
- }
- html = html + '</td>';
- return Ember.String.htmlSafe(html);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-menu.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-menu.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-menu.js
deleted file mode 100644
index 589111f..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-menu.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * 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.
- */
-import Ember from 'ember';
-
-/**
- * Create left hand side node manager menu with menu item activated based
- * on page being accessed.
- */
-export default Ember.Helper.helper(function(params,hash) {
- // Place a menu within a panel inside col-md-2 container.
- var nodeIdSplitAtPort = hash.nodeId;
- var portIndex = nodeIdSplitAtPort.indexOf(':');
- if (portIndex != -1) {
- nodeIdSplitAtPort = nodeIdSplitAtPort.substring(0, portIndex) +
- ':​' + nodeIdSplitAtPort.substring(portIndex + 1);
- }
- var normalizedNodeId = '';
- var splitsAlongDots = nodeIdSplitAtPort.split('.');
- if (splitsAlongDots) {
- var len = splitsAlongDots.length;
- for (var i = 0; i < len; i++) {
- normalizedNodeId = normalizedNodeId + splitsAlongDots[i];
- if (i != len - 1) {
- normalizedNodeId = normalizedNodeId + '.​';
- }
- }
- } else {
- normalizedNodeId = nodeIdSplitAtPort;
- }
-
- var html = '<div class="col-md-2 container-fluid"><div class="panel panel-default">'+
- '<div class="panel-heading"><h4>Node Manager<br>(' + normalizedNodeId + ')</h4></div>'+
- '<div class="panel-body"><ul class="nav nav-pills nav-stacked" id="stacked-menu">' +
- '<ul class="nav nav-pills nav-stacked collapse in"><li';
- if (hash.path == 'yarnNode') {
- html = html + ' class="active"';
- }
- html = html + '><a href="yarnNode/' + hash.nodeId + '/' + hash.nodeAddr +
- '">Node Information</a></li><li';
- if (hash.path == 'yarnNodeApps') {
- html = html + ' class="active"';
- }
- html = html + '><a href="yarnNodeApps/' + hash.nodeId + '/' + hash.nodeAddr +
- '">List of Applications</a></li><li';
- if (hash.path == 'yarnNodeContainers') {
- html = html + ' class="active"';
- }
- html = html + '><a href="yarnNodeContainers/' +hash.nodeId + '/' + hash.nodeAddr +
- '">List of Containers</a></li></ul></ul></div>';
- return Ember.String.htmlSafe(html);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/index.html
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/index.html b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/index.html
deleted file mode 100644
index edc4f2e..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/index.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <title>YarnUi</title>
- <meta name="description" content="">
- <meta name="viewport" content="width=device-width, initial-scale=1">
-
- {{content-for 'head'}}
-
- <link rel="stylesheet" href="assets/vendor.css">
- <link rel="stylesheet" href="assets/yarn-ui.css">
-
- {{content-for 'head-footer'}}
- </head>
- <body>
- {{content-for 'body'}}
-
- <script src="assets/vendor.js"></script>
- <script src="assets/yarn-ui.js"></script>
-
- {{content-for 'body-footer'}}
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/.gitkeep
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/.gitkeep b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/.gitkeep
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/cluster-info.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/cluster-info.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/cluster-info.js
deleted file mode 100644
index b1f0a88..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/cluster-info.js
+++ /dev/null
@@ -1,13 +0,0 @@
-import DS from 'ember-data';
-
-export default DS.Model.extend({
- startedOn: DS.attr('string'),
- state: DS.attr('string'),
- haState: DS.attr('string'),
- rmStateStoreName: DS.attr('string'),
- resourceManagerVersion: DS.attr('string'),
- resourceManagerBuildVersion: DS.attr('string'),
- hadoopVersion: DS.attr('string'),
- hadoopBuildVersion: DS.attr('string'),
- hadoopVersionBuiltOn: DS.attr('string')
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/cluster-metric.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/cluster-metric.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/cluster-metric.js
deleted file mode 100644
index 2dd428c..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/cluster-metric.js
+++ /dev/null
@@ -1,115 +0,0 @@
-import DS from 'ember-data';
-
-export default DS.Model.extend({
- appsSubmitted: DS.attr('number'),
- appsCompleted: DS.attr('number'),
- appsPending: DS.attr('number'),
- appsRunning: DS.attr('number'),
- appsFailed: DS.attr('number'),
- appsKilled: DS.attr('number'),
- reservedMB: DS.attr('number'),
- availableMB: DS.attr('number'),
- allocatedMB: DS.attr('number'),
- reservedVirtualCores: DS.attr('number'),
- availableVirtualCores: DS.attr('number'),
- allocatedVirtualCores: DS.attr('number'),
- containersAllocated: DS.attr('number'),
- containersReserved: DS.attr('number'),
- containersPending: DS.attr('number'),
- totalMB: DS.attr('number'),
- totalVirtualCores: DS.attr('number'),
- totalNodes: DS.attr('number'),
- lostNodes: DS.attr('number'),
- unhealthyNodes: DS.attr('number'),
- decommissionedNodes: DS.attr('number'),
- rebootedNodes: DS.attr('number'),
- activeNodes: DS.attr('number'),
-
- getFinishedAppsDataForDonutChart: function() {
- var arr = [];
- arr.push({
- label: "Completed",
- value: this.get("appsCompleted")
- });
- arr.push({
- label: "Killed",
- value: this.get("appsKilled")
- });
- arr.push({
- label: "Failed",
- value: this.get("appsFailed")
- });
-
- return arr;
- }.property("appsCompleted", "appsKilled", "appsFailed"),
-
- getRunningAppsDataForDonutChart: function() {
- var arr = [];
-
- arr.push({
- label: "Pending",
- value: this.get("appsPending")
- });
- arr.push({
- label: "Running",
- value: this.get("appsRunning")
- });
-
- return arr;
- }.property("appsPending", "appsRunning"),
-
- getNodesDataForDonutChart: function() {
- var arr = [];
- arr.push({
- label: "Active",
- value: this.get("activeNodes")
- });
- arr.push({
- label: "Unhealthy",
- value: this.get("unhealthyNodes")
- });
- arr.push({
- label: "Decomissioned",
- value: this.get("decommissionedNodes")
- });
- return arr;
- }.property("activeNodes", "unhealthyNodes", "decommissionedNodes"),
-
- getMemoryDataForDonutChart: function() {
- var type = "MB";
- var arr = [];
- arr.push({
- label: "Allocated",
- value: this.get("allocated" + type)
- });
- arr.push({
- label: "Reserved",
- value: this.get("reserved" + type)
- });
- arr.push({
- label: "Available",
- value: this.get("available" + type)
- });
-
- return arr;
- }.property("allocatedMB", "reservedMB", "availableMB"),
-
- getVCoreDataForDonutChart: function() {
- var type = "VirtualCores";
- var arr = [];
- arr.push({
- label: "Allocated",
- value: this.get("allocated" + type)
- });
- arr.push({
- label: "Reserved",
- value: this.get("reserved" + type)
- });
- arr.push({
- label: "Available",
- value: this.get("available" + type)
- });
-
- return arr;
- }.property("allocatedVirtualCores", "reservedVirtualCores", "availableVirtualCores"),
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app-attempt.js
deleted file mode 100644
index fcb5134..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app-attempt.js
+++ /dev/null
@@ -1,44 +0,0 @@
-import DS from 'ember-data';
-import Converter from 'yarn-ui/utils/converter';
-
-export default DS.Model.extend({
- startTime: DS.attr('string'),
- finishedTime: DS.attr('string'),
- containerId: DS.attr('string'),
- nodeHttpAddress: DS.attr('string'),
- nodeId: DS.attr('string'),
- logsLink: DS.attr('string'),
-
- startTs: function() {
- return Converter.dateToTimeStamp(this.get("startTime"));
- }.property("startTime"),
-
- finishedTs: function() {
- var ts = Converter.dateToTimeStamp(this.get("finishedTime"));
- return ts;
- }.property("finishedTime"),
-
- shortAppAttemptId: function() {
- return "attempt_" +
- parseInt(Converter.containerIdToAttemptId(this.get("containerId")).split("_")[3]);
- }.property("containerId"),
-
- elapsedTime: function() {
- var elapsedMs = this.get("finishedTs") - this.get("startTs");
- if (elapsedMs <= 0) {
- elapsedMs = Date.now() - this.get("startTs");
- }
-
- return Converter.msToElapsedTime(elapsedMs);
- }.property(),
-
- tooltipLabel: function() {
- return "<p>Id:" + this.get("id") +
- "</p><p>ElapsedTime:" +
- String(this.get("elapsedTime")) + "</p>";
- }.property(),
-
- link: function() {
- return "/yarnAppAttempt/" + this.get("id");
- }.property(),
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app.js
deleted file mode 100644
index fec2bd3..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app.js
+++ /dev/null
@@ -1,65 +0,0 @@
-import Converter from 'yarn-ui/utils/converter';
-import DS from 'ember-data';
-
-export default DS.Model.extend({
- appName: DS.attr('string'),
- user: DS.attr('string'),
- queue: DS.attr('string'),
- state: DS.attr('string'),
- startTime: DS.attr('string'),
- elapsedTime: DS.attr('string'),
- finalStatus: DS.attr('string'),
- finishedTime: DS.attr('finishedTime'),
- progress: DS.attr('number'),
- diagnostics: DS.attr('string'),
- amContainerLogs: DS.attr('string'),
- amHostHttpAddress: DS.attr('string'),
- logAggregationStatus: DS.attr('string'),
- unmanagedApplication: DS.attr('string'),
- amNodeLabelExpression: DS.attr('string'),
- applicationTags: DS.attr('string'),
- priority: DS.attr('number'),
- allocatedMB: DS.attr('number'),
- allocatedVCores: DS.attr('number'),
- runningContainers: DS.attr('number'),
- memorySeconds: DS.attr('number'),
- vcoreSeconds: DS.attr('number'),
- preemptedResourceMB: DS.attr('number'),
- preemptedResourceVCores: DS.attr('number'),
- numNonAMContainerPreempted: DS.attr('number'),
- numAMContainerPreempted: DS.attr('number'),
-
- isFailed: function() {
- return this.get('finalStatus') == "FAILED"
- }.property("finalStatus"),
-
- allocatedResource: function() {
- return Converter.resourceToString(this.get("allocatedMB"), this.get("allocatedVCores"));
- }.property("allocatedMB", "allocatedVCores"),
-
- preemptedResource: function() {
- return Converter.resourceToString(this.get("preemptedResourceMB"), this.get("preemptedResourceVCores"));
- }.property("preemptedResourceMB", "preemptedResourceVCores"),
-
- aggregatedResourceUsage: function() {
- return Converter.resourceToString(this.get("memorySeconds"), this.get("vcoreSeconds")) + " (� Secs)";
- }.property("memorySeconds", "vcoreSeconds"),
-
- progressStyle: function() {
- return "width: " + this.get("progress") + "%";
- }.property("progress"),
-
- finalStatusStyle: function() {
- var style = "default";
- var finalStatus = this.get("finalStatus");
- if (finalStatus == "KILLED") {
- style = "warning";
- } else if (finalStatus == "FAILED") {
- style = "danger";
- } else {
- style = "success";
- }
-
- return "label label-" + style;
- }.property("finalStatus")
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-container-log.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-container-log.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-container-log.js
deleted file mode 100644
index 31cf61e..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-container-log.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * 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.
- */
-
-import DS from 'ember-data';
-
-export default DS.Model.extend({
- logs: DS.attr('string'),
- containerID: DS.attr('string'),
- logFileName: DS.attr('string')
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-container.js
deleted file mode 100644
index f7977be..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-container.js
+++ /dev/null
@@ -1,39 +0,0 @@
-import DS from 'ember-data';
-import Converter from 'yarn-ui/utils/converter';
-
-export default DS.Model.extend({
- allocatedMB: DS.attr('number'),
- allocatedVCores: DS.attr('number'),
- assignedNodeId: DS.attr('string'),
- priority: DS.attr('number'),
- startedTime: DS.attr('number'),
- finishedTime: DS.attr('number'),
- logUrl: DS.attr('string'),
- containerExitStatus: DS.attr('number'),
- containerState: DS.attr('string'),
- nodeHttpAddress: DS.attr('string'),
-
- startTs: function() {
- return Converter.dateToTimeStamp(this.get("startedTime"));
- }.property("startedTime"),
-
- finishedTs: function() {
- var ts = Converter.dateToTimeStamp(this.get("finishedTime"));
- return ts;
- }.property("finishedTime"),
-
- elapsedTime: function() {
- var elapsedMs = this.get("finishedTs") - this.get("startTs");
- if (elapsedMs <= 0) {
- elapsedMs = Date.now() - this.get("startTs");
- }
-
- return Converter.msToElapsedTime(elapsedMs);
- }.property(),
-
- tooltipLabel: function() {
- return "<p>Id:" + this.get("id") +
- "</p><p>ElapsedTime:" +
- String(this.get("elapsedTime")) + "</p>";
- }.property(),
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-app.js
deleted file mode 100644
index 6dc69ae..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-app.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.
- */
-
-import DS from 'ember-data';
-
-export default DS.Model.extend({
- appId: DS.attr('string'),
- state: DS.attr('string'),
- user: DS.attr('string'),
- containers: DS.attr('array'),
- /**
- * Indicates no rows were retrieved from backend
- */
- isDummyApp: function() {
- return this.get('id') == "dummy";
- }.property("id"),
-
- appStateStyle: function() {
- var style = "default";
- var appState = this.get("state");
- if (appState == "RUNNING" || appState == "FINISHING_CONTAINERS_WAIT" ||
- appState == "APPLICATION_RESOURCES_CLEANINGUP") {
- style = "primary";
- } else if (appState == "FINISHED") {
- style = "success";
- }
- return "label label-" + style;
- }.property("state")
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-container.js
deleted file mode 100644
index 3ba3216..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-container.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * 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.
- */
-
-import DS from 'ember-data';
-
-export default DS.Model.extend({
- containerId: DS.attr('string'),
- state: DS.attr('string'),
- user: DS.attr('string'),
- exitCode: DS.attr('string'),
- diagnostics: DS.attr('string'),
- totalMemoryNeeded: DS.attr('number'),
- totalVCoresNeeded: DS.attr('number'),
- containerLogFiles: DS.attr('array'),
-
- /**
- * Indicates that there was no container retrieved from backend.
- */
- isDummyContainer: function() {
- return this.get('id') == "dummy";
- }.property("id"),
-
- containerStateStyle: function() {
- var style = "primary";
- var containerState = this.get('state');
- var containerExitCode = this.get('exitCode');
- if (containerState == "DONE") {
- if (containerExitCode == "0") {
- style = "success";
- } else if (containerExitCode != "N/A") {
- style = "danger";
- }
- }
- if (containerState == "EXITED_WITH_SUCCESS") {
- style = "success";
- }
- if (containerState == "EXITED_WITH_FAILURE") {
- style = "danger";
- }
- return "label label-" + style;
- }.property("state", "exitCode")
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node.js
deleted file mode 100644
index 4753983..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.
- */
-
-import DS from 'ember-data';
-
-export default DS.Model.extend({
- totalVmemAllocatedContainersMB: DS.attr('number'),
- totalPmemAllocatedContainersMB: DS.attr('number'),
- totalVCoresAllocatedContainers: DS.attr('number'),
- vmemCheckEnabled: DS.attr('boolean'),
- pmemCheckEnabled: DS.attr('boolean'),
- nodeHealthy: DS.attr('boolean'),
- lastNodeUpdateTime: DS.attr('string'),
- healthReport: DS.attr('string'),
- nmStartupTime: DS.attr('string'),
- nodeManagerBuildVersion: DS.attr('string'),
- hadoopBuildVersion: DS.attr('string'),
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-queue.js
deleted file mode 100644
index 5b91d70..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-queue.js
+++ /dev/null
@@ -1,76 +0,0 @@
-import DS from 'ember-data';
-
-export default DS.Model.extend({
- name: DS.attr('string'),
- children: DS.attr('array'),
- parent: DS.attr('string'),
- capacity: DS.attr('number'),
- maxCapacity: DS.attr('number'),
- usedCapacity: DS.attr('number'),
- absCapacity: DS.attr('number'),
- absMaxCapacity: DS.attr('number'),
- absUsedCapacity: DS.attr('number'),
- state: DS.attr('string'),
- userLimit: DS.attr('number'),
- userLimitFactor: DS.attr('number'),
- preemptionDisabled: DS.attr('number'),
- numPendingApplications: DS.attr('number'),
- numActiveApplications: DS.attr('number'),
- users: DS.hasMany('YarnUser'),
-
- isLeafQueue: function() {
- var len = this.get("children.length");
- if (!len) {
- return true;
- }
- return len <= 0;
- }.property("children"),
-
- capacitiesBarChartData: function() {
- return [
- {
- label: "Absolute Capacity",
- value: this.get("name") == "root" ? 100 : this.get("absCapacity")
- },
- {
- label: "Absolute Used",
- value: this.get("name") == "root" ? this.get("usedCapacity") : this.get("absUsedCapacity")
- },
- {
- label: "Absolute Max Capacity",
- value: this.get("name") == "root" ? 100 : this.get("absMaxCapacity")
- }
- ]
- }.property("absCapacity", "absUsedCapacity", "absMaxCapacity"),
-
- userUsagesDonutChartData: function() {
- var data = [];
- if (this.get("users")) {
- this.get("users").forEach(function(o) {
- data.push({
- label: o.get("name"),
- value: o.get("usedMemoryMB")
- })
- });
- }
-
- return data;
- }.property("users"),
-
- hasUserUsages: function() {
- return this.get("userUsagesDonutChartData").length > 0;
- }.property(),
-
- numOfApplicationsDonutChartData: function() {
- return [
- {
- label: "Pending Apps",
- value: this.get("numPendingApplications") || 0 // TODO, fix the REST API so root will return #applications as well.
- },
- {
- label: "Active Apps",
- value: this.get("numActiveApplications") || 0
- }
- ]
- }.property(),
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-rm-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-rm-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-rm-node.js
deleted file mode 100644
index 9a1082c..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-rm-node.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * 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.
- */
-
-import DS from 'ember-data';
-
-export default DS.Model.extend({
- rack: DS.attr('string'),
- state: DS.attr('string'),
- nodeHostName: DS.attr('string'),
- nodeHTTPAddress: DS.attr('string'),
- lastHealthUpdate: DS.attr('string'),
- healthReport: DS.attr('string'),
- numContainers: DS.attr('number'),
- usedMemoryMB: DS.attr('number'),
- availMemoryMB: DS.attr('number'),
- usedVirtualCores: DS.attr('number'),
- availableVirtualCores: DS.attr('number'),
- version: DS.attr('string'),
- nodeLabels: DS.attr('array'),
-
- nodeLabelsAsString: function() {
- var labels = this.get("nodeLabels");
- var labelToReturn = "";
- // Only one label per node supported.
- if (labels && labels.length > 0) {
- labelToReturn = labels[0];
- }
- return labelToReturn;
- }.property("nodeLabels"),
-
- /**
- * Indicates no rows were retrieved from backend
- */
- isDummyNode: function() {
- return this.get('id') == "dummy";
- }.property("id"),
-
- nodeStateStyle: function() {
- var style = "default";
- var nodeState = this.get("state");
- if (nodeState == "REBOOTED") {
- style = "warning";
- } else if (nodeState == "UNHEALTHY" || nodeState == "DECOMMISSIONED" ||
- nodeState == "LOST" || nodeState == "SHUTDOWN") {
- style = "danger";
- } else if (nodeState == "RUNNING") {
- style = "success";
- }
- return "label label-" + style;
- }.property("state"),
-
- getMemoryDataForDonutChart: function() {
- var arr = [];
- arr.push({
- label: "Used",
- value: this.get("usedMemoryMB")
- });
- arr.push({
- label: "Available",
- value: this.get("availMemoryMB")
- });
- return arr;
- }.property("availMemoryMB", "usedMemoryMB"),
-
- getVCoreDataForDonutChart: function() {
- var arr = [];
- arr.push({
- label: "Used",
- value: this.get("usedVirtualCores")
- });
- arr.push({
- label: "Available",
- value: this.get("availableVirtualCores")
- });
- return arr;
- }.property("availableVirtualCores", "usedVirtualCores"),
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-user.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-user.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-user.js
deleted file mode 100644
index 6e9c03c..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-user.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import DS from 'ember-data';
-
-export default DS.Model.extend({
- name: DS.attr('string'),
- queueName: DS.attr('string'),
- usedMemoryMB: DS.attr('number'),
- usedVCore: DS.attr('number')
-})
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/router.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/router.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/router.js
deleted file mode 100644
index 5db083e..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/router.js
+++ /dev/null
@@ -1,29 +0,0 @@
-import Ember from 'ember';
-import config from './config/environment';
-
-var Router = Ember.Router.extend({
- location: config.locationType
-});
-
-Router.map(function() {
- this.route('yarnApps');
- this.route('yarnNodes');
- this.route('yarnNode', { path: '/yarnNode/:node_id/:node_addr' });
- this.route('yarnNodeApps', { path: '/yarnNodeApps/:node_id/:node_addr' });
- this.route('yarnNodeApp',
- { path: '/yarnNodeApp/:node_id/:node_addr/:app_id' });
- this.route('yarnNodeContainers',
- { path: '/yarnNodeContainers/:node_id/:node_addr' });
- this.route('yarnNodeContainer',
- { path: '/yarnNodeContainer/:node_id/:node_addr/:container_id' });
- this.route('yarnContainerLog', { path:
- '/yarnContainerLog/:node_id/:node_addr/:container_id/:filename' });
- this.route('yarnQueue', { path: '/yarnQueue/:queue_name' });
- this.route('clusterOverview');
- this.route('yarnApp', { path: '/yarnApp/:app_id' });
- this.route('yarnAppAttempt', { path: '/yarnAppAttempt/:app_attempt_id'});
- this.route('error');
- this.route('notfound', { path: '*:' });
-});
-
-export default Router;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/.gitkeep
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/.gitkeep b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/.gitkeep
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/application.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/application.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/application.js
deleted file mode 100644
index b7a5754..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/application.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * 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.
- */
-
-import Ember from 'ember';
-
-export default Ember.Route.extend({
- actions: {
- /**
- * Base error handler for the application.
- * If specific routes do not handle the error, it will bubble up to
- * this handler. Here we redirect to either 404 page or a generic
- * error handler page.
- */
- error: function (error) {
- if (error && error.errors[0] &&
- error.errors[0].status == 404) {
- this.intermediateTransitionTo('/notfound');
- } else {
- this.intermediateTransitionTo('/error');
- }
- }
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/cluster-overview.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/cluster-overview.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/cluster-overview.js
deleted file mode 100644
index 4ba5dcd..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/cluster-overview.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Route.extend({
- model() {
- return this.store.findAll('ClusterMetric');
- },
-
- afterModel() {
- this.controllerFor("ClusterOverview").set("loading", false);
- }
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/index.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/index.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/index.js
deleted file mode 100644
index b228ff4..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/index.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * 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.
- */
-
-import Ember from 'ember';
-
-export default Ember.Route.extend({
- /**
- * Redirect root URL to cluster overview page.
- */
- beforeModel: function() {
- this.replaceWith('clusterOverview');
- }
-});
-
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-app-attempt.js
deleted file mode 100644
index 3b6adc7..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-app-attempt.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Route.extend({
- model(param) {
- return Ember.RSVP.hash({
- attempt: this.store.findRecord('yarnAppAttempt', param.app_attempt_id),
-
- rmContainers: this.store.query('yarnContainer',
- {
- app_attempt_id: param.app_attempt_id,
- is_rm: true
- }),
-
- tsContainers: this.store.query('yarnContainer',
- {
- app_attempt_id: param.app_attempt_id,
- is_rm: false
- }),
- });
- }
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-app.js
deleted file mode 100644
index 03092aa..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-app.js
+++ /dev/null
@@ -1,10 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Route.extend({
- model(param) {
- return Ember.RSVP.hash({
- app: this.store.find('yarnApp', param.app_id),
- attempts: this.store.query('yarnAppAttempt', { appId: param.app_id})
- });
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-apps.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-apps.js
deleted file mode 100644
index 2787f5b..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-apps.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Route.extend({
- model() {
- var apps = this.store.findAll('yarnApp');
- return apps;
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-container-log.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-container-log.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-container-log.js
deleted file mode 100644
index c324025..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-container-log.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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.
- */
-
-import Ember from 'ember';
-import Constants from 'yarn-ui/constants';
-
-export default Ember.Route.extend({
- model(param) {
- var id = param.node_addr + Constants.PARAM_SEPARATOR + param.container_id +
- Constants.PARAM_SEPARATOR + param.filename;
- return Ember.RSVP.hash({
- containerLog: this.store.findRecord('yarnContainerLog', id),
- nodeInfo: { id: param.node_id, addr: param.node_addr }
- }).then(function(hash) {
- // Just return as its success.
- return hash;
- }, function(reason) {
- if (reason.errors && reason.errors[0]) {
- // This means HTTP error response was sent by adapter.
- return reason;
- } else {
- // Assume empty response received from server.
- return { nodeInfo: { id: param.node_id, addr: param.node_addr },
- containerLog: { logs: "", containerID: param.container_id,
- logFileName: param.filename}};
- }
- });
- },
-
- afterModel(model) {
- // Handle errors and redirect if promise is rejected.
- if (model.errors && model.errors[0]) {
- if (model.errors[0].status == 404) {
- this.replaceWith('/notfound');
- } else {
- this.replaceWith('/error');
- }
- }
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-app.js
deleted file mode 100644
index 63b1f2a..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-app.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * 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.
- */
-
-import Ember from 'ember';
-
-export default Ember.Route.extend({
- model(param) {
- return Ember.RSVP.hash({
- nodeApp: this.store.queryRecord('yarnNodeApp',
- { nodeAddr : param.node_addr, appId: param.app_id }),
- nodeInfo: { id: param.node_id, addr: param.node_addr }
- });
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-apps.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-apps.js
deleted file mode 100644
index ffb5b7b..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-apps.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * 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.
- */
-
-import Ember from 'ember';
-
-export default Ember.Route.extend({
- model(param) {
- // Get all apps running on a specific node. Node is contacted by using node_addr.
- return Ember.RSVP.hash({
- apps: this.store.query('yarnNodeApp', { nodeAddr: param.node_addr }),
- nodeInfo: { id: param.node_id, addr: param.node_addr }
- });
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-container.js
deleted file mode 100644
index 2022662..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-container.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.
- */
-
-import Ember from 'ember';
-
-export default Ember.Route.extend({
- model(param) {
- // Get a specific container running on a specific node.
- return Ember.RSVP.hash({
- nodeContainer: this.store.queryRecord('yarnNodeContainer',
- { nodeHttpAddr: param.node_addr, containerId: param.container_id }),
- nodeInfo: { id: param.node_id, addr: param.node_addr }
- });
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-containers.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-containers.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-containers.js
deleted file mode 100644
index 9a69729..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-containers.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * 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.
- */
-import Ember from 'ember';
-
-export default Ember.Route.extend({
- model(param) {
- // Get all containers running on specific node.
- return Ember.RSVP.hash({
- containers: this.store.query('yarnNodeContainer', { nodeHttpAddr: param.node_addr }),
- nodeInfo: { id: param.node_id, addr: param.node_addr }
- });
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node.js
deleted file mode 100644
index 7c58b94..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * 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.
- */
-
-import Ember from 'ember';
-
-export default Ember.Route.extend({
- model(param) {
- // Fetches data from both NM and RM. RM is queried to get node usage info.
- return Ember.RSVP.hash({
- node: this.store.findRecord('yarnNode', param.node_addr),
- rmNode: this.store.findRecord('yarnRmNode', param.node_id)
- });
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-nodes.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-nodes.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-nodes.js
deleted file mode 100644
index f33eef8..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-nodes.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * 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.
- */
-
-import Ember from 'ember';
-
-export default Ember.Route.extend({
- model() {
- return this.store.findAll('yarnRmNode');
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queue.js
deleted file mode 100644
index 9396bac..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queue.js
+++ /dev/null
@@ -1,20 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Route.extend({
- model(param) {
- return Ember.RSVP.hash({
- selected : param.queue_name,
- queues: this.store.findAll('yarnQueue'),
- selectedQueue : undefined,
- apps: undefined, // apps of selected queue
- });
- },
-
- afterModel(model) {
- model.selectedQueue = this.store.peekRecord('yarnQueue', model.selected);
- model.apps = this.store.findAll('yarnApp');
- model.apps.forEach(function(o) {
- console.log(o);
- })
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queues/index.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queues/index.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queues/index.js
deleted file mode 100644
index 9be90b1..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queues/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-export default Ember.Route.extend({
- beforeModel() {
- this.transitionTo('yarnQueues.root');
- }
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queues/queues-selector.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queues/queues-selector.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queues/queues-selector.js
deleted file mode 100644
index 0f6c572..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queues/queues-selector.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Route.extend({
- model() {
- return this.store.findAll('yarnQueue');
- },
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-info.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-info.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-info.js
deleted file mode 100644
index cc936cb..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-info.js
+++ /dev/null
@@ -1,29 +0,0 @@
-import DS from 'ember-data';
-
-export default DS.JSONAPISerializer.extend({
- normalizeSingleResponse(store, primaryModelClass, payload, id,
- requestType) {
- var fixedPayload = {
- id: id,
- type: primaryModelClass.modelName,
- attributes: payload
- };
-
- return this._super(store, primaryModelClass, fixedPayload, id,
- requestType);
- },
-
- normalizeArrayResponse(store, primaryModelClass, payload, id,
- requestType) {
- // return expected is { data: [ {}, {} ] }
- var normalizedArrayResponse = {};
-
- // payload has apps : { app: [ {},{},{} ] }
- // need some error handling for ex apps or app may not be defined.
- normalizedArrayResponse.data = [
- this.normalizeSingleResponse(store, primaryModelClass,
- payload.clusterInfo, payload.clusterInfo.id, requestType)
- ];
- return normalizedArrayResponse;
- }
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-metric.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-metric.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-metric.js
deleted file mode 100644
index d39885e..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-metric.js
+++ /dev/null
@@ -1,29 +0,0 @@
-import DS from 'ember-data';
-
-export default DS.JSONAPISerializer.extend({
- normalizeSingleResponse(store, primaryModelClass, payload, id,
- requestType) {
- var fixedPayload = {
- id: id,
- type: primaryModelClass.modelName,
- attributes: payload
- };
-
- return this._super(store, primaryModelClass, fixedPayload, id,
- requestType);
- },
-
- normalizeArrayResponse(store, primaryModelClass, payload, id,
- requestType) {
- // return expected is { data: [ {}, {} ] }
- var normalizedArrayResponse = {};
-
- // payload has apps : { app: [ {},{},{} ] }
- // need some error handling for ex apps or app may not be defined.
- normalizedArrayResponse.data = [
- this.normalizeSingleResponse(store, primaryModelClass,
- payload.clusterMetrics, 1, requestType)
- ];
- return normalizedArrayResponse;
- }
-});
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[40/50] [abbrv] hadoop git commit: YARN-4849. [YARN-3368] cleanup
code base, integrate web UI related build to mvn, and fix licenses. (wangda)
Posted by wa...@apache.org.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app-attempt.js
deleted file mode 100644
index c5394d0..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app-attempt.js
+++ /dev/null
@@ -1,49 +0,0 @@
-import DS from 'ember-data';
-import Converter from 'yarn-ui/utils/converter';
-
-export default DS.JSONAPISerializer.extend({
- internalNormalizeSingleResponse(store, primaryModelClass, payload, id,
- requestType) {
-
- if (payload.appAttempt) {
- payload = payload.appAttempt;
- }
-
- var fixedPayload = {
- id: payload.appAttemptId,
- type: primaryModelClass.modelName, // yarn-app
- attributes: {
- startTime: Converter.timeStampToDate(payload.startTime),
- finishedTime: Converter.timeStampToDate(payload.finishedTime),
- containerId: payload.containerId,
- nodeHttpAddress: payload.nodeHttpAddress,
- nodeId: payload.nodeId,
- state: payload.nodeId,
- logsLink: payload.logsLink
- }
- };
-
- return fixedPayload;
- },
-
- normalizeSingleResponse(store, primaryModelClass, payload, id,
- requestType) {
- var p = this.internalNormalizeSingleResponse(store,
- primaryModelClass, payload, id, requestType);
- return { data: p };
- },
-
- normalizeArrayResponse(store, primaryModelClass, payload, id,
- requestType) {
- // return expected is { data: [ {}, {} ] }
- var normalizedArrayResponse = {};
-
- // payload has apps : { app: [ {},{},{} ] }
- // need some error handling for ex apps or app may not be defined.
- normalizedArrayResponse.data = payload.appAttempts.appAttempt.map(singleApp => {
- return this.internalNormalizeSingleResponse(store, primaryModelClass,
- singleApp, singleApp.id, requestType);
- }, this);
- return normalizedArrayResponse;
- }
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app.js
deleted file mode 100644
index a038fff..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app.js
+++ /dev/null
@@ -1,66 +0,0 @@
-import DS from 'ember-data';
-import Converter from 'yarn-ui/utils/converter';
-
-export default DS.JSONAPISerializer.extend({
- internalNormalizeSingleResponse(store, primaryModelClass, payload, id,
- requestType) {
- if (payload.app) {
- payload = payload.app;
- }
-
- var fixedPayload = {
- id: id,
- type: primaryModelClass.modelName, // yarn-app
- attributes: {
- appName: payload.name,
- user: payload.user,
- queue: payload.queue,
- state: payload.state,
- startTime: Converter.timeStampToDate(payload.startedTime),
- elapsedTime: Converter.msToElapsedTime(payload.elapsedTime),
- finishedTime: Converter.timeStampToDate(payload.finishedTime),
- finalStatus: payload.finalStatus,
- progress: payload.progress,
- diagnostics: payload.diagnostics,
- amContainerLogs: payload.amContainerLogs,
- amHostHttpAddress: payload.amHostHttpAddress,
- logAggregationStatus: payload.logAggregationStatus,
- unmanagedApplication: payload.unmanagedApplication,
- amNodeLabelExpression: payload.amNodeLabelExpression,
- priority: payload.priority,
- allocatedMB: payload.allocatedMB,
- allocatedVCores: payload.allocatedVCores,
- runningContainers: payload.runningContainers,
- memorySeconds: payload.memorySeconds,
- vcoreSeconds: payload.vcoreSeconds,
- preemptedResourceMB: payload.preemptedResourceMB,
- preemptedResourceVCores: payload.preemptedResourceVCores,
- numNonAMContainerPreempted: payload.numNonAMContainerPreempted,
- numAMContainerPreempted: payload.numAMContainerPreempted
- }
- };
-
- return fixedPayload;
- },
-
- normalizeSingleResponse(store, primaryModelClass, payload, id,
- requestType) {
- var p = this.internalNormalizeSingleResponse(store,
- primaryModelClass, payload, id, requestType);
- return { data: p };
- },
-
- normalizeArrayResponse(store, primaryModelClass, payload, id,
- requestType) {
- // return expected is { data: [ {}, {} ] }
- var normalizedArrayResponse = {};
-
- // payload has apps : { app: [ {},{},{} ] }
- // need some error handling for ex apps or app may not be defined.
- normalizedArrayResponse.data = payload.apps.app.map(singleApp => {
- return this.internalNormalizeSingleResponse(store, primaryModelClass,
- singleApp, singleApp.id, requestType);
- }, this);
- return normalizedArrayResponse;
- }
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-container-log.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-container-log.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-container-log.js
deleted file mode 100644
index 9e10615..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-container-log.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.
- */
-
-import DS from 'ember-data';
-import Converter from 'yarn-ui/utils/converter';
-
-export default DS.JSONAPISerializer.extend({
- normalizeSingleResponse(store, primaryModelClass, payload, id,
- requestType) {
- // Convert plain text response into JSON.
- // ID is of the form nodeAddress!containerId!fileName
- var splits = Converter.splitForContainerLogs(id);
- var convertedPayload = {
- id: id,
- type: primaryModelClass.modelName,
- attributes: {
- logs: payload,
- containerID: splits[1],
- logFileName: splits[2]
- }
- };
- return { data: convertedPayload };
- },
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-container.js
deleted file mode 100644
index 665b9df..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-container.js
+++ /dev/null
@@ -1,54 +0,0 @@
-import DS from 'ember-data';
-import Converter from 'yarn-ui/utils/converter';
-
-export default DS.JSONAPISerializer.extend({
- internalNormalizeSingleResponse(store, primaryModelClass, payload, id,
- requestType) {
-
- var fixedPayload = {
- id: payload.containerId,
- type: primaryModelClass.modelName, // yarn-app
- attributes: {
- allocatedMB: payload.allocatedMB,
- allocatedVCores: payload.allocatedVCores,
- assignedNodeId: payload.assignedNodeId,
- priority: payload.priority,
- startedTime: Converter.timeStampToDate(payload.startedTime),
- finishedTime: Converter.timeStampToDate(payload.finishedTime),
- elapsedTime: payload.elapsedTime,
- logUrl: payload.logUrl,
- containerExitStatus: payload.containerExitStatus,
- containerState: payload.containerState,
- nodeHttpAddress: payload.nodeHttpAddress
- }
- };
-
- return fixedPayload;
- },
-
- normalizeSingleResponse(store, primaryModelClass, payload, id,
- requestType) {
- var p = this.internalNormalizeSingleResponse(store,
- primaryModelClass, payload, id, requestType);
- return { data: p };
- },
-
- normalizeArrayResponse(store, primaryModelClass, payload, id,
- requestType) {
- // return expected is { data: [ {}, {} ] }
- var normalizedArrayResponse = {};
-
- if (payload && payload.container) {
- // payload has apps : { app: [ {},{},{} ] }
- // need some error handling for ex apps or app may not be defined.
- normalizedArrayResponse.data = payload.container.map(singleContainer => {
- return this.internalNormalizeSingleResponse(store, primaryModelClass,
- singleContainer, singleContainer.id, requestType);
- }, this);
- return normalizedArrayResponse;
- }
-
- normalizedArrayResponse.data = [];
- return normalizedArrayResponse;
- }
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-app.js
deleted file mode 100644
index 8b1f152..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-app.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * 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.
- */
-/**
- * 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.
- */
-
-import DS from 'ember-data';
-import Ember from 'ember';
-
-export default DS.JSONAPISerializer.extend({
- internalNormalizeSingleResponse(store, primaryModelClass, payload) {
- if (payload.app) {
- payload = payload.app;
- }
-
- var fixedPayload = {
- id: payload.id,
- type: primaryModelClass.modelName,
- attributes: {
- appId: payload.id,
- state: payload.state,
- user: payload.user,
- containers: payload.containerids
- }
- };
- return fixedPayload;
- },
-
- normalizeSingleResponse(store, primaryModelClass, payload, id,
- requestType) {
- // payload is of the form {"app":{}}
- var p = this.internalNormalizeSingleResponse(store,
- primaryModelClass, payload);
- return { data: p };
- },
-
- normalizeArrayResponse(store, primaryModelClass, payload, id,
- requestType) {
- // expected return response is of the form { data: [ {}, {} ] }
- var normalizedArrayResponse = {};
- // payload is of the form { "apps" : { "app": [ {},{},{} ] } }
- if (payload.apps) {
- normalizedArrayResponse.data = payload.apps.app.map(singleApp => {
- return this.internalNormalizeSingleResponse(store, primaryModelClass,
- singleApp);
- }, this);
- } else {
- // No container reported inside containers.
- // Response of the form { "apps": null }
- normalizedArrayResponse.data = Ember.makeArray({
- id: "dummy",
- type: primaryModelClass.modelName,
- attributes: {}});
- }
- return normalizedArrayResponse;
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-container.js
deleted file mode 100644
index 528f2fe..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-container.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * 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.
- */
-
-import DS from 'ember-data';
-import Ember from 'ember';
-
-export default DS.JSONAPISerializer.extend({
- internalNormalizeSingleResponse(store, primaryModelClass, payload) {
- if (payload.container) {
- payload = payload.container;
- }
- var fixedPayload = {
- id: payload.id,
- type: primaryModelClass.modelName,
- attributes: {
- containerId: payload.id,
- state: payload.state,
- user: payload.user,
- diagnostics: payload.diagnostics,
- exitCode: payload.exitCode,
- totalMemoryNeeded: payload.totalMemoryNeededMB,
- totalVCoresNeeded: payload.totalVCoresNeeded,
- containerLogFiles: payload.containerLogFiles
- }
- };
-
- return fixedPayload;
- },
-
- normalizeSingleResponse(store, primaryModelClass, payload, id,
- requestType) {
- // payload is of the form {"container":{}}
- var p = this.internalNormalizeSingleResponse(store,
- primaryModelClass, payload);
- return { data: p };
- },
-
- normalizeArrayResponse(store, primaryModelClass, payload, id,
- requestType) {
- // expected return response is of the form { data: [ {}, {} ] }
- var normalizedArrayResponse = {};
- if (payload.containers) {
- // payload is of the form { "containers" : { "container": [ {},{},{} ] } }
- normalizedArrayResponse.data =
- payload.containers.container.map(singleContainer => {
- return this.internalNormalizeSingleResponse(store, primaryModelClass,
- singleContainer);
- }, this);
- } else {
- // No container reported inside containers.
- // Response of the form { "containers": null }
- normalizedArrayResponse.data = Ember.makeArray({
- id: "dummy",
- type: primaryModelClass.modelName,
- attributes: {}});
- }
- return normalizedArrayResponse;
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node.js
deleted file mode 100644
index 19308e2..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * 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.
- */
-
-import DS from 'ember-data';
-import Converter from 'yarn-ui/utils/converter';
-
-export default DS.JSONAPISerializer.extend({
- internalNormalizeSingleResponse(store, primaryModelClass, payload, id,
- requestType) {
- if (payload.nodeInfo) {
- payload = payload.nodeInfo;
- }
-
- var fixedPayload = {
- id: id,
- type: primaryModelClass.modelName,
- attributes: {
- totalVmemAllocatedContainersMB: payload.totalVmemAllocatedContainersMB,
- totalPmemAllocatedContainersMB: payload.totalPmemAllocatedContainersMB,
- totalVCoresAllocatedContainers: payload.totalVCoresAllocatedContainers,
- vmemCheckEnabled: payload.vmemCheckEnabled,
- pmemCheckEnabled: payload.pmemCheckEnabled,
- nodeHealthy: payload.nodeHealthy,
- lastNodeUpdateTime: Converter.timeStampToDate(payload.lastNodeUpdateTime),
- healthReport: payload.healthReport,
- nmStartupTime: Converter.timeStampToDate(payload.nmStartupTime),
- nodeManagerBuildVersion: payload.nodeManagerBuildVersion,
- hadoopBuildVersion: payload.hadoopBuildVersion
- }
- };
- return fixedPayload;
- },
-
- normalizeSingleResponse(store, primaryModelClass, payload, id,
- requestType) {
- // payload is of the form {"nodeInfo":{}}
- var p = this.internalNormalizeSingleResponse(store,
- primaryModelClass, payload, id, requestType);
- return { data: p };
- },
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-queue.js
deleted file mode 100644
index ce4d775..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-queue.js
+++ /dev/null
@@ -1,127 +0,0 @@
-import DS from 'ember-data';
-
-export default DS.JSONAPISerializer.extend({
-
- normalizeSingleResponse(store, primaryModelClass, payload, id,
- requestType) {
- var children = [];
- if (payload.queues) {
- payload.queues.queue.forEach(function(queue) {
- children.push(queue.queueName);
- });
- }
-
- var includedData = [];
- var relationshipUserData = [];
-
- // update user models
- if (payload.users && payload.users.user) {
- payload.users.user.forEach(function(u) {
- includedData.push({
- type: "YarnUser",
- id: u.username + "_" + payload.queueName,
- attributes: {
- name: u.username,
- queueName: payload.queueName,
- usedMemoryMB: u.resourcesUsed.memory || 0,
- usedVCore: u.resourcesUsed.vCores || 0,
- }
- });
-
- relationshipUserData.push({
- type: "YarnUser",
- id: u.username + "_" + payload.queueName,
- })
- });
- }
-
-
- var fixedPayload = {
- id: id,
- type: primaryModelClass.modelName, // yarn-queue
- attributes: {
- name: payload.queueName,
- parent: payload.myParent,
- children: children,
- capacity: payload.capacity,
- usedCapacity: payload.usedCapacity,
- maxCapacity: payload.maxCapacity,
- absCapacity: payload.absoluteCapacity,
- absMaxCapacity: payload.absoluteMaxCapacity,
- absUsedCapacity: payload.absoluteUsedCapacity,
- state: payload.state,
- userLimit: payload.userLimit,
- userLimitFactor: payload.userLimitFactor,
- preemptionDisabled: payload.preemptionDisabled,
- numPendingApplications: payload.numPendingApplications,
- numActiveApplications: payload.numActiveApplications,
- },
- // Relationships
- relationships: {
- users: {
- data: relationshipUserData
- }
- }
- };
-
- return {
- queue: this._super(store, primaryModelClass, fixedPayload, id, requestType),
- includedData: includedData
- }
- },
-
- handleQueue(store, primaryModelClass, payload, id, requestType) {
- var data = [];
- var includedData = []
- var result = this.normalizeSingleResponse(store, primaryModelClass,
- payload, id, requestType);
-
- data.push(result.queue);
- includedData = includedData.concat(result.includedData);
-
- if (payload.queues) {
- for (var i = 0; i < payload.queues.queue.length; i++) {
- var queue = payload.queues.queue[i];
- queue.myParent = payload.queueName;
- var childResult = this.handleQueue(store, primaryModelClass, queue,
- queue.queueName,
- requestType);
-
- data = data.concat(childResult.data);
- includedData = includedData.concat(childResult.includedData);
- }
- }
-
- return {
- data: data,
- includedData, includedData
- }
- },
-
- normalizeArrayResponse(store, primaryModelClass, payload, id,
- requestType) {
- var normalizedArrayResponse = {};
- var result = this.handleQueue(store,
- primaryModelClass,
- payload.scheduler.schedulerInfo, "root", requestType);
-
- normalizedArrayResponse.data = result.data;
- normalizedArrayResponse.included = result.includedData;
-
- console.log(normalizedArrayResponse);
-
- return normalizedArrayResponse;
-
- /*
- // return expected is { data: [ {}, {} ] }
- var normalizedArrayResponse = {};
-
- // payload has apps : { app: [ {},{},{} ] }
- // need some error handling for ex apps or app may not be defined.
- normalizedArrayResponse.data = payload.apps.app.map(singleApp => {
- return this.normalizeSingleResponse(store, primaryModelClass, singleApp, singleApp.id, requestType);
- }, this);
- return normalizedArrayResponse;
- */
- }
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-rm-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-rm-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-rm-node.js
deleted file mode 100644
index 6cb9320..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-rm-node.js
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * 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.
- */
-
-import Ember from 'ember';
-import DS from 'ember-data';
-import Converter from 'yarn-ui/utils/converter';
-
-export default DS.JSONAPISerializer.extend({
- internalNormalizeSingleResponse(store, primaryModelClass, payload, id) {
- if (payload.node) {
- payload = payload.node;
- }
-
- var fixedPayload = {
- id: id,
- type: primaryModelClass.modelName,
- attributes: {
- rack: payload.rack,
- state: payload.state,
- nodeHostName: payload.nodeHostName,
- nodeHTTPAddress: payload.nodeHTTPAddress,
- lastHealthUpdate: Converter.timeStampToDate(payload.lastHealthUpdate),
- healthReport: payload.healthReport,
- numContainers: payload.numContainers,
- usedMemoryMB: payload.usedMemoryMB,
- availMemoryMB: payload.availMemoryMB,
- usedVirtualCores: payload.usedVirtualCores,
- availableVirtualCores: payload.availableVirtualCores,
- version: payload.version,
- nodeLabels: payload.nodeLabels
- }
- };
- return fixedPayload;
- },
-
- normalizeSingleResponse(store, primaryModelClass, payload, id,
- requestType) {
- // payload is of the form {"nodeInfo":{}}
- var p = this.internalNormalizeSingleResponse(store,
- primaryModelClass, payload, id);
- return { data: p };
- },
-
- normalizeArrayResponse(store, primaryModelClass, payload, id,
- requestType) {
- // expected response is of the form { data: [ {}, {} ] }
- var normalizedArrayResponse = {};
- if (payload.nodes) {
- // payload is of the form { "nodes": { "node": [ {},{},{} ] } }
- normalizedArrayResponse.data = payload.nodes.node.map(singleNode => {
- return this.internalNormalizeSingleResponse(store, primaryModelClass,
- singleNode, singleNode.id);
- }, this);
- } else {
- normalizedArrayResponse.data = Ember.makeArray({
- id: "dummy",
- type: primaryModelClass.modelName,
- attributes: {}});
- }
- return normalizedArrayResponse;
- }
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/styles/app.css
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/styles/app.css b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/styles/app.css
deleted file mode 100644
index e1ff994..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/styles/app.css
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- Over all style
- */
-text {
- font: 12px sans-serif;
-}
-
-text.small {
- font: 8px sans-serif;
-}
-
-html, body
-{
- margin: 0px;
- padding: 0px;
- height: 100%;
- width: 100%;
-}
-
-/*
- queue's style (left banner of queues)
- */
-
-text.queue {
- font-family : sans-serif;
- font-size : 15px;
- fill : gray;
-}
-
-path.queue {
- stroke: gray;
- fill: none;
-}
-
-circle.queue {
- r: 10;
- fill: Steelblue;
-}
-
-/*
- background style
- */
-line.grid {
- stroke: WhiteSmoke;
-}
-
-line.chart {
- stroke: Gray;
-}
-
-/*
- charts styles
- */
-text.chart-title {
- font-size: 30px;
- font-family: sans-serif;
- text-anchor: middle;
- fill: Gray;
-}
-
-text.donut-highlight-text {
- font-size: 20px;
- font-family: sans-serif;
- text-anchor: middle;
- fill: Gray;
- vertical-align: middle;
-}
-
-rect.chart-frame {
- fill: none;
- stroke: gray;
- stroke-dasharray: 10,10;
-}
-
-line.chart-leftbanner {
- stroke-width: 2;
- stroke: gray;
- stroke-dasharray: 10,10;
-}
-
-text.bar-chart-text {
- font-size: 8px;
- font-family: sans-serif;
- vertical-align: middle;
- fill: Gray;;
-}
-
-div.tooltip {
- position: absolute;
- text-align: center;
- /*height: 28px;*/
- padding: 2px;
- font: 12px sans-serif;
- background: lightsteelblue;
- border: 0px;
- border-radius: 8px;
- pointer-events: none;
-}
-
-/*
- * Data table
- */
-
-table.dataTable thead .sorting {
- background-image: url("/assets/images/datatables/sort_both.png");
-}
-table.dataTable thead .sorting_asc {
- background-image: url("/assets/images/datatables/sort_asc.png");
-}
-table.dataTable thead .sorting_desc {
- background-image: url("/assets/images/datatables/sort_desc.png");
-}
-table.dataTable thead .sorting_asc_disabled {
- background-image: url("/assets/images/datatables/sort_asc_disabled.png");
-}
-table.dataTable thead .sorting_desc_disabled {
- background-image: url("/assets/images/datatables/sort_desc_disabled.png");
-}
-
-/*
- * Queue selector
- */
-.node {
- cursor: pointer;
-}
-
-.node circle {
- fill: #fff;
- stroke: steelblue;
- stroke-width: 3px;
-}
-
-.node text {
- font: 12px sans-serif;
-}
-
-.link {
- fill: none;
- stroke: #ccc;
- stroke-width: 2px;
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/application.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/application.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/application.hbs
deleted file mode 100644
index a9de203..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/application.hbs
+++ /dev/null
@@ -1,23 +0,0 @@
-<nav class="navbar navbar-default">
- <div class="container-fluid">
- <!-- Brand and toggle get grouped for better mobile display -->
- <div class="navbar-header">
- <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
- <span class="sr-only">Toggle navigation</span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- </button>
- <a class="navbar-brand" href="#">Apache Hadoop YARN</a>
- </div>
-
- <!-- Collect the nav links, forms, and other content for toggling -->
- <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
- <ul class="nav navbar-nav">
- {{outputMainMenu}}
- </ul>
- </div><!-- /.navbar-collapse -->
- </div><!-- /.container-fluid -->
-</nav>
-
-{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/cluster-overview.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/cluster-overview.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/cluster-overview.hbs
deleted file mode 100644
index 81c11e9..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/cluster-overview.hbs
+++ /dev/null
@@ -1,56 +0,0 @@
-<div class="row">
- <div class="col-lg-3 container-fluid" id="finishedapps-donut-chart">
- {{donut-chart data=model.firstObject.getFinishedAppsDataForDonutChart
- title="Finished Apps"
- showLabels=true
- parentId="finishedapps-donut-chart"
- ratio=0.55
- maxHeight=350}}
- </div>
-
- <div class="col-lg-3 container-fluid" id="runningapps-donut-chart">
- {{donut-chart data=model.firstObject.getRunningAppsDataForDonutChart
- title="Running Apps"
- showLabels=true
- parentId="runningapps-donut-chart"
- ratio=0.55
- maxHeight=350}}
- </div>
-</div>
-
-<hr>
-
-<div class="row">
- <div class="col-lg-3 container-fluid" id="nodes-donut-chart">
- {{donut-chart data=model.firstObject.getNodesDataForDonutChart
- title="Node Managers"
- showLabels=true
- parentId="nodes-donut-chart"
- ratio=0.55
- maxHeight=350}}
- </div>
-</div>
-
-<hr>
-
-<div class="row">
- <div class="col-lg-3 container-fluid" id="mem-donut-chart">
- {{donut-chart data=model.firstObject.getMemoryDataForDonutChart
- title="Resource - Memory"
- showLabels=true
- parentId="mem-donut-chart"
- ratio=0.55
- maxHeight=350}}
- </div>
-
- <div class="col-lg-3 container-fluid" id="vcore-donut-chart">
- {{donut-chart data=model.firstObject.getVCoreDataForDonutChart
- title="Resource - VCores"
- showLabels=true
- parentId="vcore-donut-chart"
- ratio=0.6
- maxHeight=350}}
- </div>
-</div>
-
-{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/.gitkeep
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/.gitkeep b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/.gitkeep
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/app-attempt-table.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/app-attempt-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/app-attempt-table.hbs
deleted file mode 100644
index 633d363..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/app-attempt-table.hbs
+++ /dev/null
@@ -1,28 +0,0 @@
-<table id="app-attempt-table" class="table table-striped table-bordered" cellspacing="0" width="100%" height="100%">
- <tbody>
- <tr>
- <td>Application Attempt Id</td>
- <td>{{attempt.id}}</td>
- </tr>
- <tr>
- <td>Start Time</td>
- <td>{{attempt.startTime}}</td>
- </tr>
- <tr>
- <td>AM Container Id</td>
- <td>{{attempt.containerId}}</td>
- </tr>
- <tr>
- <td>AM Node Web UI</td>
- <td><a href={{attempt.nodeHttpAddress}}>{{attempt.nodeHttpAddress}}</a></td>
- </tr>
- <tr>
- <td>AM Node Id</td>
- <td>{{attempt.nodeId}}</td>
- </tr>
- <tr>
- <td>Log</td>
- <td><a href={{attempt.logsLink}}>link</a></td>
- </tr>
- </tbody>
-</table>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/app-table.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/app-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/app-table.hbs
deleted file mode 100644
index 92e9d05..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/app-table.hbs
+++ /dev/null
@@ -1,62 +0,0 @@
-<table id={{table-id}} class="display table table-striped table-bordered" cellspacing="0" width="100%">
- <thead>
- <tr>
- <th>Application ID</th>
- <th>Name</th>
- <th>User</th>
- <th>Queue</th>
- <th>State</th>
- <th>Final Status</th>
- <th>Start Time</th>
- <th>Elapsed Time</th> <!-- idx = 7 -->
- <th>Finished Time</th>
- <th>Priority</th>
- <th>Progress</th>
- </tr>
- </thead>
- <tbody>
- {{#if arr}}
- {{#each arr as |app|}}
- <tr>
- <td><a href="yarnApp/{{app.id}}">{{app.id}}</a></td>
- <td>{{app.appName}}</td>
- <td>{{app.user}}</td>
- <td>{{app.queue}}</td>
- <td>{{app.state}}</td>
- <td><span class={{app.finalStatusStyle}}>{{app.finalStatus}}</span></td>
- <td>{{app.startTime}}</td>
- <td>{{app.elapsedTime}}</td>
- <td>{{app.finishedTime}}</td>
- <td>{{app.priority}}</td>
- <td>
- <div class="progress" style="margin-bottom: 0;">
- <div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style={{app.progressStyle}}>
- {{app.progress}}%
- </div>
- </div>
- </td>
- </tr>
- {{/each}}
- {{else}}
- <tr>
- <td><a href="yarnApp/{{app.id}}">{{app.id}}</a></td>
- <td>{{app.appName}}</td>
- <td>{{app.user}}</td>
- <td>{{app.queue}}</td>
- <td>{{app.state}}</td>
- <td><span class={{app.finalStatusStyle}}>{{app.finalStatus}}</span></td>
- <td>{{app.startTime}}</td>
- <td>{{app.elapsedTime}}</td>
- <td>{{app.finishedTime}}</td>
- <td>{{app.priority}}</td>
- <td>
- <div class="progress" style="margin-bottom: 0;">
- <div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style={{app.progressStyle}}>
- {{app.progress}}%
- </div>
- </div>
- </td>
- </tr>
- {{/if}}
- </tbody>
-</table>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/container-table.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/container-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/container-table.hbs
deleted file mode 100644
index 70d3fc4..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/container-table.hbs
+++ /dev/null
@@ -1,36 +0,0 @@
-<table id="container-table" class="table table-striped table-bordered" cellspacing="0" width="100%" height="100%">
- <tbody>
- <tr>
- <td>Start Time</td>
- <td>{{container.startedTime}}</td>
- </tr>
- <tr>
- <td>Finished Time</td>
- <td>{{container.finishedTime}}</td>
- </tr>
- <tr>
- <td>Elapsed Time</td>
- <td>{{container.elapsedTime}}</td>
- </tr>
- <tr>
- <td>Priority</td>
- <td>{{container.priority}}</td>
- </tr>
- <tr>
- <td>Log</td>
- <td><a href={{container.logUrl}}>link</a></td>
- </tr>
- <tr>
- <td>Exit Status</td>
- <td>{{container.containerExitStatus}}</td>
- </tr>
- <tr>
- <td>State</td>
- <td>{{container.containerState}}</td>
- </tr>
- <tr>
- <td>NodeManager UI</td>
- <td>{{container.nodeHttpAddress}}</td>
- </tr>
- </tbody>
-</table>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/queue-configuration-table.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/queue-configuration-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/queue-configuration-table.hbs
deleted file mode 100644
index fb9f1a0..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/queue-configuration-table.hbs
+++ /dev/null
@@ -1,40 +0,0 @@
-<table id="queue-configuration-table" class="table table-striped table-bordered" cellspacing="0" width="100%" height="100%">
- <thead>
- <tr>
- <td><b>Configurations</b></td>
- <td>Value</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>Queue Name</td>
- <td>{{queue.id}}</td>
- </tr>
- <tr>
- <td>Configured Capacity</td>
- <td>{{queue.capacity}}</td>
- </tr>
- <tr>
- <td>Configured Max Capacity</td>
- <td>{{queue.maxCapacity}}</td>
- </tr>
- <tr>
- <td>State</td>
- <td>{{queue.state}}</td>
- </tr>
- {{#if queue.isLeafQueue}}
- <tr>
- <td>User Limit Percent</td>
- <td>{{queue.userLimit}}</td>
- </tr>
- <tr>
- <td>User Limit Factor</td>
- <td>{{queue.userLimitFactor}}</td>
- </tr>
- <tr>
- <td>Preemption Disabled</td>
- <td>{{queue.preemptionDisabled}}</td>
- </tr>
- {{/if}}
- </tbody>
-</table>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/queue-navigator.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/queue-navigator.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/queue-navigator.hbs
deleted file mode 100644
index 4ef22902..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/queue-navigator.hbs
+++ /dev/null
@@ -1,18 +0,0 @@
-<div class="row">
- <div class="col-lg-4">
- <select class="js-example-basic-single" width="100%" id="queue-name-selector">
- {{item-selector element-id="queue-name-selector" prefix="Queue : " model=model}}
- </select>
- </div>
-</div><!-- /.row -->
-
-<!-- queue selector -->
-<div class="row">
- <div class="col-md-12 container-fluid" id="tree-selector-container">
- {{tree-selector model=model parentId="tree-selector-container" selected=selected}}
- </div>
-</div>
-
-<hr>
-
-{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/timeline-view.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/timeline-view.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/timeline-view.hbs
deleted file mode 100644
index 657f6e8..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/timeline-view.hbs
+++ /dev/null
@@ -1,35 +0,0 @@
-<div class="col-md-12 container-fluid">
- <div class="panel panel-default">
- <div class="panel-heading">
- {{#if attemptModel}}
- Application Attempts
- {{else}}
- Containers
- {{/if}}
- </div>
- <div class="panel-body">
- <div class="col-md-8 container-fluid" id={{parent-id}}>
- </div>
-
- <!-- diag info -->
- <div class="col-md-4 container-fluid">
- <div class="panel panel-default">
- <div class="panel-heading">
- {{#if selected.link}}
- <a href={{selected.link}}>{{selected.id}}</a>
- {{else}}
- {{selected.id}}
- {{/if}}
- </div>
- {{#if attemptModel}}
- {{app-attempt-table attempt=selected}}
- {{else}}
- {{container-table container=selected}}
- {{/if}}
- </div>
- </div>
- </div>
- </div>
-</div>
-
-{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/error.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/error.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/error.hbs
deleted file mode 100644
index c546bf7..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/error.hbs
+++ /dev/null
@@ -1,19 +0,0 @@
-{{!--
- 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.
---}}
-
-<h3 align = "center">Sorry, Error Occured.</h3>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/notfound.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/notfound.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/notfound.hbs
deleted file mode 100644
index 588ea44..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/notfound.hbs
+++ /dev/null
@@ -1,20 +0,0 @@
-{{!--
- 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.
---}}
-
-<h2 align = "center">404, Not Found</h2>
-<h4 align = "center">Please Check your URL</h4>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-app-attempt.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-app-attempt.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-app-attempt.hbs
deleted file mode 100644
index afcfa4f..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-app-attempt.hbs
+++ /dev/null
@@ -1,12 +0,0 @@
-<div class="container-fluid">
- <div class="row">
- {{app-attempt-table attempt=model.attempt}}
- </div>
-
- <!-- containers table -->
- <div class="row">
- {{timeline-view parent-id="containers-timeline-div" my-id="timeline-view" height="400" rmModel=model.rmContainers tsModel=model.tsContainers label="shortAppAttemptId" attemptModel=false}}
- </div>
-</div>
-
-{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-app.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-app.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-app.hbs
deleted file mode 100644
index 0ba6749..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-app.hbs
+++ /dev/null
@@ -1,145 +0,0 @@
-<div class="container-fluid">
- <!-- app table -->
- <div class="row">
- <div class="col-md-12 container-fluid">
- <div class="panel panel-default">
- <div class="panel-heading">
- Application Basic Information
- </div>
- {{app-table table-id="app-table" app=model.app}}
- </div>
- </div>
- </div>
-
- <!-- diag info and other infos -->
- <div class="row">
- <!-- diag info -->
- <div class="col-md-4 container-fluid">
- {{#if model.app.isFailed}}
- <div class="panel panel-danger">
- <div class="panel-heading">
- Diagnostics
- </div>
- <div class="panel-body">{{model.app.diagnostics}}</div>
- </div>
- {{else}}
- <div class="panel panel-default">
- <div class="panel-body">
- Diagnostics
- </div>
- <div class="panel-footer">{{model.app.diagnostics}}</div>
- </div>
- {{/if}}
- </div>
-
- <div class="col-md-5 container-fluid">
- <div class="panel panel-default">
- <div class="panel-heading">Scheduling Info</div>
- <table class="table">
- <tbody>
- <tr>
- <td>Allocated Resource</td>
- <td>{{model.app.allocatedResource}}</td>
- </tr>
- <tr>
- <td>Running Containers</td>
- <td>{{model.app.runningContainers}}</td>
- </tr>
- <tr>
- <td>Preempted Resource</td>
- <td>{{model.app.preemptedResource}}</td>
- </tr>
- <tr>
- <td>Num Non-AM container preempted</td>
- <td>{{model.app.numAMContainerPreempted}}</td>
- </tr>
- <tr>
- <td>Num AM container preempted</td>
- <td>{{model.app.numAMContainerPreempted}}</td>
- </tr>
- <tr>
- <td>Aggregated Resource Usage</td>
- <td>{{model.app.aggregatedResourceUsage}}</td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
-
- <!-- other info -->
- <div class="col-md-3 container-fluid">
- <div class="panel panel-default">
- <div class="panel-heading">Other Info</div>
- <table class="table">
- <tbody>
- <tr>
- <td>AM Container Log</td>
- <td><a href={{model.app.amContainerLogs}}>Link</a></td>
- </tr>
- <tr>
- <td>AM Host Http Addr</td>
- <td><a href={{model.app.amHostHttpAddress}}>Link</a></td>
- </tr>
- <tr>
- <td>Log Aggregation Status</td>
- <td>{{model.app.logAggregationStatus}}</td>
- </tr>
- <tr>
- <td>Is Unmanaged AM</td>
- <td>{{model.app.unmanagedApplication}}</td>
- </tr>
- <tr>
- <td>AM Node Label Expression</td>
- <td>{{model.app.amNodeLabelExpression}}</td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
-
-<!--
- <div class="row">
- <div class="col-md-12 container-fluid">
- <div class="panel panel-default">
- <div class="panel-heading">
- Application Attempts
- </div>
- <table id="app-attempt-table" class="table table-striped table-bordered" cellspacing="0" width="100%" height="100%">
- <thead>
- <tr>
- <th>Start Time</th>
- <th>Master ContainerId</th>
- <th>Node Http Address</th>
- <th>Node Id</th>
- <th>Logs Link</th>
- </tr>
- </thead>
- <tbody>
- {{#each model.attempts as |attempt|}}
- <tr>
- <td>{{attempt.startTime}}</td>
- <td>{{attempt.containerId}}</td>
- <td><a href={{attempt.nodeHttpAddress}}>{{attempt.nodeHttpAddress}}</a></td>
- <td>{{attempt.nodeId}}</td>
- <td><a href={{attempt.logsLink}}>link</a></td>
- </tr>
- {{/each}}
- </tbody>
- </table>
- </div>
- </div>
- </div>
--->
- <!-- timeline view of children -->
- <div class="row">
- {{timeline-view parent-id="attempt-timeline-div" my-id="timeline-view" height="100%" rmModel=model.attempts label="shortAppAttemptId" attemptModel=true}}
- </div>
-</div>
-
-<!--
-{{simple-table table-id="app-attempt-table" paging=false bFilter=false}}
--->
-
-
-{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-apps.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-apps.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-apps.hbs
deleted file mode 100644
index 3a79080..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-apps.hbs
+++ /dev/null
@@ -1,3 +0,0 @@
-{{app-table table-id="apps-table" arr=model}}
-{{simple-table table-id="apps-table" bFilter=true colsOrder="0,desc" colTypes="natural elapsed-time" colTargets="0 7"}}
-{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-container-log.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-container-log.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-container-log.hbs
deleted file mode 100644
index 9cc3b0f..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-container-log.hbs
+++ /dev/null
@@ -1,36 +0,0 @@
-{{!--
- 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.
---}}
-
-<div class="col-md-12 container-fluid">
- {{node-menu path="yarnContainerLog" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
- <div class="col-md-10">
- <div class="panel panel-default">
- <div class="panel-heading">
- <h5 align="center"><b>{{model.containerLog.logFileName}} for {{model.containerLog.containerID}}</b></h5>
- </div>
- <div class="panel-body">
- {{#if model.containerLog.logs}}
- <pre>{{model.containerLog.logs}}</pre>
- {{else}}
- <p>No logs were written in {{model.containerLog.logFileName}}.</p>
- {{/if}}
- </div>
- </div>
- </div>
-</div>
-{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-app.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-app.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-app.hbs
deleted file mode 100644
index 4da64b8..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-app.hbs
+++ /dev/null
@@ -1,60 +0,0 @@
-{{!--
- 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.
---}}
-
-<div class="col-md-12 container-fluid">
- <div class="row">
- {{node-menu path="yarnNodeApp" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
- <div class="col-md-10 container-fluid">
- <div class="panel panel-default">
- <div class="panel-heading"><b>Application Information</b></div>
- <table class="table">
- <tbody>
- <tr>
- <td>Application ID</td>
- <td>{{model.nodeApp.appId}}</td>
- </tr>
- <tr>
- <td>Application State</td>
- <td>{{model.nodeApp.state}}</td>
- </tr>
- <tr>
- <td>User</td>
- <td>{{model.nodeApp.user}}</td>
- </tr>
- </tbody>
- </table>
- </div>
- <table id="node-app-table" class="display table table-striped table-bordered" cellspacing="0">
- <thead>
- <tr>
- <th>Containers for {{model.nodeApp.appId}}</th>
- </tr>
- </thead>
- <tbody>
- {{#each model.nodeApp.containers as |container|}}
- <tr>
- <td><a href="yarnNodeContainer/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{container}}">{{container}}</a></td>
- </tr>
- {{/each}}
- </tbody>
- </table>
- {{simple-table table-id="node-app-table" bFilter=true colsOrder="0,desc" colTypes="natural" colTargets="0"}}
- </div>
- </div>
- </div>
-{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-apps.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-apps.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-apps.hbs
deleted file mode 100644
index c195397..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-apps.hbs
+++ /dev/null
@@ -1,51 +0,0 @@
-{{!--
- 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.
---}}
-
-<div class="col-md-12 container-fluid">
- <div class="row">
- {{node-menu path="yarnNodeApps" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
- <div class="col-md-10 container-fluid">
- <table id="node-apps-table" class="display table table-striped table-bordered" cellspacing="0" width="100%">
- <thead>
- <tr>
- <th>Application ID</th>
- <th>State</th>
- <th>User</th>
- </tr>
- </thead>
- <tbody>
- {{#if model.apps}}
- {{#each model.apps as |app|}}
- {{#if app.isDummyApp}}
- <tr><td colspan="3" align="center">No apps found on this node</td></tr>
- {{else}}
- <tr>
- <td><a href="yarnNodeApp/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{app.appId}}">{{app.appId}}</a></td>
- <td><span class={{app.appStateStyle}}>{{app.state}}</span></td>
- <td>{{app.user}}</td>
- </tr>
- {{/if}}
- {{/each}}
- {{/if}}
- </tbody>
- </table>
- {{simple-table table-id="node-apps-table" bFilter=true colsOrder="0,desc" colTypes="natural" colTargets="0"}}
- </div>
- </div>
-</div>
-{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-container.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-container.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-container.hbs
deleted file mode 100644
index fbbb2fc..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-container.hbs
+++ /dev/null
@@ -1,70 +0,0 @@
-{{!--
- 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.
---}}
-
-<div class="col-md-12 container-fluid">
- <div class="row">
- {{node-menu path="yarnNodeContainer" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
- <div class="col-md-10 container-fluid">
- <div class="panel panel-default">
- <div class="panel-heading"><b>Container Information</b></div>
- <table class="table">
- <tbody>
- <tr>
- <td>Container ID</td>
- <td>{{model.nodeContainer.containerId}}</td>
- </tr>
- <tr>
- <td>Container State</td>
- <td>{{model.nodeContainer.state}}</td>
- </tr>
- <tr>
- <td>Exit Code</td>
- <td>{{model.nodeContainer.exitCode}}</td>
- </tr>
- <tr>
- <td>Diagnostics</td>
- <td>{{model.nodeContainer.diagnostics}}</td>
- </tr>
- <tr>
- <td>User</td>
- <td>{{model.nodeContainer.user}}</td>
- </tr>
- <tr>
- <td>Total Memory Needed</td>
- <td>{{model.nodeContainer.totalMemoryNeeded}} MB</td>
- </tr>
- <tr>
- <td>Total VCores Needed</td>
- <td>{{model.nodeContainer.totalVCoresNeeded}}</td>
- </tr>
- <tr>
- <td>Link to Logs</td>
- <td>
- {{log-files-comma nodeId=model.nodeInfo.id
- nodeAddr=model.nodeInfo.addr
- containerId=model.nodeContainer.containerId
- logFiles=model.nodeContainer.containerLogFiles}}
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
-{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-containers.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-containers.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-containers.hbs
deleted file mode 100644
index ca80ccd..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node-containers.hbs
+++ /dev/null
@@ -1,58 +0,0 @@
-{{!--
- 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.
---}}
-
-<div class="col-md-12 container-fluid">
- <div class="row">
- {{node-menu path="yarnNodeContainers" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
- <div class="col-md-10 container-fluid">
- <table id="node-containers-table" class="display table table-striped table-bordered" cellspacing="0" width="100%">
- <thead>
- <tr>
- <th>Container ID</th>
- <th>Container State</th>
- <th>User</th>
- <th>Logs</th>
- </tr>
- </thead>
- <tbody>
- {{#if model.containers}}
- {{#each model.containers as |container|}}
- {{#if container.isDummyContainer}}
- <tr><td colspan="4" align="center">No containers found on this node</td></tr>
- {{else}}
- <tr>
- <td><a href="yarnNodeContainer/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{container.containerId}}">{{container.containerId}}</a></td>
- <td><span class={{container.containerStateStyle}}>{{container.state}}</span></td>
- <td>{{container.user}}</td>
- <td>
- {{log-files-comma nodeId=model.nodeInfo.id
- nodeAddr=model.nodeInfo.addr
- containerId=container.containerId
- logFiles=container.containerLogFiles}}
- </td>
- </tr>
- {{/if}}
- {{/each}}
- {{/if}}
- </tbody>
- </table>
- {{simple-table table-id="node-containers-table" bFilter=true colsOrder="0,desc" colTypes="natural" colTargets="0"}}
- </div>
- </div>
-</div>
-{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node.hbs
deleted file mode 100644
index a036076..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-node.hbs
+++ /dev/null
@@ -1,94 +0,0 @@
-{{!--
- 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.
---}}
-
-<div class="col-md-12 container-fluid">
- <div class="row">
- {{node-menu path="yarnNode" nodeId=model.rmNode.id nodeAddr=model.node.id}}
- <div class="col-md-10 container-fluid">
- <div class="panel panel-default">
- <div class="panel-heading">Node Information</div>
- <table class="table">
- <tbody>
- <tr>
- <td>Total Vmem allocated for Containers</td>
- <td>{{divide num=model.node.totalVmemAllocatedContainersMB den=1024}} GB</td>
- </tr>
- <tr>
- <td>Vmem enforcement enabled</td>
- <td>{{model.node.vmemCheckEnabled}}</td>
- </tr>
- <tr>
- <td>Total Pmem allocated for Containers</td>
- <td>{{divide num=model.node.totalPmemAllocatedContainersMB den=1024}} GB</td>
- </tr>
- <tr>
- <td>Pmem enforcement enabled</td>
- <td>{{model.node.pmemCheckEnabled}}</td>
- </tr>
- <tr>
- <td>Total VCores allocated for Containers</td>
- <td>{{model.node.totalVCoresAllocatedContainers}}</td>
- </tr>
- <tr>
- <td>Node Healthy Status</td>
- <td>{{model.node.nodeHealthy}}</td>
- </tr>
- <tr>
- <td>Last Node Health Report Time</td>
- <td>{{model.node.lastNodeUpdateTime}}</td>
- </tr>
- <tr>
- <td>Node Health Report</td>
- <td>{{model.node.healthReport}}</td>
- </tr>
- <tr>
- <td>Node Manager Start Time</td>
- <td>{{model.node.nmStartupTime}}</td>
- </tr>
- <tr>
- <td>Node Manager Version</td>
- <td>{{model.node.nodeManagerBuildVersion}}</td>
- </tr>
- <tr>
- <td>Hadoop Version</td>
- <td>{{model.node.hadoopBuildVersion}}</td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="col-lg-4 container-fluid" id="mem-donut-chart">
- {{donut-chart data=model.rmNode.getMemoryDataForDonutChart
- title="Resource - Memory (in MB)"
- showLabels=true
- parentId="mem-donut-chart"
- ratio=0.55
- maxHeight=350}}
- </div>
-
- <div class="col-lg-4 container-fluid" id="vcore-donut-chart">
- {{donut-chart data=model.rmNode.getVCoreDataForDonutChart
- title="Resource - VCores"
- showLabels=true
- parentId="vcore-donut-chart"
- ratio=0.55
- maxHeight=350}}
- </div>
- </div>
- </div>
-</div>
-{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-nodes.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-nodes.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-nodes.hbs
deleted file mode 100644
index bf2a098..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-nodes.hbs
+++ /dev/null
@@ -1,65 +0,0 @@
-{{!--
- 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.
---}}
-
-<table id="nodes-table" class="display table table-striped table-bordered" cellspacing="0" width="100%">
- <thead>
- <tr>
- <th>Node Labels</th>
- <th>Rack</th>
- <th>Node State</th>
- <th>Node Address</th>
- <th>Node HTTP Address</th>
- <th>Last Health Update</th>
- <th>Health-Report</th>
- <th>Containers</th>
- <th>Mem Used</th>
- <th>Mem Avail</th>
- <th>VCores Used</th>
- <th>VCores Avail</th>
- <th>Version</th>
- </tr>
- </thead>
- <tbody>
- {{#if model}}
- {{#each model as |node|}}
- {{#if node.isDummyNode}}
- <tr><td colspan="13" align="center">No nodes found on this cluster</td></tr>
- {{else}}
- <tr>
- <td>{{node.nodeLabelsAsString}}</td>
- <td>{{node.rack}}</td>
- <td><span class={{node.nodeStateStyle}}>{{node.state}}</span></td>
- <td>{{node.id}}</td>
- {{node-link nodeId=node.id nodeHTTPAddress=node.nodeHTTPAddress nodeState=node.state}}
- <td>{{node.lastHealthUpdate}}</td>
- <td>{{node.healthReport}}</td>
- <td>{{node.numContainers}}</td>
- <td>{{divide num=node.usedMemoryMB den=1024}} GB</td>
- <td>{{divide num=node.availMemoryMB den=1024}} GB</td>
- <td>{{node.usedVirtualCores}}</td>
- <td>{{node.availableVirtualCores}}</td>
- <td>{{node.version}}</td>
- </tr>
- {{/if}}
- {{/each}}
- {{/if}}
- </tbody>
-</table>
-
-{{simple-table table-id="nodes-table" bFilter=true}}
-{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-queue.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-queue.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-queue.hbs
deleted file mode 100644
index 11bb6f4..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-queue.hbs
+++ /dev/null
@@ -1,48 +0,0 @@
-<div class="container-fluid">
- {{queue-navigator model=model.queues selected=model.selected}}
-</div>
-
-<div class="row">
- <div class="col-lg-3 container-fluid">
- {{queue-configuration-table queue=model.selectedQueue}}
- </div>
-
- <div class="col-lg-3 container-fluid" id="capacity-bar-chart">
- {{bar-chart data=model.selectedQueue.capacitiesBarChartData
- title="Queue Capacities"
- parentId="capacity-bar-chart"
- textWidth=150
- ratio=0.5
- maxHeight=350}}
- </div>
-
-{{#if model.selectedQueue.hasUserUsages}}
- <div class="col-lg-3 container-fluid" id="userusage-donut-chart">
- {{donut-chart data=model.selectedQueue.userUsagesDonutChartData
- title="User Usages"
- showLabels=true
- parentId="userusage-donut-chart"
- maxHeight=350}}
- </div>
-{{/if}}
-
- <div class="col-lg-3 container-fluid" id="numapplications-donut-chart">
- {{donut-chart data=model.selectedQueue.numOfApplicationsDonutChartData
- title="Running Apps"
- showLabels=true
- parentId="numapplications-donut-chart"
- ratio=0.5
- maxHeight=350}}
- </div>
-</div>
-
-<hr>
-
-<div class="row">
- <div class="col-md-12 container-fluid">
- {{app-table table-id="apps-table" arr=model.apps}}
- {{simple-table table-id="apps-table" bFilter=true colTypes="elapsed-time" colTargets="7"}}
- </div>
-</div>
-
-{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/converter.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/converter.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/converter.js
deleted file mode 100644
index 0f49a58..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/converter.js
+++ /dev/null
@@ -1,91 +0,0 @@
-import Constants from 'yarn-ui/constants';
-
-export default {
- containerIdToAttemptId: function(containerId) {
- if (containerId) {
- var arr = containerId.split('_');
- var attemptId = ["appattempt", arr[1],
- arr[2], this.padding(arr[3], 6)];
- return attemptId.join('_');
- }
- },
- attemptIdToAppId: function(attemptId) {
- if (attemptId) {
- var arr = attemptId.split('_');
- var appId = ["application", arr[1],
- arr[2]].join('_');
- return appId;
- }
- },
- padding: function(str, toLen=2) {
- str = str.toString();
- if (str.length >= toLen) {
- return str;
- }
- return '0'.repeat(toLen - str.length) + str;
- },
- resourceToString: function(mem, cpu) {
- mem = Math.max(0, mem);
- cpu = Math.max(0, cpu);
- return mem + " MBs, " + cpu + " VCores";
- },
- msToElapsedTime: function(timeInMs) {
- var sec_num = timeInMs / 1000; // don't forget the second param
- var hours = Math.floor(sec_num / 3600);
- var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
- var seconds = sec_num - (hours * 3600) - (minutes * 60);
-
- var timeStrArr = [];
-
- if (hours > 0) {
- timeStrArr.push(hours + ' Hrs');
- }
- if (minutes > 0) {
- timeStrArr.push(minutes + ' Mins');
- }
- if (seconds > 0) {
- timeStrArr.push(Math.round(seconds) + " Secs");
- }
- return timeStrArr.join(' : ');
- },
- elapsedTimeToMs: function(elapsedTime) {
- elapsedTime = elapsedTime.toLowerCase();
- var arr = elapsedTime.split(' : ');
- var total = 0;
- for (var i = 0; i < arr.length; i++) {
- if (arr[i].indexOf('hr') > 0) {
- total += parseInt(arr[i].substring(0, arr[i].indexOf(' '))) * 3600;
- } else if (arr[i].indexOf('min') > 0) {
- total += parseInt(arr[i].substring(0, arr[i].indexOf(' '))) * 60;
- } else if (arr[i].indexOf('sec') > 0) {
- total += parseInt(arr[i].substring(0, arr[i].indexOf(' ')));
- }
- }
- return total * 1000;
- },
- timeStampToDate: function(timeStamp) {
- var dateTimeString = moment(parseInt(timeStamp)).format("YYYY/MM/DD HH:mm:ss");
- return dateTimeString;
- },
- dateToTimeStamp: function(date) {
- if (date) {
- var ts = moment(date, "YYYY/MM/DD HH:mm:ss").valueOf();
- return ts;
- }
- },
- splitForContainerLogs: function(id) {
- if (id) {
- var splits = id.split(Constants.PARAM_SEPARATOR);
- var splitLen = splits.length;
- if (splitLen < 3) {
- return null;
- }
- var fileName = splits[2];
- var index;
- for (index = 3; index < splitLen; index++) {
- fileName = fileName + Constants.PARAM_SEPARATOR + splits[index];
- }
- return [splits[0], splits[1], fileName];
- }
- },
-};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/sorter.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/sorter.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/sorter.js
deleted file mode 100644
index a9a5f7f..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/sorter.js
+++ /dev/null
@@ -1,55 +0,0 @@
-import Converter from 'yarn-ui/utils/converter';
-import Ember from 'ember';
-
-export default {
- _initElapsedTimeSorter: function() {
- Ember.$.extend(Ember.$.fn.dataTableExt.oSort, {
- "elapsed-time-pre": function (a) {
- return Converter.padding(Converter.elapsedTimeToMs(a), 20);
- },
- });
- },
-
- _initNaturalSorter: function() {
- Ember.$.extend(Ember.$.fn.dataTableExt.oSort, {
- "natural-asc": function (a, b) {
- return naturalSort(a,b);
- },
- "natural-desc": function (a, b) {
- return naturalSort(a,b) * -1;
- },
- });
- },
-
- initDataTableSorter: function() {
- this._initElapsedTimeSorter();
- this._initNaturalSorter();
- },
-};
-
-/**
- * Natural sort implementation.
- * Typically used to sort application Ids'.
- */
-function naturalSort(a, b) {
- var diff = a.length - b.length;
- if (diff != 0) {
- var splitA = a.split("_");
- var splitB = b.split("_");
- if (splitA.length != splitB.length) {
- return a.localeCompare(b);
- }
- for (var i = 1; i < splitA.length; i++) {
- var splitdiff = splitA[i].length - splitB[i].length;
- if (splitdiff != 0) {
- return splitdiff;
- }
- var splitCompare = splitA[i].localeCompare(splitB[i]);
- if (splitCompare != 0) {
- return splitCompare;
- }
- }
- return diff;
- }
- return a.localeCompare(b);
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/bower.json
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/bower.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/bower.json
deleted file mode 100644
index de66650..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/bower.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "yarn-ui",
- "dependencies": {
- "ember": "2.0.1",
- "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.4",
- "ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
- "ember-data": "2.0.0",
- "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.6",
- "ember-qunit": "0.4.9",
- "ember-qunit-notifications": "0.0.7",
- "ember-resolver": "~0.1.18",
- "jquery": "1.11.3",
- "loader.js": "ember-cli/loader.js#3.2.1",
- "qunit": "~1.18.0",
- "bootstrap": "~3.3.2",
- "d3": "~3.5.6",
- "datatables": "~1.10.8",
- "spin.js": "~2.3.2",
- "momentjs": "~2.10.6",
- "select2": "4.0.0"
- }
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/config/environment.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/config/environment.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/config/environment.js
deleted file mode 100644
index bb4f8d2..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/config/environment.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/* jshint node: true */
-
-module.exports = function(environment) {
- var ENV = {
- modulePrefix: 'yarn-ui',
- environment: environment,
- baseURL: '/',
- locationType: 'auto',
- EmberENV: {
- FEATURES: {
- // Here you can enable experimental features on an ember canary build
- // e.g. 'with-controller': true
- }
- },
- APP: {
- // Here you can pass flags/options to your application instance
- // when it is created
- }
- };
-
- if (environment === 'development') {
- // ENV.APP.LOG_RESOLVER = true;
- // ENV.APP.LOG_ACTIVE_GENERATION = true;
- // ENV.APP.LOG_TRANSITIONS = true;
- // ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
- // ENV.APP.LOG_VIEW_LOOKUPS = true;
- }
-
- if (environment === 'test') {
- // Testem prefers this...
- ENV.baseURL = '/';
- ENV.locationType = 'none';
-
- // keep test console output quieter
- ENV.APP.LOG_ACTIVE_GENERATION = false;
- ENV.APP.LOG_VIEW_LOOKUPS = false;
-
- ENV.APP.rootElement = '#ember-testing';
- }
-
- if (environment === 'production') {
-
- }
-
- return ENV;
-};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/ember-cli-build.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/ember-cli-build.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/ember-cli-build.js
deleted file mode 100644
index 2fa2032..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/ember-cli-build.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/* global require, module */
-var EmberApp = require('ember-cli/lib/broccoli/ember-app');
-
-module.exports = function(defaults) {
- var app = new EmberApp(defaults, {
- // Add options here
- });
-
- app.import("bower_components/datatables/media/css/jquery.dataTables.min.css");
- app.import("bower_components/datatables/media/js/jquery.dataTables.min.js");
- app.import("bower_components/momentjs/min/moment.min.js");
- app.import("bower_components/select2/dist/css/select2.min.css");
- app.import("bower_components/select2/dist/js/select2.min.js");
-
- // Use `app.import` to add additional libraries to the generated
- // output files.
- //
- // If you need to use different assets in different
- // environments, specify an object as the first parameter. That
- // object's keys should be the environment name and the values
- // should be the asset to use in that environment.
- //
- // If the library that you are including contains AMD or ES6
- // modules that you would like to import into your application
- // please specify an object with the list of modules as keys
- // along with the exports of each module as its value.
-
- return app.toTree();
-};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/jsconfig.json
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/jsconfig.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/jsconfig.json
deleted file mode 100644
index 875bb90..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/jsconfig.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "compilerOptions": {
- "target": "ES6",
- "module": "commonjs"
- }
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/package.json
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/package.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/package.json
deleted file mode 100644
index 5500dcf..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/package.json
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "name": "yarn-ui",
- "version": "0.0.0",
- "description": "Small description for yarn-ui goes here",
- "private": true,
- "directories": {
- "doc": "doc",
- "test": "tests"
- },
- "scripts": {
- "build": "ember build",
- "start": "ember server",
- "test": "ember test"
- },
- "repository": "",
- "engines": {
- "node": ">= 0.10.0"
- },
- "author": "",
- "license": "MIT",
- "devDependencies": {
- "broccoli-asset-rev": "^2.1.2",
- "ember-bootstrap": "0.2.0",
- "ember-cli": "1.13.8",
- "ember-cli-app-version": "0.5.0",
- "ember-cli-babel": "^5.1.3",
- "ember-cli-content-security-policy": "0.4.0",
- "ember-cli-dependency-checker": "^1.0.1",
- "ember-cli-htmlbars": "0.7.9",
- "ember-cli-htmlbars-inline-precompile": "^0.2.0",
- "ember-cli-ic-ajax": "0.2.1",
- "ember-cli-inject-live-reload": "^1.3.1",
- "ember-cli-qunit": "^1.0.0",
- "ember-cli-release": "0.2.3",
- "ember-cli-sri": "^1.0.3",
- "ember-cli-uglify": "^1.2.0",
- "ember-d3": "0.1.0",
- "ember-data": "1.13.8",
- "ember-disable-proxy-controllers": "^1.0.0",
- "ember-export-application-global": "^1.0.3",
- "ember-spin-spinner": "0.2.3",
- "select2": "4.0.0"
- }
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[46/50] [abbrv] hadoop git commit: YARN-5321. [YARN-3368] Add
resource usage for application by node managers (Wangda Tan via Sunil G)
YARN-5320. [YARN-3368] Add resource usage by applications and queues to
cluster overview page (Wangda Tan via Sunil G)
Posted by wa...@apache.org.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps.js
index ff49403..b945451 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps.js
@@ -20,7 +20,9 @@ import Ember from 'ember';
export default Ember.Route.extend({
model() {
- var apps = this.store.findAll('yarn-app');
- return apps;
+ return Ember.RSVP.hash({
+ apps: this.store.findAll('yarn-app'),
+ clusterMetrics: this.store.findAll('ClusterMetric'),
+ });
}
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps/apps.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps/apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps/apps.js
new file mode 100644
index 0000000..8719170
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps/apps.js
@@ -0,0 +1,22 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps/services.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps/services.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps/services.js
new file mode 100644
index 0000000..8719170
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps/services.js
@@ -0,0 +1,22 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js
index 6e57388..64a1b3e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js
@@ -22,6 +22,7 @@ export default Ember.Route.extend({
model(param) {
// Fetches data from both NM and RM. RM is queried to get node usage info.
return Ember.RSVP.hash({
+ nodeInfo: { id: param.node_id, addr: param.node_addr },
node: this.store.findRecord('yarn-node', param.node_addr),
rmNode: this.store.findRecord('yarn-rm-node', param.node_id)
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes.js
index 5c46630..5639369 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes.js
@@ -20,6 +20,9 @@ import Ember from 'ember';
export default Ember.Route.extend({
model() {
- return this.store.findAll('yarn-rm-node');
+ return Ember.RSVP.hash({
+ nodes: this.store.findAll('yarn-rm-node'),
+ clusterMetrics: this.store.findAll('ClusterMetric'),
+ });
}
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes/heatmap.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes/heatmap.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes/heatmap.js
new file mode 100644
index 0000000..8719170
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes/heatmap.js
@@ -0,0 +1,22 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes/table.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes/table.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes/table.js
new file mode 100644
index 0000000..38ae5d1
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes/table.js
@@ -0,0 +1,22 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queue-apps.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queue-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queue-apps.js
new file mode 100644
index 0000000..dff4ee9
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queue-apps.js
@@ -0,0 +1,36 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ return Ember.RSVP.hash({
+ selected : param.queue_name,
+ queues: this.store.findAll('yarn-queue'),
+ selectedQueue : undefined,
+ apps: undefined, // apps of selected queue
+ });
+ },
+
+ afterModel(model) {
+ var store = this.store;
+ model.selectedQueue = this.store.peekRecord('yarn-queue', model.selected);
+ model.apps = store.findAll('yarn-app');
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues.js
new file mode 100644
index 0000000..06ceafb
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues.js
@@ -0,0 +1,38 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ return Ember.RSVP.hash({
+ selected : param.queue_name,
+ queues: this.store.findAll('yarn-queue'),
+ selectedQueue : undefined,
+ apps: undefined, // apps of selected queue
+ });
+ },
+
+ afterModel(model) {
+ model.selectedQueue = this.store.peekRecord('yarn-queue', model.selected);
+ model.apps = this.store.findAll('yarn-app');
+ model.apps.forEach(function(o) {
+ console.log(o);
+ })
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app-attempt.js
index 4c542c4..3de377a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app-attempt.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app-attempt.js
@@ -40,7 +40,8 @@ export default DS.JSONAPISerializer.extend({
nodeId: payload.nodeId,
hosts: payload.host,
state: payload.appAttemptState,
- logsLink: payload.logsLink
+ logsLink: payload.logsLink,
+ appAttemptId: payload.appAttemptId
}
};
@@ -59,12 +60,16 @@ export default DS.JSONAPISerializer.extend({
// return expected is { data: [ {}, {} ] }
var normalizedArrayResponse = {};
- // payload has apps : { app: [ {},{},{} ] }
- // need some error handling for ex apps or app may not be defined.
- normalizedArrayResponse.data = payload.appAttempts.appAttempt.map(singleApp => {
- return this.internalNormalizeSingleResponse(store, primaryModelClass,
- singleApp, singleApp.id, requestType);
- }, this);
+ if (payload.appAttempts && payload.appAttempts.appAttempt) {
+ // payload has apps : { app: [ {},{},{} ] }
+ // need some error handling for ex apps or app may not be defined.
+ normalizedArrayResponse.data = payload.appAttempts.appAttempt.map(singleApp => {
+ return this.internalNormalizeSingleResponse(store, primaryModelClass,
+ singleApp, singleApp.id, requestType);
+ }, this);
+ } else {
+ normalizedArrayResponse.data = [];
+ }
return normalizedArrayResponse;
}
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js
index ba8c1f4..427c3d8 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js
@@ -39,6 +39,7 @@ export default DS.JSONAPISerializer.extend({
finishedTime: Converter.timeStampToDate(payload.finishedTime),
finalStatus: payload.finalStatus,
progress: payload.progress,
+ applicationType: payload.applicationType,
diagnostics: payload.diagnostics,
amContainerLogs: payload.amContainerLogs,
amHostHttpAddress: payload.amHostHttpAddress,
@@ -54,7 +55,10 @@ export default DS.JSONAPISerializer.extend({
preemptedResourceMB: payload.preemptedResourceMB,
preemptedResourceVCores: payload.preemptedResourceVCores,
numNonAMContainerPreempted: payload.numNonAMContainerPreempted,
- numAMContainerPreempted: payload.numAMContainerPreempted
+ numAMContainerPreempted: payload.numAMContainerPreempted,
+ clusterUsagePercentage: payload.clusterUsagePercentage,
+ queueUsagePercentage: payload.queueUsagePercentage,
+ currentAppAttemptId: payload.currentAppAttemptId
}
};
@@ -75,7 +79,7 @@ export default DS.JSONAPISerializer.extend({
// payload has apps : { app: [ {},{},{} ] }
// need some error handling for ex apps or app may not be defined.
- if(payload.apps) {
+ if(payload.apps && payload.apps.app) {
normalizedArrayResponse.data = payload.apps.app.map(singleApp => {
return this.internalNormalizeSingleResponse(store, primaryModelClass,
singleApp, singleApp.id, requestType);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-container.js
index e051396..b9b923d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-container.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-container.js
@@ -57,13 +57,19 @@ export default DS.JSONAPISerializer.extend({
var normalizedArrayResponse = {};
if (payload && payload.container) {
- // payload has apps : { app: [ {},{},{} ] }
- // need some error handling for ex apps or app may not be defined.
- normalizedArrayResponse.data = payload.container.map(singleContainer => {
- return this.internalNormalizeSingleResponse(store, primaryModelClass,
- singleContainer, singleContainer.id, requestType);
- }, this);
- return normalizedArrayResponse;
+ if (Array.isArray(payload.container)) {
+ // payload has apps : { app: [ {},{},{} ] }
+ // need some error handling for ex apps or app may not be defined.
+ normalizedArrayResponse.data = payload.container.map(singleContainer => {
+ return this.internalNormalizeSingleResponse(store, primaryModelClass,
+ singleContainer, singleContainer.id, requestType);
+ }, this);
+ } else {
+ normalizedArrayResponse.data = [this.internalNormalizeSingleResponse(
+ store, primaryModelClass, payload.container, payload.container.id,
+ requestType)];
+ }
+ return normalizedArrayResponse;
} else {
normalizedArrayResponse.data = [];
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.css
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.css b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.css
index e2d09dc..409aa15 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.css
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.css
@@ -16,11 +16,20 @@
* limitations under the License.
*/
+body, html, body > .ember-view {
+ height: 100%;
+ overflow: visible;
+ color: @text-color;
+}
+body, html {
+ min-width: 1024px;
+}
+
/*
Over all style
*/
text {
- font: 12px sans-serif;
+ font: 16px sans-serif;
}
text.small {
@@ -35,6 +44,7 @@ html, body
width: 100%;
}
+
/*
queue's style (left banner of queues)
*/
@@ -45,14 +55,30 @@ text.queue {
fill : gray;
}
-path.queue {
- stroke: gray;
- fill: none;
+text.heatmap-cell {
+ font: 14px sans-serif;
+ font-weight: bold;
+ text-anchor: middle;
+ fill: Azure;
+ text-align: center;
+}
+
+text.heatmap-cell-notselected {
+ font: 14px sans-serif;
+ font-weight: bold;
+ text-anchor: middle;
+ fill: Silver;
+ text-align: center;
}
-circle.queue {
- r: 10;
- fill: Steelblue;
+text.heatmap-rack {
+ font: 20px sans-serif;
+ fill: DimGray;
+}
+
+path.queue {
+ stroke: "red";
+ fill: none;
}
/*
@@ -76,24 +102,21 @@ text.chart-title {
fill: Gray;
}
-text.donut-highlight-text {
- font-size: 20px;
+text.donut-highlight-text, text.donut-highlight-sub {
+ font-size: 15px;
font-family: sans-serif;
text-anchor: middle;
fill: Gray;
vertical-align: middle;
}
-rect.chart-frame {
- fill: none;
- stroke: gray;
- stroke-dasharray: 10,10;
+text.donut-highlight-sub {
+ font-size: 23px;
+ margin-top: 10px;
}
-line.chart-leftbanner {
- stroke-width: 2;
- stroke: gray;
- stroke-dasharray: 10,10;
+rect.chart-frame {
+ fill: none;
}
text.bar-chart-text {
@@ -106,9 +129,8 @@ text.bar-chart-text {
div.tooltip {
position: absolute;
text-align: center;
- /*height: 28px;*/
- padding: 2px;
- font: 12px sans-serif;
+ padding: 2px;
+ font: 24px sans-serif;
background: lightsteelblue;
border: 0px;
border-radius: 8px;
@@ -135,6 +157,19 @@ table.dataTable thead .sorting_desc_disabled {
background-image: url("/assets/images/datatables/sort_desc_disabled.png");
}
+.add-ellipsis {
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+.breadcrumb {
+ padding-bottom: 3px;
+}
+
+.navbar-default .navbar-nav > li > a {
+ color: #337ab7;
+}
+
/*
* Queue selector
*/
@@ -158,6 +193,70 @@ table.dataTable thead .sorting_desc_disabled {
stroke-width: 2px;
}
+.lr-margin {
+ margin: 0px 30px;
+}
+
+.footer {
+ background-color: @white;
+ color: @text-color;
+
+ padding: 10px 0px;
+ margin: 0px;
+
+ border-top: 1px lightgrey solid;
+
+ font-size: .9em;
+}
+
+.table {
+ margin-bottom: 0px;
+ border: none;
+
+ overflow: hidden;
+}
+
+.table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td {
+ border: none !important;
+}
+
+.dataTables_wrapper .table {
+ border: 1px solid lightgrey;
+ border-bottom: 1px solid lightgrey !important;
+ border-radious: 5px;
+}
+
+.dataTables_wrapper .table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td {
+ border: 1px solid lightgrey;
+}
+
+td {
+ padding: 8px 15px 8px 15px !important;
+}
+
+.footer-frame {
+ height: 60px;
+}
+.footer {
+ height: 40px;
+}
+
+.footer-pusher {
+ min-height: 100%;
+ height: auto !important;
+ height: 100%;
+ margin: 0 auto -40px; // Must be same as footer & footer-frame
+}
+
+.panel-default .container-fluid {
+ margin-top: -45px !important;
+ margin-bottom: -10px !important;
+}
+
+.panel-heading {
+ font-weight: bold;
+}
+
.hadoop-brand-image {
margin-top: -10px;
width: auto;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs
index 03b2c4a..7783db4 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs
@@ -16,47 +16,70 @@
* limitations under the License.
}}
-<nav class="navbar navbar-default">
- <div class="container-fluid">
- <!-- Brand and toggle get grouped for better mobile display -->
- <div class="navbar-header">
- <a class="navbar-brand" href="#">
- <img class="hadoop-brand-image" alt="Apache Hadoop" src="assets/images/hadoop_logo.png" />
- </a>
- <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
- <span class="sr-only">Toggle navigation</span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- </button>
- </div>
+<div class="footer-pusher">
- <!-- Collect the nav links, forms, and other content for toggling -->
- <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
- <ul class="nav navbar-nav">
- {{#link-to 'yarn-queue' 'root' tagName="li"}}
- {{#link-to 'yarn-queue' 'root' class="navigation-link"}}Queues
- <span class="sr-only">(current)</span>
+ <nav class="navbar navbar-default">
+ <div class="container-fluid">
+ <!-- Brand and toggle get grouped for better mobile display -->
+ <div class="navbar-header">
+ <a class="navbar-brand" href="#">
+ <img class="hadoop-brand-image" alt="Apache Hadoop" src="assets/images/hadoop_logo.png" />
+ </a>
+ <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
+ <span class="sr-only">Toggle navigation</span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+ </div>
+
+ <!-- Collect the nav links, forms, and other content for toggling -->
+ <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
+ <ul class="nav navbar-nav">
+ {{#link-to 'cluster-overview' tagName="li"}}
+ {{#link-to 'cluster-overview' class="navigation-link"}}Cluster Overview
+ <span class="sr-only">(current)</span>
+ {{/link-to}}
{{/link-to}}
- {{/link-to}}
- {{#link-to 'yarn-apps' tagName="li"}}
- {{#link-to 'yarn-apps' class="navigation-link"}}Applications
- <span class="sr-only">(current)</span>
+ {{#link-to 'yarn-queues' 'root' tagName="li"}}
+ {{#link-to 'yarn-queues' 'root' class="navigation-link"}}Queues
+ <span class="sr-only">(current)</span>
+ {{/link-to}}
{{/link-to}}
- {{/link-to}}
- {{#link-to 'cluster-overview' tagName="li"}}
- {{#link-to 'cluster-overview' class="navigation-link"}}Cluster Overview
- <span class="sr-only">(current)</span>
+ {{#link-to 'yarn-apps.apps' tagName="li"}}
+ {{#link-to 'yarn-apps.apps' class="navigation-link"}}Applications
+ <span class="sr-only">(current)</span>
+ {{/link-to}}
{{/link-to}}
- {{/link-to}}
- {{#link-to 'yarn-nodes' tagName="li"}}
- {{#link-to 'yarn-nodes' class="navigation-link"}}Nodes
- <span class="sr-only">(current)</span>
+ {{#link-to 'yarn-nodes.table' tagName="li"}}
+ {{#link-to 'yarn-nodes.table' class="navigation-link"}}Nodes
+ <span class="sr-only">(current)</span>
+ {{/link-to}}
{{/link-to}}
- {{/link-to}}
- </ul>
- </div><!-- /.navbar-collapse -->
- </div><!-- /.container-fluid -->
-</nav>
+ </ul>
+ </div><!-- /.navbar-collapse -->
+ </div><!-- /.container-fluid -->
+ </nav>
+
+ <div class="container-fluid">
+ {{outlet}}
+ </div>
+
+ <br/>
+ <br/>
+ <br/>
-{{outlet}}
+</div>
+
+<div class="footer">
+ <div class="container-fluid content">
+ <a href={{env.app.hrefs.license}} target="_blank">
+ Licensed under the Apache License, Version 2.0.
+ </a>
+ <div class="ui-info">
+ {{#if env.app.timezone}}
+ <span>Timezone <b>{{env.app.timezone}}</b></span>
+ {{/if}}
+ </div>
+ </div>
+</div>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/cluster-overview.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/cluster-overview.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/cluster-overview.hbs
index 2094092..fa90799 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/cluster-overview.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/cluster-overview.hbs
@@ -16,59 +16,137 @@
* limitations under the License.
}}
-<div class="row">
- <div class="col-lg-3 container-fluid" id="finishedapps-donut-chart">
- {{donut-chart data=model.firstObject.getFinishedAppsDataForDonutChart
- title="Finished Apps"
- showLabels=true
- parentId="finishedapps-donut-chart"
- ratio=0.55
- maxHeight=350}}
- </div>
-
- <div class="col-lg-3 container-fluid" id="runningapps-donut-chart">
- {{donut-chart data=model.firstObject.getRunningAppsDataForDonutChart
- title="Running Apps"
- showLabels=true
- parentId="runningapps-donut-chart"
- ratio=0.55
- maxHeight=350}}
- </div>
+<div class="col-md-12 container-fluid">
+ {{em-breadcrumbs items=breadcrumbs}}
</div>
-<hr>
+{{#if model}}
-<div class="row">
- <div class="col-lg-3 container-fluid" id="nodes-donut-chart">
- {{donut-chart data=model.firstObject.getNodesDataForDonutChart
- title="Node Managers"
- showLabels=true
- parentId="nodes-donut-chart"
- ratio=0.55
- maxHeight=350}}
- </div>
-</div>
+ <div class="col-md-12 container-fluid">
+ <div class="row">
+ <div class="col-lg-6 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Cluster Resource Usage By Applications
+ </div>
+ <div class="container-fluid" id="appusage-donut-chart">
+ {{app-usage-donut-chart data=model.apps
+ showLabels=true
+ parentId="appusage-donut-chart"
+ ratio=0.6
+ maxHeight=400}}
+ </div>
+ </div>
+ </div>
+
+ <div class="col-lg-6 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Cluster Resource Usage By Leaf Queues
+ </div>
+ <div class="container-fluid" id="queueusage-donut-chart">
+ {{queue-usage-donut-chart data=model.queues
+ showLabels=true
+ parentId="queueusage-donut-chart"
+ ratio=0.6
+ maxHeight=400}}
+ </div>
+ </div>
+ </div>
+ </div>
+ <hr>
-<hr>
+ <div class="row">
+ <div class="col-lg-4 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Finished Apps
+ </div>
+ <div class="container-fluid" id="finishedapps-donut-chart">
+ {{donut-chart data=model.clusterMetrics.firstObject.getFinishedAppsDataForDonutChart
+ showLabels=true
+ parentId="finishedapps-donut-chart"
+ ratio=0.6
+ maxHeight=350
+ colorTargets="good warn error"}}
+ </div>
+ </div>
+ </div>
-<div class="row">
- <div class="col-lg-3 container-fluid" id="mem-donut-chart">
- {{donut-chart data=model.firstObject.getMemoryDataForDonutChart
- title="Resource - Memory"
- showLabels=true
- parentId="mem-donut-chart"
- ratio=0.55
- maxHeight=350}}
+ <div class="col-lg-4 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Running Apps
+ </div>
+ <div class="container-fluid" id="runningapps-donut-chart">
+ {{donut-chart data=model.clusterMetrics.firstObject.getRunningAppsDataForDonutChart
+ showLabels=true
+ parentId="runningapps-donut-chart"
+ ratio=0.6
+ maxHeight=350
+ colorTargets="warn good"}}
+ </div>
+ </div>
+ </div>
+
+ <div class="col-lg-4 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Node Managers
+ </div>
+ <div class="container-fluid" id="nodes-donut-chart">
+ {{donut-chart data=model.clusterMetrics.firstObject.getNodesDataForDonutChart
+ showLabels=true
+ parentId="nodes-donut-chart"
+ ratio=0.6
+ maxHeight=350
+ colorTargets="good error warn"}}
+ </div>
+ </div>
+ </div>
</div>
- <div class="col-lg-3 container-fluid" id="vcore-donut-chart">
- {{donut-chart data=model.firstObject.getVCoreDataForDonutChart
- title="Resource - VCores"
- showLabels=true
- parentId="vcore-donut-chart"
- ratio=0.6
- maxHeight=350}}
+ <hr>
+ <div class="row">
+
+ <div class="col-lg-4 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Resource - Memory
+ </div>
+ <div class="container-fluid" id="mem-donut-chart">
+ {{donut-chart data=model.clusterMetrics.firstObject.getMemoryDataForDonutChart
+ showLabels=true
+ parentId="mem-donut-chart"
+ ratio=0.6
+ maxHeight=350
+ colorTargets="good"
+ colorTargetReverse=true
+ type="memory"}}
+ </div>
+ </div>
+ </div>
+
+ <div class="col-lg-4 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Resource - VCores
+ </div>
+ <div class="container-fluid" id="vcore-donut-chart">
+ {{donut-chart data=model.clusterMetrics.firstObject.getVCoreDataForDonutChart
+ showLabels=true
+ parentId="vcore-donut-chart"
+ ratio=0.6
+ maxHeight=350
+ colorTargets="good"
+ colorTargetReverse=true}}
+ </div>
+ </div>
+ </div>
</div>
</div>
+{{/if}}
+
+
{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-table.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-table.hbs
index 0788d9c..a036a0c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-table.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-table.hbs
@@ -20,6 +20,7 @@
<thead>
<tr>
<th>Application ID</th>
+ <th>Application Type</th>
<th>Name</th>
<th>User</th>
<th>Queue</th>
@@ -30,13 +31,15 @@
<th>Finished Time</th>
<th>Priority</th>
<th>Progress</th>
- </tr>
+ <th>%Cluster</th>
+ </tr>
</thead>
<tbody>
{{#if arr}}
{{#each arr as |app|}}
<tr>
<td><a href="#/yarn-app/{{app.id}}">{{app.id}}</a></td>
+ <td>{{app.applicationType}}</td>
<td>{{app.appName}}</td>
<td>{{app.user}}</td>
<td>{{app.queue}}</td>
@@ -53,11 +56,13 @@
</div>
</div>
</td>
+ <td>{{app.clusterUsagePercentage}}</td>
</tr>
{{/each}}
{{else}}
<tr>
<td><a href="#/yarn-app/{{app.id}}">{{app.id}}</a></td>
+ <td>{{app.applicationType}}</td>
<td>{{app.appName}}</td>
<td>{{app.user}}</td>
<td>{{app.queue}}</td>
@@ -74,7 +79,8 @@
</div>
</div>
</td>
- </tr>
+ <td>{{app.clusterUsagePercentage}}</td>
+ </tr>
{{/if}}
</tbody>
</table>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/node-menu-panel.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/node-menu-panel.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/node-menu-panel.hbs
index 1e07e89..d2486c9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/node-menu-panel.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/node-menu-panel.hbs
@@ -19,7 +19,7 @@
<div class="col-md-2 container-fluid">
<div class="panel panel-default">
<div class="panel-heading">
- <h4>Node Manager<br>({{node-name nodeId}})</h4>
+ <h4>Node Manager</h4>
</div>
<div class="panel-body">
<ul class="nav nav-pills nav-stacked" id="stacked-menu">
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/nodes-heatmap.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/nodes-heatmap.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/nodes-heatmap.hbs
new file mode 100644
index 0000000..e9e6261
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/nodes-heatmap.hbs
@@ -0,0 +1,27 @@
+{{!
+ * 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.
+}}
+
+<div class="container-fluid">
+ <div class="row">
+ <div class="col-md-6 container-fluid">
+ <input type="text" class="form-control" aria-label="..." placeholder="Enter part of host/rack to filter nodes"
+ onchange={{action "applyFilter"}}>
+ </div>
+ </div>
+</div>
+<p/>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/queue-configuration-table.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/queue-configuration-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/queue-configuration-table.hbs
index 9045976..17a1e1a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/queue-configuration-table.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/queue-configuration-table.hbs
@@ -25,10 +25,6 @@
</thead>
<tbody>
<tr>
- <td>Queue Name</td>
- <td>{{queue.id}}</td>
- </tr>
- <tr>
<td>Configured Capacity</td>
<td>{{queue.capacity}}</td>
</tr>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/queue-navigator.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/queue-navigator.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/queue-navigator.hbs
index fb9c6c8..d8dd236 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/queue-navigator.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/queue-navigator.hbs
@@ -16,21 +16,13 @@
* limitations under the License.
}}
-<div class="row">
- <div class="col-lg-4">
- <select class="js-example-basic-single" width="100%" id="queue-name-selector">
- {{item-selector element-id="queue-name-selector" prefix="Queue : " model=model}}
- </select>
- </div>
-</div><!-- /.row -->
-
<!-- queue selector -->
<div class="row">
- <div class="col-md-12 container-fluid" id="tree-selector-container">
+ <div class="col-md-12 container-fluid">
+ <div class="panel panel-default" id="tree-selector-container">
{{tree-selector model=model parentId="tree-selector-container" selected=selected}}
+ </div>
</div>
</div>
-<hr>
-
{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/timeline-view.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/timeline-view.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/timeline-view.hbs
index 6f529ba..b110268 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/timeline-view.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/timeline-view.hbs
@@ -26,12 +26,13 @@
{{/if}}
</div>
<div class="panel-body">
+ <br/><br/>
<div class="col-md-8 container-fluid" id={{parent-id}}>
</div>
<!-- diag info -->
<div class="col-md-4 container-fluid">
- <div class="panel panel-default">
+ <div class="panel panel-default add-ellipsis">
<div class="panel-heading">
{{#if selected.link}}
{{#link-to selected.linkname selected.id}}{{selected.id}}{{/link-to}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempt.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempt.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempt.hbs
index b01eceb..c30040b 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempt.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempt.hbs
@@ -16,10 +16,21 @@
* limitations under the License.
}}
+<div class="col-md-12 container-fluid">
+ {{em-breadcrumbs items=breadcrumbs}}
+</div>
+<br/><br/><br/>
<div class="container-fluid">
<div class="row">
{{#if model.attempt}}
- {{app-attempt-table attempt=model.attempt}}
+ <div class="container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Application attempt Information
+ </div>
+ {{app-attempt-table attempt=model.attempt}}
+ </div>
+ </div>
{{/if}}
</div>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempts.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempts.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempts.hbs
new file mode 100644
index 0000000..ffaa60d
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempts.hbs
@@ -0,0 +1,57 @@
+{{!
+ * 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.
+}}
+
+<div class="col-md-12 container-fluid">
+ {{em-breadcrumbs items=breadcrumbs}}
+</div>
+
+<div class="col-md-12 container-fluid">
+ <div class="row">
+
+ <div class="col-md-2 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4>Application</h4>
+ </div>
+ <div class="panel-body">
+ <ul class="nav nav-pills nav-stacked" id="stacked-menu">
+ <ul class="nav nav-pills nav-stacked collapse in">
+ {{#link-to 'yarn-app' tagName="li"}}
+ {{#link-to 'yarn-app' model.appId}}Information
+ {{/link-to}}
+ {{/link-to}}
+ {{#link-to 'yarn-app-attempts' tagName="li"}}
+ {{#link-to 'yarn-app-attempts' model.appId}}Attempts List
+ {{/link-to}}
+ {{/link-to}}
+ </ul>
+ </ul>
+ </div>
+ </div>
+ </div>
+
+ <div class="col-md-10 container-fluid">
+ <!-- timeline view of children -->
+ <div class="row">
+ {{timeline-view parent-id="attempt-timeline-div" my-id="timeline-view" height="100%" rmModel=model.attempts label="shortAppAttemptId" attemptModel=true}}
+ </div>
+ </div>
+
+ </div>
+</div>
+{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs
index 2bc20f2..4db4f8a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs
@@ -16,148 +16,238 @@
* limitations under the License.
}}
-<div class="container-fluid">
- <!-- app table -->
- <div class="row">
- <div class="col-md-12 container-fluid">
- <div class="panel panel-default">
- <div class="panel-heading">
- Application Basic Information
- </div>
- {{app-table table-id="app-table" app=model.app}}
- </div>
- </div>
- </div>
+<div class="col-md-12 container-fluid">
+ {{em-breadcrumbs items=breadcrumbs}}
+</div>
- <!-- diag info and other infos -->
+{{#if model.app}}
+<div class="col-md-12 container-fluid">
<div class="row">
- <!-- diag info -->
- <div class="col-md-4 container-fluid">
- {{#if model.app.isFailed}}
- <div class="panel panel-danger">
- <div class="panel-heading">
- Diagnostics
- </div>
- <div class="panel-body">{{model.app.diagnostics}}</div>
+
+ <div class="col-md-2 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4>Application</h4>
</div>
- {{else}}
- <div class="panel panel-default">
- <div class="panel-body">
- Diagnostics
- </div>
- <div class="panel-footer">{{model.app.diagnostics}}</div>
+ <div class="panel-body">
+ <ul class="nav nav-pills nav-stacked" id="stacked-menu">
+ <ul class="nav nav-pills nav-stacked collapse in">
+ {{#link-to 'yarn-app' tagName="li"}}
+ {{#link-to 'yarn-app' model.app.id}}Information
+ {{/link-to}}
+ {{/link-to}}
+ {{#link-to 'yarn-app-attempts' tagName="li"}}
+ {{#link-to 'yarn-app-attempts' model.app.id}}Attempts List
+ {{/link-to}}
+ {{/link-to}}
+ </ul>
+ </ul>
</div>
- {{/if}}
+ </div>
</div>
- <div class="col-md-5 container-fluid">
- <div class="panel panel-default">
- <div class="panel-heading">Scheduling Info</div>
- <table class="table">
- <tbody>
- <tr>
- <td>Allocated Resource</td>
- <td>{{model.app.allocatedResource}}</td>
- </tr>
- <tr>
- <td>Running Containers</td>
- <td>{{model.app.runningContainersNumber}}</td>
- </tr>
- <tr>
- <td>Preempted Resource</td>
- <td>{{model.app.preemptedResource}}</td>
- </tr>
- <tr>
- <td>Num Non-AM container preempted</td>
- <td>{{model.app.numAMContainerPreempted}}</td>
- </tr>
- <tr>
- <td>Num AM container preempted</td>
- <td>{{model.app.numAMContainerPreempted}}</td>
- </tr>
- <tr>
- <td>Aggregated Resource Usage</td>
- <td>{{model.app.aggregatedResourceUsage}}</td>
- </tr>
- </tbody>
- </table>
+ <div class="col-md-10 container-fluid">
+ <div class="row">
+ <div class="col-md-12 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">Basic Info</div>
+ <table class="display table table-striped table-bordered"
+ cellspacing="0" width="100%">
+ <thead>
+ <tr>
+ <th>Application ID</th>
+ <th>Name</th>
+ <th>User</th>
+ <th>Queue</th>
+ <th>State</th>
+ <th>Final Status</th>
+ <th>Start Time</th>
+ <th>Elapsed Time</th>
+ <th>Finished Time</th>
+ <th>Priority</th>
+ <th>Progress</th>
+ <th>Is Unmanaged AM</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td>{{model.app.id}}</td>
+ <td>{{model.app.appName}}</td>
+ <td>{{model.app.user}}</td>
+ <td>{{model.app.queue}}</td>
+ <td>{{model.app.state}}</td>
+ <td>
+ <span class={{model.app.finalStatusStyle}}>
+ {{model.app.finalStatus}}
+ </span>
+ </td>
+ <td>{{model.app.startTime}}</td>
+ <td>{{model.app.elapsedTime}}</td>
+ <td>{{model.app.validatedFinishedTs}}</td>
+ <td>{{model.app.priority}}</td>
+ <td>
+ <div class="progress" style="margin-bottom: 0;">
+ <div class="progress-bar" role="progressbar"
+ aria-valuenow="60" aria-valuemin="0"
+ aria-valuemax="100"
+ style={{model.app.progressStyle}}>
+ {{model.app.progress}}%
+ </div>
+ </div>
+ </td>
+ <td>{{model.app.unmanagedApplication}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
</div>
- </div>
- <!-- other info -->
- <div class="col-md-3 container-fluid">
- <div class="panel panel-default">
- <div class="panel-heading">Other Info</div>
- <table class="table">
- <tbody>
- <tr>
- <td>AM Container Log</td>
- <td><a href={{model.app.amContainerLogs}}>Link</a></td>
- </tr>
- <tr>
- <td>AM Host Http Addr</td>
- <td><a href={{model.app.amHostHttpAddress}}>Link</a></td>
- </tr>
- <tr>
- <td>Log Aggregation Status</td>
- <td>{{model.app.logAggregationStatus}}</td>
- </tr>
- <tr>
- <td>Is Unmanaged AM</td>
- <td>{{model.app.unmanagedApplication}}</td>
- </tr>
- <tr>
- <td>AM Node Label Expression</td>
- <td>{{model.app.amNodeLabelExpression}}</td>
- </tr>
- </tbody>
- </table>
+ <div class="row">
+ {{#if model.app.diagnostics}}
+ <div class="col-md-12 container-fluid">
+ {{#if model.app.isFailed}}
+ <div class="panel panel-danger">
+ <div class="panel-heading">
+ Diagnostics
+ </div>
+ <div class="panel-body">{{model.app.diagnostics}}</div>
+ </div>
+ {{else}}
+ <div class="panel panel-default">
+ <div class="panel-body">
+ Diagnostics
+ </div>
+ <div class="panel-footer">{{model.app.diagnostics}}</div>
+ </div>
+ {{/if}}
+ </div>
+ {{/if}}
</div>
- </div>
- </div>
-<!--
- <div class="row">
- <div class="col-md-12 container-fluid">
- <div class="panel panel-default">
- <div class="panel-heading">
- Application Attempts
+ <div class="row">
+ <div class="col-md-8 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">Scheduling Info</div>
+ <table class="display table table-striped table-bordered"
+ cellspacing="0" width="100%">
+ <thead>
+ <tr>
+ <th>Allocated Resource</th>
+ <th>Running Containers</th>
+ <th>Preempted Resource</th>
+ <th>Num Non-AM container preempted</th>
+ <th>Num AM container preempted</th>
+ <th>Aggregated Resource Usage</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td>{{model.app.allocatedResource}}</td>
+ <td>{{model.app.runningContainersNumber}}</td>
+ <td>{{model.app.preemptedResource}}</td>
+ <td>{{model.app.numAMContainerPreempted}}</td>
+ <td>{{model.app.numAMContainerPreempted}}</td>
+ <td>{{model.app.aggregatedResourceUsage}}</td>
+ </tr>
+ </tbody>
+ </table>
</div>
- <table id="app-attempt-table" class="table table-striped table-bordered" cellspacing="0" width="100%" height="100%">
- <thead>
+ </div>
+
+ <div class="col-md-4 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">App Master Info</div>
+ <table class="display table table-striped table-bordered"
+ cellspacing="0" width="100%">
+ <thead>
<tr>
- <th>Start Time</th>
- <th>Master ContainerId</th>
- <th>Node Http Address</th>
- <th>Node Id</th>
- <th>Logs Link</th>
- </tr>
- </thead>
- <tbody>
- {{#each model.attempts as |attempt|}}
- <tr>
- <td>{{attempt.startTime}}</td>
- <td>{{attempt.containerId}}</td>
- <td><a href={{attempt.nodeHttpAddress}}>{{attempt.nodeHttpAddress}}</a></td>
- <td>{{attempt.nodeId}}</td>
- <td><a href={{attempt.logsLink}}>link</a></td>
- </tr>
- {{/each}}
- </tbody>
- </table>
+ <th>Master Container Log</th>
+ <td>Master Node</td>
+ <td>Master Node Label Expr</td>
+ </tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td><a href={{model.app.amContainerLogs}}>Link</a></td>
+ <td><a href={{model.app.amHostHttpAddress}}>Link</a></td>
+ <td>{{model.app.amNodeLabelExpression}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
</div>
- </div>
- </div>
--->
- <!-- timeline view of children -->
- <div class="row">
- {{timeline-view parent-id="attempt-timeline-div" my-id="timeline-view" height="100%" rmModel=model.attempts label="shortAppAttemptId" attemptModel=true}}
- </div>
-</div>
+ </div>
+
+ {{#if model.nodes}}
+ {{#if model.rmContainers}}
+ <div class="row" id="stackd-bar-chart-mem">
+ {{per-app-memusage-by-nodes-stacked-barchart
+ nodes=model.nodes
+ rmContainers=model.rmContainers
+ parentId="stackd-bar-chart-mem"
+ title=(concat 'Memory usage by nodes for: [' model.app.id ']')}}
+ </div>
+
+ <hr>
+
+ <div class="row" id="stackd-bar-chart-ncontainer">
+ {{per-app-ncontainers-by-nodes-stacked-barchart
+ nodes=model.nodes
+ rmContainers=model.rmContainers
+ parentId="stackd-bar-chart-ncontainer"
+ title=(concat 'Running #Containers by nodes for: [' model.app.id ']')}}
+ </div>
+ {{/if}}
+ {{/if}}
-<!--
-{{simple-table table-id="app-attempt-table" paging=false bFilter=false}}
--->
+ </div>
+
+ <!--
+ <div class="row">
+ <div class="col-md-12 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Application Attempts
+ </div>
+ <table id="app-attempt-table" class="table table-striped table-bordered" cellspacing="0" width="100%" height="100%">
+ <thead>
+ <tr>
+ <th>Start Time</th>
+ <th>Master ContainerId</th>
+ <th>Node Http Address</th>
+ <th>Node Id</th>
+ <th>Logs Link</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#each model.attempts as |attempt|}}
+ <tr>
+ <td>{{attempt.startTime}}</td>
+ <td>{{attempt.containerId}}</td>
+ <td><a href={{attempt.nodeHttpAddress}}>{{attempt.nodeHttpAddress}}</a></td>
+ <td>{{attempt.nodeId}}</td>
+ <td><a href={{attempt.logsLink}}>link</a></td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+ -->
+ <!-- timeline view of children -->
+ <!--
+ <div class="row">
+ {{timeline-view parent-id="attempt-timeline-div" my-id="timeline-view" height="100%" rmModel=model.attempts label="shortAppAttemptId" attemptModel=true}}
+ </div>
+ -->
+ </div>
+</div>
+{{/if}}
{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps.hbs
index 0fc6edf..ec17379 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps.hbs
@@ -15,10 +15,78 @@
* See the License for the specific language governing permissions and
* limitations under the License.
}}
-{{#if model}}
- {{app-table table-id="apps-table" arr=model}}
- {{simple-table table-id="apps-table" bFilter=true colsOrder="0,desc" colTypes="natural elapsed-time" colTargets="0 7"}}
-{{else}}
- <h4 align = "center">Could not find any applications from this cluster</h4>
-{{/if}}
-{{outlet}}
+
+<div class="col-md-12 container-fluid">
+ {{em-breadcrumbs items=breadcrumbs}}
+</div>
+
+<div class="col-md-12 container-fluid">
+ <div class="row">
+
+ <div class="col-md-2 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4>Application</h4>
+ </div>
+ <div class="panel-body">
+ <ul class="nav nav-pills nav-stacked" id="stacked-menu">
+ <ul class="nav nav-pills nav-stacked collapse in">
+ {{#link-to 'yarn-apps.apps' tagName="li"}}
+ {{#link-to 'yarn-apps.apps'}}All Applications
+ {{/link-to}}
+ {{/link-to}}
+ {{#link-to 'yarn-apps.services' tagName="li"}}
+ {{#link-to 'yarn-apps.services'}}Long Running Services
+ {{/link-to}}
+ {{/link-to}}
+ </ul>
+ </ul>
+ </div>
+ </div>
+ </div>
+
+ <div class="col-md-10 container-fluid">
+ {{#if model.clusterMetrics}}
+ <div class="row">
+ <div class="col-lg-4 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Finished Apps
+ </div>
+ <div class="container-fluid" id="finishedapps-donut-chart">
+ {{donut-chart data=model.clusterMetrics.firstObject.getFinishedAppsDataForDonutChart
+ showLabels=true
+ parentId="finishedapps-donut-chart"
+ ratio=0.6
+ maxHeight=350
+ colorTargets="good warn error"
+ }}
+ </div>
+ </div>
+ </div>
+
+ <div class="col-lg-4 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Running Apps
+ </div>
+ <div class="container-fluid" id="runningapps-donut-chart">
+ {{donut-chart data=model.clusterMetrics.firstObject.getRunningAppsDataForDonutChart
+ showLabels=true
+ parentId="runningapps-donut-chart"
+ ratio=0.6
+ maxHeight=350
+ colorTargets="warn good"
+ }}
+ </div>
+ </div>
+ </div>
+ </div>
+ {{/if}}
+
+ <div class="row">
+ {{outlet}}
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps/apps.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps/apps.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps/apps.hbs
new file mode 100644
index 0000000..a2ba163
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps/apps.hbs
@@ -0,0 +1,24 @@
+{{!--
+ 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.
+--}}
+
+{{#if model.apps}}
+ {{app-table table-id="apps-table" arr=model.apps}}
+ {{simple-table table-id="apps-table" bFilter=true colsOrder="0,desc" colTypes="natural elapsed-time" colTargets="0 7"}}
+{{else}}
+ <h4 align="center">Could not find any applications from this cluster</h4>
+{{/if}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps/services.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps/services.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps/services.hbs
new file mode 100644
index 0000000..e472e8e
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps/services.hbs
@@ -0,0 +1,27 @@
+{{!--
+ 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.
+--}}
+
+{{#if model.apps}}
+ {{app-table table-id="apps-table" arr=model.apps}}
+ {{simple-table table-id="apps-table" bFilter=true colsOrder="0,desc"
+ colTypes="natural elapsed-time" colTargets="0 7" defaultSearch="slider"}}
+{{else}}
+ <h4 align="center">Could not find any applications from this cluster</h4>
+{{/if}}
+
+{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-apps.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-apps.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-apps.hbs
index 42de7eb..832e452 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-apps.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-apps.hbs
@@ -17,6 +17,10 @@
--}}
<div class="col-md-12 container-fluid">
+ {{em-breadcrumbs items=breadcrumbs}}
+</div>
+
+<div class="col-md-12 container-fluid">
<div class="row">
{{node-menu-panel path="yarn-node-apps" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
{{#if model.apps}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-container.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-container.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-container.hbs
index 4104eec..224c695 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-container.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-container.hbs
@@ -17,6 +17,10 @@
--}}
<div class="col-md-12 container-fluid">
+ {{em-breadcrumbs items=breadcrumbs}}
+</div>
+
+<div class="col-md-12 container-fluid">
<div class="row">
{{node-menu-panel path="yarn-node-container" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
<div class="col-md-10 container-fluid">
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs
index 3ebcc6f..e96c83f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs
@@ -17,6 +17,10 @@
--}}
<div class="col-md-12 container-fluid">
+ {{em-breadcrumbs items=breadcrumbs}}
+</div>
+
+<div class="col-md-12 container-fluid">
<div class="row">
{{node-menu-panel path="yarn-node-containers" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
{{#if model.containers}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs
index d6f30ec..ddec5c4 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs
@@ -17,78 +17,104 @@
--}}
<div class="col-md-12 container-fluid">
+ {{em-breadcrumbs items=breadcrumbs}}
+</div>
+
+<div class="col-md-12 container-fluid">
<div class="row">
+
{{node-menu-panel path="yarn-node" nodeId=model.rmNode.id nodeAddr=model.node.id}}
+
<div class="col-md-10 container-fluid">
- <div class="panel panel-default">
- <div class="panel-heading">Node Information</div>
+
+ <div class="row">
+ <div class="col-md-12 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">Node Information</div>
<table class="table">
<tbody>
- <tr>
- <td>Total Vmem allocated for Containers</td>
- <td>{{divide num=model.node.totalVmemAllocatedContainersMB den=1024}} GB</td>
- </tr>
- <tr>
- <td>Vmem enforcement enabled</td>
- <td>{{model.node.vmemCheckEnabled}}</td>
- </tr>
- <tr>
- <td>Total Pmem allocated for Containers</td>
- <td>{{divide num=model.node.totalPmemAllocatedContainersMB den=1024}} GB</td>
- </tr>
- <tr>
- <td>Pmem enforcement enabled</td>
- <td>{{model.node.pmemCheckEnabled}}</td>
- </tr>
- <tr>
- <td>Total VCores allocated for Containers</td>
- <td>{{model.node.totalVCoresAllocatedContainers}}</td>
- </tr>
- <tr>
- <td>Node Healthy Status</td>
- <td>{{model.node.nodeHealthy}}</td>
- </tr>
- <tr>
- <td>Last Node Health Report Time</td>
- <td>{{model.node.lastNodeUpdateTime}}</td>
- </tr>
- <tr>
- <td>Node Health Report</td>
- <td>{{model.node.healthReport}}</td>
- </tr>
- <tr>
- <td>Node Manager Start Time</td>
- <td>{{model.node.nmStartupTime}}</td>
- </tr>
- <tr>
- <td>Node Manager Version</td>
- <td>{{model.node.nodeManagerBuildVersion}}</td>
- </tr>
- <tr>
- <td>Hadoop Version</td>
- <td>{{model.node.hadoopBuildVersion}}</td>
- </tr>
+ <tr>
+ <td>Total Vmem allocated for Containers</td>
+ <td>{{divide num=model.node.totalVmemAllocatedContainersMB den=1024}} GB</td>
+ </tr>
+ <tr>
+ <td>Vmem enforcement enabled</td>
+ <td>{{model.node.vmemCheckEnabled}}</td>
+ </tr>
+ <tr>
+ <td>Total Pmem allocated for Containers</td>
+ <td>{{divide num=model.node.totalPmemAllocatedContainersMB den=1024}} GB</td>
+ </tr>
+ <tr>
+ <td>Pmem enforcement enabled</td>
+ <td>{{model.node.pmemCheckEnabled}}</td>
+ </tr>
+ <tr>
+ <td>Total VCores allocated for Containers</td>
+ <td>{{model.node.totalVCoresAllocatedContainers}}</td>
+ </tr>
+ <tr>
+ <td>Node Healthy Status</td>
+ <td>{{model.node.nodeHealthy}}</td>
+ </tr>
+ <tr>
+ <td>Last Node Health Report Time</td>
+ <td>{{model.node.lastNodeUpdateTime}}</td>
+ </tr>
+ <tr>
+ <td>Node Health Report</td>
+ <td>{{model.node.healthReport}}</td>
+ </tr>
+ <tr>
+ <td>Node Manager Start Time</td>
+ <td>{{model.node.nmStartupTime}}</td>
+ </tr>
+ <tr>
+ <td>Node Manager Version</td>
+ <td>{{model.node.nodeManagerBuildVersion}}</td>
+ </tr>
+ <tr>
+ <td>Hadoop Version</td>
+ <td>{{model.node.hadoopBuildVersion}}</td>
+ </tr>
</tbody>
</table>
</div>
- <div class="col-lg-4 container-fluid" id="mem-donut-chart">
- {{donut-chart data=model.rmNode.getMemoryDataForDonutChart
- title="Resource - Memory (in MB)"
- showLabels=true
- parentId="mem-donut-chart"
- ratio=0.55
- maxHeight=350}}
+ </div>
</div>
- <div class="col-lg-4 container-fluid" id="vcore-donut-chart">
- {{donut-chart data=model.rmNode.getVCoreDataForDonutChart
- title="Resource - VCores"
- showLabels=true
- parentId="vcore-donut-chart"
- ratio=0.55
- maxHeight=350}}
- </div>
+ <div class="row">
+ <div class="col-lg-4 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Resource - Memory (in MB)
+ </div>
+ <div class="container-fluid" id="mem-donut-chart">
+ {{donut-chart data=model.rmNode.getMemoryDataForDonutChart
+ showLabels=true
+ parentId="mem-donut-chart"
+ ratio=0.6
+ maxHeight=350}}
+ </div>
+ </div>
+ </div>
+
+ <div class="col-lg-4 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Resource - VCores
+ </div>
+ <div class="container-fluid" id="vcore-donut-chart">
+ {{donut-chart data=model.rmNode.getVCoreDataForDonutChart
+ showLabels=true
+ parentId="vcore-donut-chart"
+ ratio=0.6
+ maxHeight=350}}
+ </div>
+ </div>
+ </div>
</div>
</div>
+ </div>
</div>
{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs
index 3c78498..ffab3e9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs
@@ -16,48 +16,57 @@
limitations under the License.
--}}
-{{#if model}}
-<table id="nodes-table" class="display table table-striped table-bordered" cellspacing="0" width="100%">
- <thead>
- <tr>
- <th>Node Labels</th>
- <th>Rack</th>
- <th>Node State</th>
- <th>Node Address</th>
- <th>Node HTTP Address</th>
- <th>Last Health Update</th>
- <th>Health-Report</th>
- <th>Containers</th>
- <th>Mem Used</th>
- <th>Mem Avail</th>
- <th>VCores Used</th>
- <th>VCores Avail</th>
- <th>Version</th>
- </tr>
- </thead>
- <tbody>
- {{#each model as |node|}}
- <tr>
- <td>{{node.nodeLabelsAsString}}</td>
- <td>{{node.rack}}</td>
- <td><span class={{node.nodeStateStyle}}>{{node.state}}</span></td>
- <td>{{node.id}}</td>
- {{node-link nodeId=node.id nodeHTTPAddress=node.nodeHTTPAddress nodeState=node.state}}
- <td>{{node.lastHealthUpdate}}</td>
- <td>{{node.healthReport}}</td>
- <td>{{node.numContainers}}</td>
- <td>{{divide num=node.usedMemoryMB den=1024}} GB</td>
- <td>{{divide num=node.availMemoryMB den=1024}} GB</td>
- <td>{{node.usedVirtualCores}}</td>
- <td>{{node.availableVirtualCores}}</td>
- <td>{{node.version}}</td>
- </tr>
- {{/each}}
- </tbody>
-</table>
-
-{{simple-table table-id="nodes-table" bFilter=true}}
-{{else}}
- <h4 align = "center">No nodes found on this cluster</h4>
-{{/if}}
-{{outlet}}
+<div class="col-md-12 container-fluid">
+ {{em-breadcrumbs items=breadcrumbs}}
+</div>
+
+<div class="row">
+ <div class="col-md-2 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4>Nodes</h4>
+ </div>
+ <div class="panel-body">
+ <ul class="nav nav-pills nav-stacked" id="stacked-menu">
+ <ul class="nav nav-pills nav-stacked collapse in">
+
+ {{#link-to "yarn-nodes.table" tagName="li"}}
+ {{#link-to 'yarn-nodes.table'}}Nodes Table
+ {{/link-to}}
+ {{/link-to}}
+
+ {{#link-to 'yarn-nodes.heatmap' tagName="li"}}
+ {{#link-to 'yarn-nodes.heatmap'}}Nodes Heatmap Chart
+ {{/link-to}}
+ {{/link-to}}
+
+ </ul>
+ </ul>
+ </div>
+ </div>
+ </div>
+
+ <div class="col-md-10 container-fluid">
+ {{#if model.clusterMetrics}}
+ <div class="row">
+ <div class="col-lg-4 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Node Managers
+ </div>
+ <div class="container-fluid" id="nodes-donut-chart">
+ {{donut-chart data=model.clusterMetrics.firstObject.getNodesDataForDonutChart
+ showLabels=true
+ parentId="nodes-donut-chart"
+ ratio=0.6
+ maxHeight=350
+ colorTargets="good error warn"}}
+ </div>
+ </div>
+ </div>
+ </div>
+ {{/if}}
+
+ {{outlet}}
+ </div>
+</div>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes/heatmap.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes/heatmap.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes/heatmap.hbs
new file mode 100644
index 0000000..e06249f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes/heatmap.hbs
@@ -0,0 +1,30 @@
+{{!--
+ 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.
+--}}
+
+{{#if model.nodes}}
+
+ <div class="row">
+ <div class="col-lg-12 container-fluid" id="nodes-heatmap-chart">
+ {{nodes-heatmap model=model.nodes parentId="nodes-heatmap-chart"
+ title="Node Heatmap Chart (Usage of Memory)"}}
+ </div>
+ </div>
+
+{{/if}}
+
+{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes/table.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes/table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes/table.hbs
new file mode 100644
index 0000000..d9fae3a
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes/table.hbs
@@ -0,0 +1,67 @@
+{{!--
+ 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.
+--}}
+<div class="row">
+
+ {{#if model.nodes}}
+ <table id="nodes-table" class="display table table-striped table-bordered"
+ cellspacing="0" width="100%">
+ <thead>
+ <tr>
+ <th>Node Labels</th>
+ <th>Rack</th>
+ <th>Node State</th>
+ <th>Node Address</th>
+ <th>Node HTTP Address</th>
+ <th>Last Health Update</th>
+ <th>Health-Report</th>
+ <th>Containers</th>
+ <th>Mem Used</th>
+ <th>Mem Avail</th>
+ <th>VCores Used</th>
+ <th>VCores Avail</th>
+ <th>Version</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#each model.nodes as |node|}}
+ <tr>
+ <td>{{node.nodeLabelsAsString}}</td>
+ <td>{{node.rack}}</td>
+ <td><span class={{node.nodeStateStyle}}>{{node.state}}</span></td>
+ <td>{{node.id}}</td>
+ {{node-link nodeId=node.id nodeHTTPAddress=node.nodeHTTPAddress nodeState=node.state}}
+ <td>{{node.lastHealthUpdate}}</td>
+ <td>{{node.healthReport}}</td>
+ <td>{{node.numContainers}}</td>
+ <td>{{divide num=node.usedMemoryMB den=1024}} GB</td>
+ <td>{{divide num=node.availMemoryMB den=1024}} GB</td>
+ <td>{{node.usedVirtualCores}}</td>
+ <td>{{node.availableVirtualCores}}</td>
+ <td>{{node.version}}</td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+
+ {{simple-table table-id="nodes-table" bFilter=true}}
+ {{else}}
+ <h4 align="center">No nodes found on this cluster</h4>
+ {{/if}}
+</div>
+
+{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue-apps.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue-apps.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue-apps.hbs
new file mode 100644
index 0000000..7cfd4c6
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue-apps.hbs
@@ -0,0 +1,66 @@
+{{!
+ * 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.
+}}
+
+<div class="col-md-12 container-fluid">
+ {{em-breadcrumbs items=breadcrumbs}}
+</div>
+
+<div class="col-md-12 container-fluid">
+ <div class="row">
+
+ <div class="col-md-2 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4>Application</h4>
+ </div>
+ <div class="panel-body">
+ <ul class="nav nav-pills nav-stacked" id="stacked-menu">
+ <ul class="nav nav-pills nav-stacked collapse in">
+ {{#link-to 'yarn-queue' tagName="li"}}
+ {{#link-to 'yarn-queue' model.selected}}Information
+ {{/link-to}}
+ {{/link-to}}
+ {{#link-to 'yarn-queue-apps' tagName="li"}}
+ {{#link-to 'yarn-queue-apps' model.selected}}Applications List
+ {{/link-to}}
+ {{/link-to}}
+ </ul>
+ </ul>
+ </div>
+ </div>
+ </div>
+
+ <div class="col-md-10 container-fluid">
+ <!-- timeline view of children -->
+ <div class="row">
+
+ <div class="col-lg-12 container-fluid">
+ {{#if model.apps}}
+ {{app-table table-id="apps-table" arr=model.apps}}
+ {{simple-table table-id="apps-table" bFilter=true colTypes="elapsed-time" colTargets="7"}}
+ {{else}}
+ <h4 align = "center">Could not find any applications from this cluster</h4>
+ {{/if}}
+ </div>
+
+ </div>
+ </div>
+
+ </div>
+</div>
+{{outlet}}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[04/50] [abbrv] hadoop git commit: HADOOP-13353. LdapGroupsMapping
getPassward shouldn't return null when IOException throws. Contributed by
Zhaohao Liang and Wei-Chiu Chuang.
Posted by wa...@apache.org.
HADOOP-13353. LdapGroupsMapping getPassward shouldn't return null when IOException throws. Contributed by Zhaohao Liang and Wei-Chiu Chuang.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/49ba09a9
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/49ba09a9
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/49ba09a9
Branch: refs/heads/YARN-3368
Commit: 49ba09a9221ad1e25e89800f6c455bbaad41483b
Parents: d81b816
Author: Wei-Chiu Chuang <we...@apache.org>
Authored: Fri Aug 5 16:32:44 2016 -0700
Committer: Wei-Chiu Chuang <we...@apache.org>
Committed: Fri Aug 5 16:32:44 2016 -0700
----------------------------------------------------------------------
.../hadoop/security/LdapGroupsMapping.java | 12 ++++-------
.../hadoop/security/TestLdapGroupsMapping.java | 21 ++++++++++++++++++++
2 files changed, 25 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/49ba09a9/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/LdapGroupsMapping.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/LdapGroupsMapping.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/LdapGroupsMapping.java
index 4b941ef..24d07c6 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/LdapGroupsMapping.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/LdapGroupsMapping.java
@@ -616,19 +616,15 @@ public class LdapGroupsMapping
}
String getPassword(Configuration conf, String alias, String defaultPass) {
- String password = null;
+ String password = defaultPass;
try {
char[] passchars = conf.getPassword(alias);
if (passchars != null) {
password = new String(passchars);
}
- else {
- password = defaultPass;
- }
- }
- catch (IOException ioe) {
- LOG.warn("Exception while trying to password for alias " + alias + ": "
- + ioe.getMessage());
+ } catch (IOException ioe) {
+ LOG.warn("Exception while trying to get password for alias " + alias
+ + ": ", ioe);
}
return password;
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/49ba09a9/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestLdapGroupsMapping.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestLdapGroupsMapping.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestLdapGroupsMapping.java
index 131b4e6..9e9f5a5 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestLdapGroupsMapping.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestLdapGroupsMapping.java
@@ -57,6 +57,7 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.Mockito;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -364,4 +365,24 @@ public class TestLdapGroupsMapping extends TestLdapGroupsMappingBase {
}
}
+ /**
+ * Make sure that when
+ * {@link Configuration#getPassword(String)} throws an IOException,
+ * {@link LdapGroupsMapping#setConf(Configuration)} does not throw an NPE.
+ *
+ * @throws Exception
+ */
+ @Test(timeout = 10000)
+ public void testSetConf() throws Exception {
+ Configuration conf = new Configuration();
+ Configuration mockConf = Mockito.spy(conf);
+ when(mockConf.getPassword(anyString()))
+ .thenThrow(new IOException("injected IOException"));
+ // Set a dummy LDAP server URL.
+ mockConf.set(LdapGroupsMapping.LDAP_URL_KEY, "ldap://test");
+
+ LdapGroupsMapping groupsMapping = getGroupsMapping();
+ groupsMapping.setConf(mockConf);
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[23/50] [abbrv] hadoop git commit: HDFS-10342.
BlockManager#createLocatedBlocks should not check corrupt replicas if none
are corrupt. Contributed by Kuhu Shukla.
Posted by wa...@apache.org.
HDFS-10342. BlockManager#createLocatedBlocks should not check corrupt replicas if none are corrupt. Contributed by Kuhu Shukla.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/b10c9360
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/b10c9360
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/b10c9360
Branch: refs/heads/YARN-3368
Commit: b10c936020e2616609dcb3b2126e8c34328c10ca
Parents: 4aba858
Author: Kihwal Lee <ki...@apache.org>
Authored: Tue Aug 9 11:55:34 2016 -0500
Committer: Kihwal Lee <ki...@apache.org>
Committed: Tue Aug 9 11:56:21 2016 -0500
----------------------------------------------------------------------
.../server/blockmanagement/BlockManager.java | 37 ++++++++++++++------
.../blockmanagement/TestBlockManager.java | 19 ++++++++++
2 files changed, 46 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b10c9360/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java
index 7411a6a..0e7a59b 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java
@@ -1050,17 +1050,19 @@ public class BlockManager implements BlockStatsMXBean {
final byte[] blockIndices = blk.isStriped() ? new byte[numMachines] : null;
int j = 0, i = 0;
if (numMachines > 0) {
+ final boolean noCorrupt = (numCorruptReplicas == 0);
for(DatanodeStorageInfo storage : blocksMap.getStorages(blk)) {
- final DatanodeDescriptor d = storage.getDatanodeDescriptor();
- final boolean replicaCorrupt = corruptReplicas.isReplicaCorrupt(blk, d);
- if ((isCorrupt || (!replicaCorrupt)) &&
- storage.getState() != State.FAILED) {
- machines[j++] = storage;
- // TODO this can be more efficient
- if (blockIndices != null) {
- byte index = ((BlockInfoStriped) blk).getStorageBlockIndex(storage);
- assert index >= 0;
- blockIndices[i++] = index;
+ if (storage.getState() != State.FAILED) {
+ if (noCorrupt) {
+ machines[j++] = storage;
+ i = setBlockIndices(blk, blockIndices, i, storage);
+ } else {
+ final DatanodeDescriptor d = storage.getDatanodeDescriptor();
+ final boolean replicaCorrupt = isReplicaCorrupt(blk, d);
+ if (isCorrupt || !replicaCorrupt) {
+ machines[j++] = storage;
+ i = setBlockIndices(blk, blockIndices, i, storage);
+ }
}
}
}
@@ -4586,4 +4588,19 @@ public class BlockManager implements BlockStatsMXBean {
boolean isGenStampInFuture(Block block) {
return blockIdManager.isGenStampInFuture(block);
}
+
+ boolean isReplicaCorrupt(BlockInfo blk, DatanodeDescriptor d) {
+ return corruptReplicas.isReplicaCorrupt(blk, d);
+ }
+
+ private int setBlockIndices(BlockInfo blk, byte[] blockIndices, int i,
+ DatanodeStorageInfo storage) {
+ // TODO this can be more efficient
+ if (blockIndices != null) {
+ byte index = ((BlockInfoStriped)blk).getStorageBlockIndex(storage);
+ assert index >= 0;
+ blockIndices[i++] = index;
+ }
+ return i;
+ }
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b10c9360/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java
index bbaf91f..535acd7 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java
@@ -1265,4 +1265,23 @@ public class TestBlockManager {
file.delete();
}
}
+
+ @Test
+ public void testIsReplicaCorruptCall() throws Exception {
+ BlockManager spyBM = spy(bm);
+ List<DatanodeStorageInfo> origStorages = getStorages(0, 1, 3);
+ List<DatanodeDescriptor> origNodes = getNodes(origStorages);
+ BlockInfo blockInfo = addBlockOnNodes(0, origNodes);
+ spyBM.createLocatedBlocks(new BlockInfo[]{blockInfo}, 3L, false, 0L, 3L,
+ false, false, null, null);
+ verify(spyBM, Mockito.atLeast(0)).
+ isReplicaCorrupt(Mockito.any(BlockInfo.class),
+ Mockito.any(DatanodeDescriptor.class));
+ addCorruptBlockOnNodes(0, origNodes);
+ spyBM.createLocatedBlocks(new BlockInfo[]{blockInfo}, 3L, false, 0L, 3L,
+ false, false, null, null);
+ verify(spyBM, Mockito.atLeast(1)).
+ isReplicaCorrupt(Mockito.any(BlockInfo.class),
+ Mockito.any(DatanodeDescriptor.class));
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[06/50] [abbrv] hadoop git commit: YARN-5287. LinuxContainerExecutor
fails to set proper permission. Contributed by Ying Zhang
Posted by wa...@apache.org.
YARN-5287. LinuxContainerExecutor fails to set proper permission. Contributed by Ying Zhang
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/131d58a2
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/131d58a2
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/131d58a2
Branch: refs/heads/YARN-3368
Commit: 131d58a24edcf3b492a7dd0fa5bb3dbf27daf95d
Parents: 10ed06a
Author: Naganarasimha <na...@apache.org>
Authored: Sun Aug 7 01:08:13 2016 +0530
Committer: Naganarasimha <na...@apache.org>
Committed: Sun Aug 7 01:08:13 2016 +0530
----------------------------------------------------------------------
.../impl/container-executor.c | 11 ++++-
.../impl/container-executor.h | 10 +++++
.../test/test-container-executor.c | 42 ++++++++++++++++++++
3 files changed, 62 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/131d58a2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c
index e0a97b1..40b8edc0 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c
@@ -569,6 +569,15 @@ int create_validate_dir(const char* npath, mode_t perm, const char* path,
if (check_dir(npath, sb.st_mode, perm, finalComponent) == -1) {
return -1;
}
+ } else {
+ // Explicitly set permission after creating the directory in case
+ // umask has been set to a restrictive value, i.e., 0077.
+ if (chmod(npath, perm) != 0) {
+ int permInt = perm & (S_IRWXU | S_IRWXG | S_IRWXO);
+ fprintf(LOGFILE, "Can't chmod %s to the required permission %o - %s\n",
+ npath, permInt, strerror(errno));
+ return -1;
+ }
}
} else {
if (check_dir(npath, sb.st_mode, perm, finalComponent) == -1) {
@@ -599,7 +608,7 @@ int check_dir(const char* npath, mode_t st_mode, mode_t desired, int finalCompon
* Function to prepare the container directories.
* It creates the container work and log directories.
*/
-static int create_container_directories(const char* user, const char *app_id,
+int create_container_directories(const char* user, const char *app_id,
const char *container_id, char* const* local_dir, char* const* log_dir, const char *work_dir) {
// create dirs as 0750
const mode_t perms = S_IRWXU | S_IRGRP | S_IXGRP;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/131d58a2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.h
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.h b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.h
index 449c7f0..be78283 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.h
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.h
@@ -279,3 +279,13 @@ int traffic_control_read_stats(char *command_file);
* Run a docker command passing the command file as an argument
*/
int run_docker(const char *command_file);
+
+/**
+ * Function to prepare the container directories.
+ * It creates the container work and log directories.
+ */
+int create_container_directories(const char* user, const char *app_id,
+ const char *container_id, char* const* local_dir,
+ char* const* log_dir, const char *work_dir);
+
+int create_log_dirs(const char *app_id, char * const * log_dirs);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/131d58a2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/test/test-container-executor.c
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/test/test-container-executor.c b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/test/test-container-executor.c
index 5166097..cad7c3f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/test/test-container-executor.c
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/test/test-container-executor.c
@@ -808,6 +808,44 @@ void test_recursive_unlink_children() {
}
}
+/**
+ * This test is used to verify that app and container directories can be
+ * created with required permissions when umask has been set to a restrictive
+ * value of 077.
+ */
+void test_dir_permissions() {
+ printf("\nTesting dir permissions\n");
+
+ // Set umask to 077
+ umask(077);
+
+ // Change user to the yarn user. This only takes effect when we're
+ // running as root.
+ if (seteuid(user_detail->pw_uid) != 0) {
+ printf("FAIL: failed to seteuid to user - %s\n", strerror(errno));
+ exit(1);
+ }
+
+ // Create container directories for "app_5"
+ char* container_dir = get_container_work_directory(TEST_ROOT "/local-1",
+ yarn_username, "app_5", "container_1");
+ create_log_dirs("app_5", log_dirs);
+ create_container_directories(yarn_username, "app_5", "container_1",
+ local_dirs, log_dirs, container_dir);
+
+ // Verify directories have been created with required permissions
+ mode_t container_dir_perm = S_IRWXU | S_IRGRP | S_IXGRP;
+ struct stat sb;
+ if (stat(container_dir, &sb) != 0 ||
+ check_dir(container_dir, sb.st_mode, container_dir_perm, 1) != 0) {
+ printf("FAIL: failed to create container directory %s "
+ "with required permissions\n", container_dir);
+ exit(1);
+ }
+
+ free(container_dir);
+}
+
// This test is expected to be executed either by a regular
// user or by root. If executed by a regular user it doesn't
// test all the functions that would depend on changing the
@@ -936,6 +974,10 @@ int main(int argc, char **argv) {
test_run_container();
}
+ // This test needs to be run in a subshell, so that when it changes umask
+ // and user, it doesn't give up our privs.
+ run_test_in_child("test_dir_permissions", test_dir_permissions);
+
/*
* try to seteuid(0). if it doesn't work, carry on anyway.
* we're going to capture the return value to get rid of a
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[26/50] [abbrv] hadoop git commit: HADOOP-13473. Tracing in IPC
Server is broken. Contributed by Daryn Sharp.
Posted by wa...@apache.org.
HADOOP-13473. Tracing in IPC Server is broken. Contributed by Daryn Sharp.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/caf800d5
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/caf800d5
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/caf800d5
Branch: refs/heads/YARN-3368
Commit: caf800d5290d8618003b764afb0b3ef8d9a5a0a8
Parents: c4b77ae
Author: Kihwal Lee <ki...@apache.org>
Authored: Tue Aug 9 14:33:15 2016 -0500
Committer: Kihwal Lee <ki...@apache.org>
Committed: Tue Aug 9 14:33:15 2016 -0500
----------------------------------------------------------------------
.../apache/hadoop/ipc/ProtobufRpcEngine.java | 36 +++++++++++++++++---
1 file changed, 32 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/caf800d5/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine.java
index cce5166..eb30aa2 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine.java
@@ -69,7 +69,7 @@ public class ProtobufRpcEngine implements RpcEngine {
static { // Register the rpcRequest deserializer for WritableRpcEngine
org.apache.hadoop.ipc.Server.registerProtocolEngine(
- RPC.RpcKind.RPC_PROTOCOL_BUFFER, RpcWritable.Buffer.class,
+ RPC.RpcKind.RPC_PROTOCOL_BUFFER, RpcProtobufRequest.class,
new Server.ProtoBufRpcInvoker());
}
@@ -613,9 +613,8 @@ public class ProtobufRpcEngine implements RpcEngine {
*/
public Writable call(RPC.Server server, String connectionProtocolName,
Writable writableRequest, long receiveTime) throws Exception {
- RpcWritable.Buffer request = (RpcWritable.Buffer) writableRequest;
- RequestHeaderProto rpcRequest =
- request.getValue(RequestHeaderProto.getDefaultInstance());
+ RpcProtobufRequest request = (RpcProtobufRequest) writableRequest;
+ RequestHeaderProto rpcRequest = request.getRequestHeader();
String methodName = rpcRequest.getMethodName();
/**
@@ -687,4 +686,33 @@ public class ProtobufRpcEngine implements RpcEngine {
}
}
}
+
+ // htrace in the ipc layer creates the span name based on toString()
+ // which uses the rpc header. in the normal case we want to defer decoding
+ // the rpc header until needed by the rpc engine.
+ static class RpcProtobufRequest extends RpcWritable.Buffer {
+ private RequestHeaderProto lazyHeader;
+
+ public RpcProtobufRequest() {
+ }
+
+ synchronized RequestHeaderProto getRequestHeader() throws IOException {
+ if (lazyHeader == null) {
+ lazyHeader = getValue(RequestHeaderProto.getDefaultInstance());
+ }
+ return lazyHeader;
+ }
+
+ // this is used by htrace to name the span.
+ @Override
+ public String toString() {
+ try {
+ RequestHeaderProto header = getRequestHeader();
+ return header.getDeclaringClassProtocolName() + "." +
+ header.getMethodName();
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[29/50] [abbrv] hadoop git commit: YARN-4733. [YARN-3368] Initial
commit of new YARN web UI. (wangda)
Posted by wa...@apache.org.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-metric.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-metric.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-metric.js
new file mode 100644
index 0000000..d39885e
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-metric.js
@@ -0,0 +1,29 @@
+import DS from 'ember-data';
+
+export default DS.JSONAPISerializer.extend({
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ var fixedPayload = {
+ id: id,
+ type: primaryModelClass.modelName,
+ attributes: payload
+ };
+
+ return this._super(store, primaryModelClass, fixedPayload, id,
+ requestType);
+ },
+
+ normalizeArrayResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // return expected is { data: [ {}, {} ] }
+ var normalizedArrayResponse = {};
+
+ // payload has apps : { app: [ {},{},{} ] }
+ // need some error handling for ex apps or app may not be defined.
+ normalizedArrayResponse.data = [
+ this.normalizeSingleResponse(store, primaryModelClass,
+ payload.clusterMetrics, 1, requestType)
+ ];
+ return normalizedArrayResponse;
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app-attempt.js
new file mode 100644
index 0000000..c5394d0
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app-attempt.js
@@ -0,0 +1,49 @@
+import DS from 'ember-data';
+import Converter from 'yarn-ui/utils/converter';
+
+export default DS.JSONAPISerializer.extend({
+ internalNormalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+
+ if (payload.appAttempt) {
+ payload = payload.appAttempt;
+ }
+
+ var fixedPayload = {
+ id: payload.appAttemptId,
+ type: primaryModelClass.modelName, // yarn-app
+ attributes: {
+ startTime: Converter.timeStampToDate(payload.startTime),
+ finishedTime: Converter.timeStampToDate(payload.finishedTime),
+ containerId: payload.containerId,
+ nodeHttpAddress: payload.nodeHttpAddress,
+ nodeId: payload.nodeId,
+ state: payload.nodeId,
+ logsLink: payload.logsLink
+ }
+ };
+
+ return fixedPayload;
+ },
+
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ var p = this.internalNormalizeSingleResponse(store,
+ primaryModelClass, payload, id, requestType);
+ return { data: p };
+ },
+
+ normalizeArrayResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // return expected is { data: [ {}, {} ] }
+ var normalizedArrayResponse = {};
+
+ // payload has apps : { app: [ {},{},{} ] }
+ // need some error handling for ex apps or app may not be defined.
+ normalizedArrayResponse.data = payload.appAttempts.appAttempt.map(singleApp => {
+ return this.internalNormalizeSingleResponse(store, primaryModelClass,
+ singleApp, singleApp.id, requestType);
+ }, this);
+ return normalizedArrayResponse;
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app.js
new file mode 100644
index 0000000..a038fff
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app.js
@@ -0,0 +1,66 @@
+import DS from 'ember-data';
+import Converter from 'yarn-ui/utils/converter';
+
+export default DS.JSONAPISerializer.extend({
+ internalNormalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ if (payload.app) {
+ payload = payload.app;
+ }
+
+ var fixedPayload = {
+ id: id,
+ type: primaryModelClass.modelName, // yarn-app
+ attributes: {
+ appName: payload.name,
+ user: payload.user,
+ queue: payload.queue,
+ state: payload.state,
+ startTime: Converter.timeStampToDate(payload.startedTime),
+ elapsedTime: Converter.msToElapsedTime(payload.elapsedTime),
+ finishedTime: Converter.timeStampToDate(payload.finishedTime),
+ finalStatus: payload.finalStatus,
+ progress: payload.progress,
+ diagnostics: payload.diagnostics,
+ amContainerLogs: payload.amContainerLogs,
+ amHostHttpAddress: payload.amHostHttpAddress,
+ logAggregationStatus: payload.logAggregationStatus,
+ unmanagedApplication: payload.unmanagedApplication,
+ amNodeLabelExpression: payload.amNodeLabelExpression,
+ priority: payload.priority,
+ allocatedMB: payload.allocatedMB,
+ allocatedVCores: payload.allocatedVCores,
+ runningContainers: payload.runningContainers,
+ memorySeconds: payload.memorySeconds,
+ vcoreSeconds: payload.vcoreSeconds,
+ preemptedResourceMB: payload.preemptedResourceMB,
+ preemptedResourceVCores: payload.preemptedResourceVCores,
+ numNonAMContainerPreempted: payload.numNonAMContainerPreempted,
+ numAMContainerPreempted: payload.numAMContainerPreempted
+ }
+ };
+
+ return fixedPayload;
+ },
+
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ var p = this.internalNormalizeSingleResponse(store,
+ primaryModelClass, payload, id, requestType);
+ return { data: p };
+ },
+
+ normalizeArrayResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // return expected is { data: [ {}, {} ] }
+ var normalizedArrayResponse = {};
+
+ // payload has apps : { app: [ {},{},{} ] }
+ // need some error handling for ex apps or app may not be defined.
+ normalizedArrayResponse.data = payload.apps.app.map(singleApp => {
+ return this.internalNormalizeSingleResponse(store, primaryModelClass,
+ singleApp, singleApp.id, requestType);
+ }, this);
+ return normalizedArrayResponse;
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-container.js
new file mode 100644
index 0000000..665b9df
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-container.js
@@ -0,0 +1,54 @@
+import DS from 'ember-data';
+import Converter from 'yarn-ui/utils/converter';
+
+export default DS.JSONAPISerializer.extend({
+ internalNormalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+
+ var fixedPayload = {
+ id: payload.containerId,
+ type: primaryModelClass.modelName, // yarn-app
+ attributes: {
+ allocatedMB: payload.allocatedMB,
+ allocatedVCores: payload.allocatedVCores,
+ assignedNodeId: payload.assignedNodeId,
+ priority: payload.priority,
+ startedTime: Converter.timeStampToDate(payload.startedTime),
+ finishedTime: Converter.timeStampToDate(payload.finishedTime),
+ elapsedTime: payload.elapsedTime,
+ logUrl: payload.logUrl,
+ containerExitStatus: payload.containerExitStatus,
+ containerState: payload.containerState,
+ nodeHttpAddress: payload.nodeHttpAddress
+ }
+ };
+
+ return fixedPayload;
+ },
+
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ var p = this.internalNormalizeSingleResponse(store,
+ primaryModelClass, payload, id, requestType);
+ return { data: p };
+ },
+
+ normalizeArrayResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // return expected is { data: [ {}, {} ] }
+ var normalizedArrayResponse = {};
+
+ if (payload && payload.container) {
+ // payload has apps : { app: [ {},{},{} ] }
+ // need some error handling for ex apps or app may not be defined.
+ normalizedArrayResponse.data = payload.container.map(singleContainer => {
+ return this.internalNormalizeSingleResponse(store, primaryModelClass,
+ singleContainer, singleContainer.id, requestType);
+ }, this);
+ return normalizedArrayResponse;
+ }
+
+ normalizedArrayResponse.data = [];
+ return normalizedArrayResponse;
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-queue.js
new file mode 100644
index 0000000..ce4d775
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-queue.js
@@ -0,0 +1,127 @@
+import DS from 'ember-data';
+
+export default DS.JSONAPISerializer.extend({
+
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ var children = [];
+ if (payload.queues) {
+ payload.queues.queue.forEach(function(queue) {
+ children.push(queue.queueName);
+ });
+ }
+
+ var includedData = [];
+ var relationshipUserData = [];
+
+ // update user models
+ if (payload.users && payload.users.user) {
+ payload.users.user.forEach(function(u) {
+ includedData.push({
+ type: "YarnUser",
+ id: u.username + "_" + payload.queueName,
+ attributes: {
+ name: u.username,
+ queueName: payload.queueName,
+ usedMemoryMB: u.resourcesUsed.memory || 0,
+ usedVCore: u.resourcesUsed.vCores || 0,
+ }
+ });
+
+ relationshipUserData.push({
+ type: "YarnUser",
+ id: u.username + "_" + payload.queueName,
+ })
+ });
+ }
+
+
+ var fixedPayload = {
+ id: id,
+ type: primaryModelClass.modelName, // yarn-queue
+ attributes: {
+ name: payload.queueName,
+ parent: payload.myParent,
+ children: children,
+ capacity: payload.capacity,
+ usedCapacity: payload.usedCapacity,
+ maxCapacity: payload.maxCapacity,
+ absCapacity: payload.absoluteCapacity,
+ absMaxCapacity: payload.absoluteMaxCapacity,
+ absUsedCapacity: payload.absoluteUsedCapacity,
+ state: payload.state,
+ userLimit: payload.userLimit,
+ userLimitFactor: payload.userLimitFactor,
+ preemptionDisabled: payload.preemptionDisabled,
+ numPendingApplications: payload.numPendingApplications,
+ numActiveApplications: payload.numActiveApplications,
+ },
+ // Relationships
+ relationships: {
+ users: {
+ data: relationshipUserData
+ }
+ }
+ };
+
+ return {
+ queue: this._super(store, primaryModelClass, fixedPayload, id, requestType),
+ includedData: includedData
+ }
+ },
+
+ handleQueue(store, primaryModelClass, payload, id, requestType) {
+ var data = [];
+ var includedData = []
+ var result = this.normalizeSingleResponse(store, primaryModelClass,
+ payload, id, requestType);
+
+ data.push(result.queue);
+ includedData = includedData.concat(result.includedData);
+
+ if (payload.queues) {
+ for (var i = 0; i < payload.queues.queue.length; i++) {
+ var queue = payload.queues.queue[i];
+ queue.myParent = payload.queueName;
+ var childResult = this.handleQueue(store, primaryModelClass, queue,
+ queue.queueName,
+ requestType);
+
+ data = data.concat(childResult.data);
+ includedData = includedData.concat(childResult.includedData);
+ }
+ }
+
+ return {
+ data: data,
+ includedData, includedData
+ }
+ },
+
+ normalizeArrayResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ var normalizedArrayResponse = {};
+ var result = this.handleQueue(store,
+ primaryModelClass,
+ payload.scheduler.schedulerInfo, "root", requestType);
+
+ normalizedArrayResponse.data = result.data;
+ normalizedArrayResponse.included = result.includedData;
+
+ console.log(normalizedArrayResponse);
+
+ return normalizedArrayResponse;
+
+ /*
+ // return expected is { data: [ {}, {} ] }
+ var normalizedArrayResponse = {};
+
+ // payload has apps : { app: [ {},{},{} ] }
+ // need some error handling for ex apps or app may not be defined.
+ normalizedArrayResponse.data = payload.apps.app.map(singleApp => {
+ return this.normalizeSingleResponse(store, primaryModelClass, singleApp, singleApp.id, requestType);
+ }, this);
+ return normalizedArrayResponse;
+ */
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/styles/app.css
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/styles/app.css b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/styles/app.css
new file mode 100644
index 0000000..e1ff994
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/styles/app.css
@@ -0,0 +1,141 @@
+/*
+ Over all style
+ */
+text {
+ font: 12px sans-serif;
+}
+
+text.small {
+ font: 8px sans-serif;
+}
+
+html, body
+{
+ margin: 0px;
+ padding: 0px;
+ height: 100%;
+ width: 100%;
+}
+
+/*
+ queue's style (left banner of queues)
+ */
+
+text.queue {
+ font-family : sans-serif;
+ font-size : 15px;
+ fill : gray;
+}
+
+path.queue {
+ stroke: gray;
+ fill: none;
+}
+
+circle.queue {
+ r: 10;
+ fill: Steelblue;
+}
+
+/*
+ background style
+ */
+line.grid {
+ stroke: WhiteSmoke;
+}
+
+line.chart {
+ stroke: Gray;
+}
+
+/*
+ charts styles
+ */
+text.chart-title {
+ font-size: 30px;
+ font-family: sans-serif;
+ text-anchor: middle;
+ fill: Gray;
+}
+
+text.donut-highlight-text {
+ font-size: 20px;
+ font-family: sans-serif;
+ text-anchor: middle;
+ fill: Gray;
+ vertical-align: middle;
+}
+
+rect.chart-frame {
+ fill: none;
+ stroke: gray;
+ stroke-dasharray: 10,10;
+}
+
+line.chart-leftbanner {
+ stroke-width: 2;
+ stroke: gray;
+ stroke-dasharray: 10,10;
+}
+
+text.bar-chart-text {
+ font-size: 8px;
+ font-family: sans-serif;
+ vertical-align: middle;
+ fill: Gray;;
+}
+
+div.tooltip {
+ position: absolute;
+ text-align: center;
+ /*height: 28px;*/
+ padding: 2px;
+ font: 12px sans-serif;
+ background: lightsteelblue;
+ border: 0px;
+ border-radius: 8px;
+ pointer-events: none;
+}
+
+/*
+ * Data table
+ */
+
+table.dataTable thead .sorting {
+ background-image: url("/assets/images/datatables/sort_both.png");
+}
+table.dataTable thead .sorting_asc {
+ background-image: url("/assets/images/datatables/sort_asc.png");
+}
+table.dataTable thead .sorting_desc {
+ background-image: url("/assets/images/datatables/sort_desc.png");
+}
+table.dataTable thead .sorting_asc_disabled {
+ background-image: url("/assets/images/datatables/sort_asc_disabled.png");
+}
+table.dataTable thead .sorting_desc_disabled {
+ background-image: url("/assets/images/datatables/sort_desc_disabled.png");
+}
+
+/*
+ * Queue selector
+ */
+.node {
+ cursor: pointer;
+}
+
+.node circle {
+ fill: #fff;
+ stroke: steelblue;
+ stroke-width: 3px;
+}
+
+.node text {
+ font: 12px sans-serif;
+}
+
+.link {
+ fill: none;
+ stroke: #ccc;
+ stroke-width: 2px;
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/application.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/application.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/application.hbs
new file mode 100644
index 0000000..252ca74
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/application.hbs
@@ -0,0 +1,25 @@
+<nav class="navbar navbar-default">
+ <div class="container-fluid">
+ <!-- Brand and toggle get grouped for better mobile display -->
+ <div class="navbar-header">
+ <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
+ <span class="sr-only">Toggle navigation</span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+ <a class="navbar-brand" href="#">Apache Hadoop YARN</a>
+ </div>
+
+ <!-- Collect the nav links, forms, and other content for toggling -->
+ <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
+ <ul class="nav navbar-nav">
+ <li class="active"><a href="yarnQueue/root">Queues<span class="sr-only">(current)</span></a></li>
+ <li class="active"><a href="yarnApps">Applications<span class="sr-only">(current)</span></a></li>
+ <li class="active"><a href="clusterOverview">Cluster Overview<span class="sr-only">(current)</span></a></li>
+ </ul>
+ </div><!-- /.navbar-collapse -->
+ </div><!-- /.container-fluid -->
+</nav>
+
+{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/cluster-overview.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/cluster-overview.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/cluster-overview.hbs
new file mode 100644
index 0000000..81c11e9
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/cluster-overview.hbs
@@ -0,0 +1,56 @@
+<div class="row">
+ <div class="col-lg-3 container-fluid" id="finishedapps-donut-chart">
+ {{donut-chart data=model.firstObject.getFinishedAppsDataForDonutChart
+ title="Finished Apps"
+ showLabels=true
+ parentId="finishedapps-donut-chart"
+ ratio=0.55
+ maxHeight=350}}
+ </div>
+
+ <div class="col-lg-3 container-fluid" id="runningapps-donut-chart">
+ {{donut-chart data=model.firstObject.getRunningAppsDataForDonutChart
+ title="Running Apps"
+ showLabels=true
+ parentId="runningapps-donut-chart"
+ ratio=0.55
+ maxHeight=350}}
+ </div>
+</div>
+
+<hr>
+
+<div class="row">
+ <div class="col-lg-3 container-fluid" id="nodes-donut-chart">
+ {{donut-chart data=model.firstObject.getNodesDataForDonutChart
+ title="Node Managers"
+ showLabels=true
+ parentId="nodes-donut-chart"
+ ratio=0.55
+ maxHeight=350}}
+ </div>
+</div>
+
+<hr>
+
+<div class="row">
+ <div class="col-lg-3 container-fluid" id="mem-donut-chart">
+ {{donut-chart data=model.firstObject.getMemoryDataForDonutChart
+ title="Resource - Memory"
+ showLabels=true
+ parentId="mem-donut-chart"
+ ratio=0.55
+ maxHeight=350}}
+ </div>
+
+ <div class="col-lg-3 container-fluid" id="vcore-donut-chart">
+ {{donut-chart data=model.firstObject.getVCoreDataForDonutChart
+ title="Resource - VCores"
+ showLabels=true
+ parentId="vcore-donut-chart"
+ ratio=0.6
+ maxHeight=350}}
+ </div>
+</div>
+
+{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/.gitkeep
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/.gitkeep b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/.gitkeep
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/app-attempt-table.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/app-attempt-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/app-attempt-table.hbs
new file mode 100644
index 0000000..633d363
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/app-attempt-table.hbs
@@ -0,0 +1,28 @@
+<table id="app-attempt-table" class="table table-striped table-bordered" cellspacing="0" width="100%" height="100%">
+ <tbody>
+ <tr>
+ <td>Application Attempt Id</td>
+ <td>{{attempt.id}}</td>
+ </tr>
+ <tr>
+ <td>Start Time</td>
+ <td>{{attempt.startTime}}</td>
+ </tr>
+ <tr>
+ <td>AM Container Id</td>
+ <td>{{attempt.containerId}}</td>
+ </tr>
+ <tr>
+ <td>AM Node Web UI</td>
+ <td><a href={{attempt.nodeHttpAddress}}>{{attempt.nodeHttpAddress}}</a></td>
+ </tr>
+ <tr>
+ <td>AM Node Id</td>
+ <td>{{attempt.nodeId}}</td>
+ </tr>
+ <tr>
+ <td>Log</td>
+ <td><a href={{attempt.logsLink}}>link</a></td>
+ </tr>
+ </tbody>
+</table>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/app-table.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/app-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/app-table.hbs
new file mode 100644
index 0000000..92e9d05
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/app-table.hbs
@@ -0,0 +1,62 @@
+<table id={{table-id}} class="display table table-striped table-bordered" cellspacing="0" width="100%">
+ <thead>
+ <tr>
+ <th>Application ID</th>
+ <th>Name</th>
+ <th>User</th>
+ <th>Queue</th>
+ <th>State</th>
+ <th>Final Status</th>
+ <th>Start Time</th>
+ <th>Elapsed Time</th> <!-- idx = 7 -->
+ <th>Finished Time</th>
+ <th>Priority</th>
+ <th>Progress</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#if arr}}
+ {{#each arr as |app|}}
+ <tr>
+ <td><a href="yarnApp/{{app.id}}">{{app.id}}</a></td>
+ <td>{{app.appName}}</td>
+ <td>{{app.user}}</td>
+ <td>{{app.queue}}</td>
+ <td>{{app.state}}</td>
+ <td><span class={{app.finalStatusStyle}}>{{app.finalStatus}}</span></td>
+ <td>{{app.startTime}}</td>
+ <td>{{app.elapsedTime}}</td>
+ <td>{{app.finishedTime}}</td>
+ <td>{{app.priority}}</td>
+ <td>
+ <div class="progress" style="margin-bottom: 0;">
+ <div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style={{app.progressStyle}}>
+ {{app.progress}}%
+ </div>
+ </div>
+ </td>
+ </tr>
+ {{/each}}
+ {{else}}
+ <tr>
+ <td><a href="yarnApp/{{app.id}}">{{app.id}}</a></td>
+ <td>{{app.appName}}</td>
+ <td>{{app.user}}</td>
+ <td>{{app.queue}}</td>
+ <td>{{app.state}}</td>
+ <td><span class={{app.finalStatusStyle}}>{{app.finalStatus}}</span></td>
+ <td>{{app.startTime}}</td>
+ <td>{{app.elapsedTime}}</td>
+ <td>{{app.finishedTime}}</td>
+ <td>{{app.priority}}</td>
+ <td>
+ <div class="progress" style="margin-bottom: 0;">
+ <div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style={{app.progressStyle}}>
+ {{app.progress}}%
+ </div>
+ </div>
+ </td>
+ </tr>
+ {{/if}}
+ </tbody>
+</table>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/container-table.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/container-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/container-table.hbs
new file mode 100644
index 0000000..70d3fc4
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/container-table.hbs
@@ -0,0 +1,36 @@
+<table id="container-table" class="table table-striped table-bordered" cellspacing="0" width="100%" height="100%">
+ <tbody>
+ <tr>
+ <td>Start Time</td>
+ <td>{{container.startedTime}}</td>
+ </tr>
+ <tr>
+ <td>Finished Time</td>
+ <td>{{container.finishedTime}}</td>
+ </tr>
+ <tr>
+ <td>Elapsed Time</td>
+ <td>{{container.elapsedTime}}</td>
+ </tr>
+ <tr>
+ <td>Priority</td>
+ <td>{{container.priority}}</td>
+ </tr>
+ <tr>
+ <td>Log</td>
+ <td><a href={{container.logUrl}}>link</a></td>
+ </tr>
+ <tr>
+ <td>Exit Status</td>
+ <td>{{container.containerExitStatus}}</td>
+ </tr>
+ <tr>
+ <td>State</td>
+ <td>{{container.containerState}}</td>
+ </tr>
+ <tr>
+ <td>NodeManager UI</td>
+ <td>{{container.nodeHttpAddress}}</td>
+ </tr>
+ </tbody>
+</table>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/queue-configuration-table.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/queue-configuration-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/queue-configuration-table.hbs
new file mode 100644
index 0000000..fb9f1a0
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/queue-configuration-table.hbs
@@ -0,0 +1,40 @@
+<table id="queue-configuration-table" class="table table-striped table-bordered" cellspacing="0" width="100%" height="100%">
+ <thead>
+ <tr>
+ <td><b>Configurations</b></td>
+ <td>Value</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Queue Name</td>
+ <td>{{queue.id}}</td>
+ </tr>
+ <tr>
+ <td>Configured Capacity</td>
+ <td>{{queue.capacity}}</td>
+ </tr>
+ <tr>
+ <td>Configured Max Capacity</td>
+ <td>{{queue.maxCapacity}}</td>
+ </tr>
+ <tr>
+ <td>State</td>
+ <td>{{queue.state}}</td>
+ </tr>
+ {{#if queue.isLeafQueue}}
+ <tr>
+ <td>User Limit Percent</td>
+ <td>{{queue.userLimit}}</td>
+ </tr>
+ <tr>
+ <td>User Limit Factor</td>
+ <td>{{queue.userLimitFactor}}</td>
+ </tr>
+ <tr>
+ <td>Preemption Disabled</td>
+ <td>{{queue.preemptionDisabled}}</td>
+ </tr>
+ {{/if}}
+ </tbody>
+</table>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/queue-navigator.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/queue-navigator.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/queue-navigator.hbs
new file mode 100644
index 0000000..4ef22902
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/queue-navigator.hbs
@@ -0,0 +1,18 @@
+<div class="row">
+ <div class="col-lg-4">
+ <select class="js-example-basic-single" width="100%" id="queue-name-selector">
+ {{item-selector element-id="queue-name-selector" prefix="Queue : " model=model}}
+ </select>
+ </div>
+</div><!-- /.row -->
+
+<!-- queue selector -->
+<div class="row">
+ <div class="col-md-12 container-fluid" id="tree-selector-container">
+ {{tree-selector model=model parentId="tree-selector-container" selected=selected}}
+ </div>
+</div>
+
+<hr>
+
+{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/timeline-view.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/timeline-view.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/timeline-view.hbs
new file mode 100644
index 0000000..657f6e8
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/components/timeline-view.hbs
@@ -0,0 +1,35 @@
+<div class="col-md-12 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ {{#if attemptModel}}
+ Application Attempts
+ {{else}}
+ Containers
+ {{/if}}
+ </div>
+ <div class="panel-body">
+ <div class="col-md-8 container-fluid" id={{parent-id}}>
+ </div>
+
+ <!-- diag info -->
+ <div class="col-md-4 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ {{#if selected.link}}
+ <a href={{selected.link}}>{{selected.id}}</a>
+ {{else}}
+ {{selected.id}}
+ {{/if}}
+ </div>
+ {{#if attemptModel}}
+ {{app-attempt-table attempt=selected}}
+ {{else}}
+ {{container-table container=selected}}
+ {{/if}}
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+
+{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-app-attempt.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-app-attempt.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-app-attempt.hbs
new file mode 100644
index 0000000..afcfa4f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-app-attempt.hbs
@@ -0,0 +1,12 @@
+<div class="container-fluid">
+ <div class="row">
+ {{app-attempt-table attempt=model.attempt}}
+ </div>
+
+ <!-- containers table -->
+ <div class="row">
+ {{timeline-view parent-id="containers-timeline-div" my-id="timeline-view" height="400" rmModel=model.rmContainers tsModel=model.tsContainers label="shortAppAttemptId" attemptModel=false}}
+ </div>
+</div>
+
+{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-app.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-app.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-app.hbs
new file mode 100644
index 0000000..0ba6749
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-app.hbs
@@ -0,0 +1,145 @@
+<div class="container-fluid">
+ <!-- app table -->
+ <div class="row">
+ <div class="col-md-12 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Application Basic Information
+ </div>
+ {{app-table table-id="app-table" app=model.app}}
+ </div>
+ </div>
+ </div>
+
+ <!-- diag info and other infos -->
+ <div class="row">
+ <!-- diag info -->
+ <div class="col-md-4 container-fluid">
+ {{#if model.app.isFailed}}
+ <div class="panel panel-danger">
+ <div class="panel-heading">
+ Diagnostics
+ </div>
+ <div class="panel-body">{{model.app.diagnostics}}</div>
+ </div>
+ {{else}}
+ <div class="panel panel-default">
+ <div class="panel-body">
+ Diagnostics
+ </div>
+ <div class="panel-footer">{{model.app.diagnostics}}</div>
+ </div>
+ {{/if}}
+ </div>
+
+ <div class="col-md-5 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">Scheduling Info</div>
+ <table class="table">
+ <tbody>
+ <tr>
+ <td>Allocated Resource</td>
+ <td>{{model.app.allocatedResource}}</td>
+ </tr>
+ <tr>
+ <td>Running Containers</td>
+ <td>{{model.app.runningContainers}}</td>
+ </tr>
+ <tr>
+ <td>Preempted Resource</td>
+ <td>{{model.app.preemptedResource}}</td>
+ </tr>
+ <tr>
+ <td>Num Non-AM container preempted</td>
+ <td>{{model.app.numAMContainerPreempted}}</td>
+ </tr>
+ <tr>
+ <td>Num AM container preempted</td>
+ <td>{{model.app.numAMContainerPreempted}}</td>
+ </tr>
+ <tr>
+ <td>Aggregated Resource Usage</td>
+ <td>{{model.app.aggregatedResourceUsage}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+
+ <!-- other info -->
+ <div class="col-md-3 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">Other Info</div>
+ <table class="table">
+ <tbody>
+ <tr>
+ <td>AM Container Log</td>
+ <td><a href={{model.app.amContainerLogs}}>Link</a></td>
+ </tr>
+ <tr>
+ <td>AM Host Http Addr</td>
+ <td><a href={{model.app.amHostHttpAddress}}>Link</a></td>
+ </tr>
+ <tr>
+ <td>Log Aggregation Status</td>
+ <td>{{model.app.logAggregationStatus}}</td>
+ </tr>
+ <tr>
+ <td>Is Unmanaged AM</td>
+ <td>{{model.app.unmanagedApplication}}</td>
+ </tr>
+ <tr>
+ <td>AM Node Label Expression</td>
+ <td>{{model.app.amNodeLabelExpression}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+
+<!--
+ <div class="row">
+ <div class="col-md-12 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Application Attempts
+ </div>
+ <table id="app-attempt-table" class="table table-striped table-bordered" cellspacing="0" width="100%" height="100%">
+ <thead>
+ <tr>
+ <th>Start Time</th>
+ <th>Master ContainerId</th>
+ <th>Node Http Address</th>
+ <th>Node Id</th>
+ <th>Logs Link</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#each model.attempts as |attempt|}}
+ <tr>
+ <td>{{attempt.startTime}}</td>
+ <td>{{attempt.containerId}}</td>
+ <td><a href={{attempt.nodeHttpAddress}}>{{attempt.nodeHttpAddress}}</a></td>
+ <td>{{attempt.nodeId}}</td>
+ <td><a href={{attempt.logsLink}}>link</a></td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+-->
+ <!-- timeline view of children -->
+ <div class="row">
+ {{timeline-view parent-id="attempt-timeline-div" my-id="timeline-view" height="100%" rmModel=model.attempts label="shortAppAttemptId" attemptModel=true}}
+ </div>
+</div>
+
+<!--
+{{simple-table table-id="app-attempt-table" paging=false bFilter=false}}
+-->
+
+
+{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-apps.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-apps.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-apps.hbs
new file mode 100644
index 0000000..e58d6bd
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-apps.hbs
@@ -0,0 +1,3 @@
+{{app-table table-id="apps-table" arr=model}}
+{{simple-table table-id="apps-table" bFilter=true colTypes="elapsed-time" colTargets="7"}}
+{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-queue.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-queue.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-queue.hbs
new file mode 100644
index 0000000..11bb6f4
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/yarn-queue.hbs
@@ -0,0 +1,48 @@
+<div class="container-fluid">
+ {{queue-navigator model=model.queues selected=model.selected}}
+</div>
+
+<div class="row">
+ <div class="col-lg-3 container-fluid">
+ {{queue-configuration-table queue=model.selectedQueue}}
+ </div>
+
+ <div class="col-lg-3 container-fluid" id="capacity-bar-chart">
+ {{bar-chart data=model.selectedQueue.capacitiesBarChartData
+ title="Queue Capacities"
+ parentId="capacity-bar-chart"
+ textWidth=150
+ ratio=0.5
+ maxHeight=350}}
+ </div>
+
+{{#if model.selectedQueue.hasUserUsages}}
+ <div class="col-lg-3 container-fluid" id="userusage-donut-chart">
+ {{donut-chart data=model.selectedQueue.userUsagesDonutChartData
+ title="User Usages"
+ showLabels=true
+ parentId="userusage-donut-chart"
+ maxHeight=350}}
+ </div>
+{{/if}}
+
+ <div class="col-lg-3 container-fluid" id="numapplications-donut-chart">
+ {{donut-chart data=model.selectedQueue.numOfApplicationsDonutChartData
+ title="Running Apps"
+ showLabels=true
+ parentId="numapplications-donut-chart"
+ ratio=0.5
+ maxHeight=350}}
+ </div>
+</div>
+
+<hr>
+
+<div class="row">
+ <div class="col-md-12 container-fluid">
+ {{app-table table-id="apps-table" arr=model.apps}}
+ {{simple-table table-id="apps-table" bFilter=true colTypes="elapsed-time" colTargets="7"}}
+ </div>
+</div>
+
+{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/converter.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/converter.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/converter.js
new file mode 100644
index 0000000..41e6c9c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/converter.js
@@ -0,0 +1,74 @@
+export default {
+ containerIdToAttemptId: function(containerId) {
+ if (containerId) {
+ var arr = containerId.split('_');
+ var attemptId = ["appattempt", arr[1],
+ arr[2], this.padding(arr[3], 6)];
+ return attemptId.join('_');
+ }
+ },
+ attemptIdToAppId: function(attemptId) {
+ if (attemptId) {
+ var arr = attemptId.split('_');
+ var appId = ["application", arr[1],
+ arr[2]].join('_');
+ return appId;
+ }
+ },
+ padding: function(str, toLen=2) {
+ str = str.toString();
+ if (str.length >= toLen) {
+ return str;
+ }
+ return '0'.repeat(toLen - str.length) + str;
+ },
+ resourceToString: function(mem, cpu) {
+ mem = Math.max(0, mem);
+ cpu = Math.max(0, cpu);
+ return mem + " MBs, " + cpu + " VCores";
+ },
+ msToElapsedTime: function(timeInMs) {
+ var sec_num = timeInMs / 1000; // don't forget the second param
+ var hours = Math.floor(sec_num / 3600);
+ var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
+ var seconds = sec_num - (hours * 3600) - (minutes * 60);
+
+ var timeStrArr = [];
+
+ if (hours > 0) {
+ timeStrArr.push(hours + ' Hrs');
+ }
+ if (minutes > 0) {
+ timeStrArr.push(minutes + ' Mins');
+ }
+ if (seconds > 0) {
+ timeStrArr.push(Math.round(seconds) + " Secs");
+ }
+ return timeStrArr.join(' : ');
+ },
+ elapsedTimeToMs: function(elapsedTime) {
+ elapsedTime = elapsedTime.toLowerCase();
+ var arr = elapsedTime.split(' : ');
+ var total = 0;
+ for (var i = 0; i < arr.length; i++) {
+ if (arr[i].indexOf('hr') > 0) {
+ total += parseInt(arr[i].substring(0, arr[i].indexOf(' '))) * 3600;
+ } else if (arr[i].indexOf('min') > 0) {
+ total += parseInt(arr[i].substring(0, arr[i].indexOf(' '))) * 60;
+ } else if (arr[i].indexOf('sec') > 0) {
+ total += parseInt(arr[i].substring(0, arr[i].indexOf(' ')));
+ }
+ }
+ return total * 1000;
+ },
+ timeStampToDate: function(timeStamp) {
+ var dateTimeString = moment(parseInt(timeStamp)).format("YYYY/MM/DD HH:mm:ss");
+ return dateTimeString;
+ },
+ dateToTimeStamp: function(date) {
+ if (date) {
+ var ts = moment(date, "YYYY/MM/DD HH:mm:ss").valueOf();
+ return ts;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/sorter.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/sorter.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/sorter.js
new file mode 100644
index 0000000..981429b
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/utils/sorter.js
@@ -0,0 +1,15 @@
+import Converter from 'yarn-ui/utils/converter';
+
+export default {
+ _initElapsedTimeSorter: function() {
+ jQuery.extend(jQuery.fn.dataTableExt.oSort, {
+ "elapsed-time-pre": function (a) {
+ return Converter.padding(Converter.elapsedTimeToMs(a), 20);
+ },
+ });
+ },
+
+ initDataTableSorter: function() {
+ this._initElapsedTimeSorter();
+ },
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/bower.json
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/bower.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/bower.json
new file mode 100644
index 0000000..ec587bb
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/bower.json
@@ -0,0 +1,22 @@
+{
+ "name": "yarn-ui",
+ "dependencies": {
+ "ember": "2.0.1",
+ "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.4",
+ "ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
+ "ember-data": "2.0.0",
+ "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.6",
+ "ember-qunit": "0.4.9",
+ "ember-qunit-notifications": "0.0.7",
+ "ember-resolver": "~0.1.18",
+ "jquery": "^1.11.3",
+ "loader.js": "ember-cli/loader.js#3.2.1",
+ "qunit": "~1.18.0",
+ "bootstrap": "~3.3.2",
+ "d3": "~3.5.6",
+ "datatables": "~1.10.8",
+ "spin.js": "~2.3.2",
+ "momentjs": "~2.10.6",
+ "select2": "4.0.0"
+ }
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/config/environment.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/config/environment.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/config/environment.js
new file mode 100644
index 0000000..b898e0d
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/config/environment.js
@@ -0,0 +1,47 @@
+/* jshint node: true */
+
+module.exports = function(environment) {
+ var ENV = {
+ modulePrefix: 'yarn-ui',
+ environment: environment,
+ baseURL: '/',
+ locationType: 'auto',
+ EmberENV: {
+ FEATURES: {
+ // Here you can enable experimental features on an ember canary build
+ // e.g. 'with-controller': true
+ }
+ },
+
+ APP: {
+ // Here you can pass flags/options to your application instance
+ // when it is created
+ }
+ };
+
+ if (environment === 'development') {
+ // ENV.APP.LOG_RESOLVER = true;
+ // ENV.APP.LOG_ACTIVE_GENERATION = true;
+ // ENV.APP.LOG_TRANSITIONS = true;
+ // ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
+ // ENV.APP.LOG_VIEW_LOOKUPS = true;
+ }
+
+ if (environment === 'test') {
+ // Testem prefers this...
+ ENV.baseURL = '/';
+ ENV.locationType = 'none';
+
+ // keep test console output quieter
+ ENV.APP.LOG_ACTIVE_GENERATION = false;
+ ENV.APP.LOG_VIEW_LOOKUPS = false;
+
+ ENV.APP.rootElement = '#ember-testing';
+ }
+
+ if (environment === 'production') {
+
+ }
+
+ return ENV;
+};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/ember-cli-build.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/ember-cli-build.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/ember-cli-build.js
new file mode 100644
index 0000000..2fa2032
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/ember-cli-build.js
@@ -0,0 +1,29 @@
+/* global require, module */
+var EmberApp = require('ember-cli/lib/broccoli/ember-app');
+
+module.exports = function(defaults) {
+ var app = new EmberApp(defaults, {
+ // Add options here
+ });
+
+ app.import("bower_components/datatables/media/css/jquery.dataTables.min.css");
+ app.import("bower_components/datatables/media/js/jquery.dataTables.min.js");
+ app.import("bower_components/momentjs/min/moment.min.js");
+ app.import("bower_components/select2/dist/css/select2.min.css");
+ app.import("bower_components/select2/dist/js/select2.min.js");
+
+ // Use `app.import` to add additional libraries to the generated
+ // output files.
+ //
+ // If you need to use different assets in different
+ // environments, specify an object as the first parameter. That
+ // object's keys should be the environment name and the values
+ // should be the asset to use in that environment.
+ //
+ // If the library that you are including contains AMD or ES6
+ // modules that you would like to import into your application
+ // please specify an object with the list of modules as keys
+ // along with the exports of each module as its value.
+
+ return app.toTree();
+};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/jsconfig.json
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/jsconfig.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/jsconfig.json
new file mode 100644
index 0000000..875bb90
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/jsconfig.json
@@ -0,0 +1,6 @@
+{
+ "compilerOptions": {
+ "target": "ES6",
+ "module": "commonjs"
+ }
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/package.json
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/package.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/package.json
new file mode 100644
index 0000000..5500dcf
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/package.json
@@ -0,0 +1,44 @@
+{
+ "name": "yarn-ui",
+ "version": "0.0.0",
+ "description": "Small description for yarn-ui goes here",
+ "private": true,
+ "directories": {
+ "doc": "doc",
+ "test": "tests"
+ },
+ "scripts": {
+ "build": "ember build",
+ "start": "ember server",
+ "test": "ember test"
+ },
+ "repository": "",
+ "engines": {
+ "node": ">= 0.10.0"
+ },
+ "author": "",
+ "license": "MIT",
+ "devDependencies": {
+ "broccoli-asset-rev": "^2.1.2",
+ "ember-bootstrap": "0.2.0",
+ "ember-cli": "1.13.8",
+ "ember-cli-app-version": "0.5.0",
+ "ember-cli-babel": "^5.1.3",
+ "ember-cli-content-security-policy": "0.4.0",
+ "ember-cli-dependency-checker": "^1.0.1",
+ "ember-cli-htmlbars": "0.7.9",
+ "ember-cli-htmlbars-inline-precompile": "^0.2.0",
+ "ember-cli-ic-ajax": "0.2.1",
+ "ember-cli-inject-live-reload": "^1.3.1",
+ "ember-cli-qunit": "^1.0.0",
+ "ember-cli-release": "0.2.3",
+ "ember-cli-sri": "^1.0.3",
+ "ember-cli-uglify": "^1.2.0",
+ "ember-d3": "0.1.0",
+ "ember-data": "1.13.8",
+ "ember-disable-proxy-controllers": "^1.0.0",
+ "ember-export-application-global": "^1.0.3",
+ "ember-spin-spinner": "0.2.3",
+ "select2": "4.0.0"
+ }
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/Sorting icons.psd
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/Sorting icons.psd b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/Sorting icons.psd
new file mode 100644
index 0000000..53b2e06
Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/Sorting icons.psd differ
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/favicon.ico
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/favicon.ico b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/favicon.ico
new file mode 100644
index 0000000..6eeaa2a
Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/favicon.ico differ
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/sort_asc.png
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/sort_asc.png b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/sort_asc.png
new file mode 100644
index 0000000..e1ba61a
Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/sort_asc.png differ
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/sort_asc_disabled.png
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/sort_asc_disabled.png b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/sort_asc_disabled.png
new file mode 100644
index 0000000..fb11dfe
Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/sort_asc_disabled.png differ
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/sort_both.png
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/sort_both.png b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/sort_both.png
new file mode 100644
index 0000000..af5bc7c
Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/sort_both.png differ
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/sort_desc.png
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/sort_desc.png b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/sort_desc.png
new file mode 100644
index 0000000..0e156de
Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/sort_desc.png differ
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/sort_desc_disabled.png
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/sort_desc_disabled.png b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/sort_desc_disabled.png
new file mode 100644
index 0000000..c9fdd8a
Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/assets/images/datatables/sort_desc_disabled.png differ
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/crossdomain.xml
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/crossdomain.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/crossdomain.xml
new file mode 100644
index 0000000..0c16a7a
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/crossdomain.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
+<cross-domain-policy>
+ <!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->
+
+ <!-- Most restrictive policy: -->
+ <site-control permitted-cross-domain-policies="none"/>
+
+ <!-- Least restrictive policy: -->
+ <!--
+ <site-control permitted-cross-domain-policies="all"/>
+ <allow-access-from domain="*" to-ports="*" secure="false"/>
+ <allow-http-request-headers-from domain="*" headers="*" secure="false"/>
+ -->
+</cross-domain-policy>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/robots.txt
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/robots.txt b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/robots.txt
new file mode 100644
index 0000000..f591645
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/robots.txt
@@ -0,0 +1,3 @@
+# http://www.robotstxt.org
+User-agent: *
+Disallow:
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/testem.json
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/testem.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/testem.json
new file mode 100644
index 0000000..0f35392
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/testem.json
@@ -0,0 +1,12 @@
+{
+ "framework": "qunit",
+ "test_page": "tests/index.html?hidepassed",
+ "disable_watching": true,
+ "launch_in_ci": [
+ "PhantomJS"
+ ],
+ "launch_in_dev": [
+ "PhantomJS",
+ "Chrome"
+ ]
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/.jshintrc
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/.jshintrc b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/.jshintrc
new file mode 100644
index 0000000..6ec0b7c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/.jshintrc
@@ -0,0 +1,52 @@
+{
+ "predef": [
+ "document",
+ "window",
+ "location",
+ "setTimeout",
+ "$",
+ "-Promise",
+ "define",
+ "console",
+ "visit",
+ "exists",
+ "fillIn",
+ "click",
+ "keyEvent",
+ "triggerEvent",
+ "find",
+ "findWithAssert",
+ "wait",
+ "DS",
+ "andThen",
+ "currentURL",
+ "currentPath",
+ "currentRouteName"
+ ],
+ "node": false,
+ "browser": false,
+ "boss": true,
+ "curly": true,
+ "debug": false,
+ "devel": false,
+ "eqeqeq": true,
+ "evil": true,
+ "forin": false,
+ "immed": false,
+ "laxbreak": false,
+ "newcap": true,
+ "noarg": true,
+ "noempty": false,
+ "nonew": false,
+ "nomen": false,
+ "onevar": false,
+ "plusplus": false,
+ "regexp": false,
+ "undef": true,
+ "sub": true,
+ "strict": false,
+ "white": false,
+ "eqnull": true,
+ "esnext": true,
+ "unused": true
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/resolver.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/resolver.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/resolver.js
new file mode 100644
index 0000000..28f4ece
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/resolver.js
@@ -0,0 +1,11 @@
+import Resolver from 'ember/resolver';
+import config from '../../config/environment';
+
+var resolver = Resolver.create();
+
+resolver.namespace = {
+ modulePrefix: config.modulePrefix,
+ podModulePrefix: config.podModulePrefix
+};
+
+export default resolver;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/start-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/start-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/start-app.js
new file mode 100644
index 0000000..0f7aab1
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/start-app.js
@@ -0,0 +1,18 @@
+import Ember from 'ember';
+import Application from '../../app';
+import config from '../../config/environment';
+
+export default function startApp(attrs) {
+ var application;
+
+ var attributes = Ember.merge({}, config.APP);
+ attributes = Ember.merge(attributes, attrs); // use defaults, but you can override;
+
+ Ember.run(function() {
+ application = Application.create(attributes);
+ application.setupForTesting();
+ application.injectTestHelpers();
+ });
+
+ return application;
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/index.html
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/index.html b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/index.html
new file mode 100644
index 0000000..33f7045
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/index.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <title>YarnUi Tests</title>
+ <meta name="description" content="">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+
+ {{content-for 'head'}}
+ {{content-for 'test-head'}}
+
+ <link rel="stylesheet" href="assets/vendor.css">
+ <link rel="stylesheet" href="assets/yarn-ui.css">
+ <link rel="stylesheet" href="assets/test-support.css">
+
+ {{content-for 'head-footer'}}
+ {{content-for 'test-head-footer'}}
+ </head>
+ <body>
+
+ {{content-for 'body'}}
+ {{content-for 'test-body'}}
+ <script src="assets/vendor.js"></script>
+ <script src="assets/test-support.js"></script>
+ <script src="assets/yarn-ui.js"></script>
+ <script src="testem.js"></script>
+ <script src="assets/test-loader.js"></script>
+
+ {{content-for 'body-footer'}}
+ {{content-for 'test-body-footer'}}
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/test-helper.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/test-helper.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/test-helper.js
new file mode 100644
index 0000000..e6cfb70
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/test-helper.js
@@ -0,0 +1,6 @@
+import resolver from './helpers/resolver';
+import {
+ setResolver
+} from 'ember-qunit';
+
+setResolver(resolver);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/.gitkeep
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/.gitkeep b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/.gitkeep
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-app-test.js
new file mode 100644
index 0000000..5683d5a
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-app-test.js
@@ -0,0 +1,12 @@
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('adapter:yarn-app', 'Unit | Adapter | yarn app', {
+ // Specify the other units that are required for this test.
+ // needs: ['serializer:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ var adapter = this.subject();
+ assert.ok(adapter);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-apps-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-apps-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-apps-test.js
new file mode 100644
index 0000000..d25f72d
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-apps-test.js
@@ -0,0 +1,12 @@
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('controller:yarn-apps', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ var controller = this.subject();
+ assert.ok(controller);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-queues-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-queues-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-queues-test.js
new file mode 100644
index 0000000..313dfdd
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-queues-test.js
@@ -0,0 +1,12 @@
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('controller:yarn-queues', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ var controller = this.subject();
+ assert.ok(controller);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/mixins/charts-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/mixins/charts-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/mixins/charts-test.js
new file mode 100644
index 0000000..b4f3503
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/mixins/charts-test.js
@@ -0,0 +1,12 @@
+import Ember from 'ember';
+import ChartsMixin from '../../../mixins/charts';
+import { module, test } from 'qunit';
+
+module('Unit | Mixin | charts');
+
+// Replace this with your real tests.
+test('it works', function(assert) {
+ var ChartsObject = Ember.Object.extend(ChartsMixin);
+ var subject = ChartsObject.create();
+ assert.ok(subject);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-app-test.js
new file mode 100644
index 0000000..e3261e2
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-app-test.js
@@ -0,0 +1,12 @@
+import { moduleForModel, test } from 'ember-qunit';
+
+moduleForModel('yarn-app', 'Unit | Model | yarn app', {
+ // Specify the other units that are required for this test.
+ needs: []
+});
+
+test('it exists', function(assert) {
+ var model = this.subject();
+ // var store = this.store();
+ assert.ok(!!model);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-apps-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-apps-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-apps-test.js
new file mode 100644
index 0000000..a438b2e
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-apps-test.js
@@ -0,0 +1,11 @@
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:yarn-apps', 'Unit | Route | yarn apps', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+test('it exists', function(assert) {
+ var route = this.subject();
+ assert.ok(route);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-app-test.js
new file mode 100644
index 0000000..a169fd5
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-app-test.js
@@ -0,0 +1,15 @@
+import { moduleForModel, test } from 'ember-qunit';
+
+moduleForModel('yarn-app', 'Unit | Serializer | yarn app', {
+ // Specify the other units that are required for this test.
+ needs: ['serializer:yarn-app']
+});
+
+// Replace this with your real tests.
+test('it serializes records', function(assert) {
+ var record = this.subject();
+
+ var serializedRecord = record.serialize();
+
+ assert.ok(serializedRecord);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/converter-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/converter-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/converter-test.js
new file mode 100644
index 0000000..55cf71d
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/converter-test.js
@@ -0,0 +1,10 @@
+import converter from '../../../utils/converter';
+import { module, test } from 'qunit';
+
+module('Unit | Utility | converter');
+
+// Replace this with your real tests.
+test('it works', function(assert) {
+ var result = converter();
+ assert.ok(result);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/vendor/.gitkeep
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/vendor/.gitkeep b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/vendor/.gitkeep
new file mode 100644
index 0000000..e69de29
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[21/50] [abbrv] hadoop git commit: YARN-5394. Remove bind-mount
/etc/passwd for Docker containers. Contributed by Zhankun Tang.
Posted by wa...@apache.org.
YARN-5394. Remove bind-mount /etc/passwd for Docker containers. Contributed by Zhankun Tang.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/522ddbde
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/522ddbde
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/522ddbde
Branch: refs/heads/YARN-3368
Commit: 522ddbde79cd453cac066b6136f004f54e2123b0
Parents: 82c9e06
Author: Varun Vasudev <vv...@apache.org>
Authored: Tue Aug 9 16:04:09 2016 +0530
Committer: Varun Vasudev <vv...@apache.org>
Committed: Tue Aug 9 16:04:09 2016 +0530
----------------------------------------------------------------------
.../linux/runtime/DockerLinuxContainerRuntime.java | 3 +--
.../linux/runtime/TestDockerContainerRuntime.java | 4 ----
2 files changed, 1 insertion(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/522ddbde/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/DockerLinuxContainerRuntime.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/DockerLinuxContainerRuntime.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/DockerLinuxContainerRuntime.java
index 0cfdd05..dc56ab0 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/DockerLinuxContainerRuntime.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/DockerLinuxContainerRuntime.java
@@ -343,8 +343,7 @@ public class DockerLinuxContainerRuntime implements LinuxContainerRuntime {
.detachOnRun()
.setContainerWorkDir(containerWorkDir.toString())
.setNetworkType(network)
- .setCapabilities(capabilities)
- .addMountLocation("/etc/passwd", "/etc/password:ro");
+ .setCapabilities(capabilities);
List<String> allDirs = new ArrayList<>(containerLocalDirs);
allDirs.addAll(filecacheDirs);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/522ddbde/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/TestDockerContainerRuntime.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/TestDockerContainerRuntime.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/TestDockerContainerRuntime.java
index a29b174..ad8b52d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/TestDockerContainerRuntime.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/TestDockerContainerRuntime.java
@@ -276,7 +276,6 @@ public class TestDockerContainerRuntime {
.append("--workdir=%3$s ")
.append("--net=host ")
.append(getExpectedTestCapabilitiesArgumentString())
- .append("-v /etc/passwd:/etc/password:ro ")
.append("-v %4$s:%4$s ")
.append("-v %5$s:%5$s ")
.append("-v %6$s:%6$s ")
@@ -382,7 +381,6 @@ public class TestDockerContainerRuntime {
.append("--workdir=%3$s ")
.append("--net=" + allowedNetwork + " ")
.append(getExpectedTestCapabilitiesArgumentString())
- .append("-v /etc/passwd:/etc/password:ro ")
.append("-v %4$s:%4$s ").append("-v %5$s:%5$s ")
.append("-v %6$s:%6$s ").append("-v %7$s:%7$s ")
.append("-v %8$s:%8$s ").append("%9$s ")
@@ -437,7 +435,6 @@ public class TestDockerContainerRuntime {
.append("--workdir=%3$s ")
.append("--net=" + customNetwork1 + " ")
.append(getExpectedTestCapabilitiesArgumentString())
- .append("-v /etc/passwd:/etc/password:ro ")
.append("-v %4$s:%4$s ").append("-v %5$s:%5$s ")
.append("-v %6$s:%6$s ").append("-v %7$s:%7$s ")
.append("-v %8$s:%8$s ").append("%9$s ")
@@ -474,7 +471,6 @@ public class TestDockerContainerRuntime {
.append("--workdir=%3$s ")
.append("--net=" + customNetwork2 + " ")
.append(getExpectedTestCapabilitiesArgumentString())
- .append("-v /etc/passwd:/etc/password:ro ")
.append("-v %4$s:%4$s ").append("-v %5$s:%5$s ")
.append("-v %6$s:%6$s ").append("-v %7$s:%7$s ")
.append("-v %8$s:%8$s ").append("%9$s ")
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[02/50] [abbrv] hadoop git commit: YARN-5470. Differentiate exactly
match with regex in yarn log CLI. Contributed by Xuan Gong.
Posted by wa...@apache.org.
YARN-5470. Differentiate exactly match with regex in yarn log CLI. Contributed by Xuan Gong.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/e605d47d
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/e605d47d
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/e605d47d
Branch: refs/heads/YARN-3368
Commit: e605d47df05619c6b1c18aca59f709899498da75
Parents: 3f100d7
Author: Junping Du <ju...@apache.org>
Authored: Fri Aug 5 10:54:36 2016 -0700
Committer: Junping Du <ju...@apache.org>
Committed: Fri Aug 5 10:55:29 2016 -0700
----------------------------------------------------------------------
.../apache/hadoop/yarn/client/cli/LogsCLI.java | 125 +++++++++++--------
.../hadoop/yarn/client/cli/TestLogsCLI.java | 69 +++++++---
.../logaggregation/ContainerLogsRequest.java | 10 +-
.../yarn/logaggregation/LogCLIHelpers.java | 8 +-
4 files changed, 137 insertions(+), 75 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/e605d47d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
index c49d463..ec045b2 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
@@ -25,6 +25,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -90,6 +91,7 @@ public class LogsCLI extends Configured implements Tool {
= "show_container_log_info";
private static final String OUT_OPTION = "out";
private static final String SIZE_OPTION = "size";
+ private static final String REGEX_OPTION = "regex";
public static final String HELP_CMD = "help";
private PrintStream outStream = System.out;
private YarnClient yarnClient = null;
@@ -126,6 +128,7 @@ public class LogsCLI extends Configured implements Tool {
boolean nodesList = false;
boolean showApplicationLogInfo = false;
boolean showContainerLogInfo = false;
+ boolean useRegex = false;
String[] logFiles = null;
List<String> amContainersList = new ArrayList<String>();
String localDir = null;
@@ -142,6 +145,7 @@ public class LogsCLI extends Configured implements Tool {
showApplicationLogInfo = commandLine.hasOption(
SHOW_APPLICATION_LOG_INFO);
showContainerLogInfo = commandLine.hasOption(SHOW_CONTAINER_LOG_INFO);
+ useRegex = commandLine.hasOption(REGEX_OPTION);
if (getAMContainerLogs) {
try {
amContainersList = parseAMContainer(commandLine, printOpts);
@@ -243,11 +247,11 @@ public class LogsCLI extends Configured implements Tool {
}
}
- List<String> logs = new ArrayList<String>();
- if (fetchAllLogFiles(logFiles)) {
- logs.add(".*");
+ Set<String> logs = new HashSet<String>();
+ if (fetchAllLogFiles(logFiles, useRegex)) {
+ logs.add("ALL");
} else if (logFiles != null && logFiles.length > 0) {
- logs = Arrays.asList(logFiles);
+ logs.addAll(Arrays.asList(logFiles));
}
ContainerLogsRequest request = new ContainerLogsRequest(appId,
@@ -268,15 +272,15 @@ public class LogsCLI extends Configured implements Tool {
// To get am logs
if (getAMContainerLogs) {
return fetchAMContainerLogs(request, amContainersList,
- logCliHelper);
+ logCliHelper, useRegex);
}
int resultCode = 0;
if (containerIdStr != null) {
- return fetchContainerLogs(request, logCliHelper);
+ return fetchContainerLogs(request, logCliHelper, useRegex);
} else {
if (nodeAddress == null) {
- resultCode = fetchApplicationLogs(request, logCliHelper);
+ resultCode = fetchApplicationLogs(request, logCliHelper, useRegex);
} else {
System.err.println("Should at least provide ContainerId!");
printHelpMessage(printOpts);
@@ -362,7 +366,7 @@ public class LogsCLI extends Configured implements Tool {
return amContainersList;
}
- private boolean fetchAllLogFiles(String[] logFiles) {
+ private boolean fetchAllLogFiles(String[] logFiles, boolean useRegex) {
// If no value is specified for the PER_CONTAINER_LOG_FILES_OPTION option,
// we will assume all logs.
@@ -371,7 +375,8 @@ public class LogsCLI extends Configured implements Tool {
}
List<String> logs = Arrays.asList(logFiles);
- if (logs.contains("ALL") || logs.contains(".*")) {
+ if (logs.contains("ALL") || logs.contains("*")||
+ (logs.contains(".*") && useRegex)) {
return true;
}
@@ -417,8 +422,8 @@ public class LogsCLI extends Configured implements Tool {
@Private
@VisibleForTesting
public int printContainerLogsFromRunningApplication(Configuration conf,
- ContainerLogsRequest request, LogCLIHelpers logCliHelper)
- throws IOException {
+ ContainerLogsRequest request, LogCLIHelpers logCliHelper,
+ boolean useRegex) throws IOException {
String containerIdStr = request.getContainerId().toString();
String localDir = request.getOutputLocalDir();
String nodeHttpAddress = request.getNodeHttpAddress();
@@ -441,7 +446,8 @@ public class LogsCLI extends Configured implements Tool {
for (PerLogFileInfo fileInfo : allLogFileInfos) {
fileNames.add(fileInfo.getFileName());
}
- List<String> matchedFiles = getMatchedLogFiles(request, fileNames);
+ Set<String> matchedFiles = getMatchedLogFiles(request, fileNames,
+ useRegex);
if (matchedFiles.isEmpty()) {
System.err.println("Can not find any log file matching the pattern: "
+ request.getLogTypes() + " for the container: " + containerIdStr
@@ -503,10 +509,10 @@ public class LogsCLI extends Configured implements Tool {
}
private int printContainerLogsForFinishedApplication(
- ContainerLogsRequest request, LogCLIHelpers logCliHelper)
- throws IOException {
+ ContainerLogsRequest request, LogCLIHelpers logCliHelper,
+ boolean useRegex) throws IOException {
ContainerLogsRequest newOptions = getMatchedLogOptions(
- request, logCliHelper);
+ request, logCliHelper, useRegex);
if (newOptions == null) {
System.err.println("Can not find any log file matching the pattern: "
+ request.getLogTypes() + " for the container: "
@@ -518,10 +524,10 @@ public class LogsCLI extends Configured implements Tool {
}
private int printContainerLogsForFinishedApplicationWithoutNodeId(
- ContainerLogsRequest request, LogCLIHelpers logCliHelper)
- throws IOException {
+ ContainerLogsRequest request, LogCLIHelpers logCliHelper,
+ boolean useRegex) throws IOException {
ContainerLogsRequest newOptions = getMatchedLogOptions(
- request, logCliHelper);
+ request, logCliHelper, useRegex);
if (newOptions == null) {
System.err.println("Can not find any log file matching the pattern: "
+ request.getLogTypes() + " for the container: "
@@ -549,7 +555,7 @@ public class LogsCLI extends Configured implements Tool {
private int printAMContainerLogs(Configuration conf,
ContainerLogsRequest request, List<String> amContainers,
- LogCLIHelpers logCliHelper) throws Exception {
+ LogCLIHelpers logCliHelper, boolean useRegex) throws Exception {
List<JSONObject> amContainersList = null;
List<ContainerLogsRequest> requests =
new ArrayList<ContainerLogsRequest>();
@@ -613,7 +619,7 @@ public class LogsCLI extends Configured implements Tool {
if (amContainers.contains("ALL")) {
for (ContainerLogsRequest amRequest : requests) {
- outputAMContainerLogs(amRequest, conf, logCliHelper);
+ outputAMContainerLogs(amRequest, conf, logCliHelper, useRegex);
}
outStream.println();
outStream.println("Specified ALL for -am option. "
@@ -623,11 +629,11 @@ public class LogsCLI extends Configured implements Tool {
int amContainerId = Integer.parseInt(amContainer.trim());
if (amContainerId == -1) {
outputAMContainerLogs(requests.get(requests.size() - 1), conf,
- logCliHelper);
+ logCliHelper, useRegex);
} else {
if (amContainerId <= requests.size()) {
outputAMContainerLogs(requests.get(amContainerId - 1), conf,
- logCliHelper);
+ logCliHelper, useRegex);
} else {
System.err.println(String.format("ERROR: Specified AM containerId"
+ " (%s) exceeds the number of AM containers (%s).",
@@ -641,7 +647,8 @@ public class LogsCLI extends Configured implements Tool {
}
private void outputAMContainerLogs(ContainerLogsRequest request,
- Configuration conf, LogCLIHelpers logCliHelper) throws Exception {
+ Configuration conf, LogCLIHelpers logCliHelper, boolean useRegex)
+ throws Exception {
String nodeHttpAddress = request.getNodeHttpAddress();
String containerId = request.getContainerId();
String nodeId = request.getNodeId();
@@ -650,10 +657,10 @@ public class LogsCLI extends Configured implements Tool {
if (containerId != null && !containerId.isEmpty()) {
if (nodeId != null && !nodeId.isEmpty()) {
printContainerLogsForFinishedApplication(request,
- logCliHelper);
+ logCliHelper, useRegex);
} else {
printContainerLogsForFinishedApplicationWithoutNodeId(
- request, logCliHelper);
+ request, logCliHelper, useRegex);
}
}
} else {
@@ -663,7 +670,7 @@ public class LogsCLI extends Configured implements Tool {
.getContainerState();
request.setContainerState(containerState);
printContainerLogsFromRunningApplication(conf,
- request, logCliHelper);
+ request, logCliHelper, useRegex);
}
}
}
@@ -746,12 +753,15 @@ public class LogsCLI extends Configured implements Tool {
opts.addOption(amOption);
Option logFileOpt = new Option(PER_CONTAINER_LOG_FILES_OPTION, true,
"Specify comma-separated value "
- + "to get specified container log files. Use \"ALL\" to fetch all the "
- + "log files for the container. It also supports Java Regex.");
+ + "to get exact matched log files. Use \"ALL\" or \"*\"to "
+ + "fetch all the log files for the container. Specific -regex "
+ + "for using java regex to find matched log files.");
logFileOpt.setValueSeparator(',');
logFileOpt.setArgs(Option.UNLIMITED_VALUES);
logFileOpt.setArgName("Log File Name");
opts.addOption(logFileOpt);
+ opts.addOption(REGEX_OPTION, false, "Work with -log_files to find "
+ + "matched files by using java regex.");
opts.addOption(SHOW_CONTAINER_LOG_INFO, false,
"Show the container log metadata, "
+ "including log-file names, the size of the log files. "
@@ -794,6 +804,7 @@ public class LogsCLI extends Configured implements Tool {
printOpts.addOption(commandOpts.getOption(SHOW_CONTAINER_LOG_INFO));
printOpts.addOption(commandOpts.getOption(OUT_OPTION));
printOpts.addOption(commandOpts.getOption(SIZE_OPTION));
+ printOpts.addOption(commandOpts.getOption(REGEX_OPTION));
return printOpts;
}
@@ -829,14 +840,14 @@ public class LogsCLI extends Configured implements Tool {
}
private int fetchAMContainerLogs(ContainerLogsRequest request,
- List<String> amContainersList, LogCLIHelpers logCliHelper)
- throws Exception {
+ List<String> amContainersList, LogCLIHelpers logCliHelper,
+ boolean useRegex) throws Exception {
return printAMContainerLogs(getConf(), request, amContainersList,
- logCliHelper);
+ logCliHelper, useRegex);
}
private int fetchContainerLogs(ContainerLogsRequest request,
- LogCLIHelpers logCliHelper) throws IOException {
+ LogCLIHelpers logCliHelper, boolean useRegex) throws IOException {
int resultCode = 0;
String appIdStr = request.getAppId().toString();
String containerIdStr = request.getContainerId();
@@ -850,10 +861,10 @@ public class LogsCLI extends Configured implements Tool {
// to logCliHelper so that it fetches all the logs
if (nodeAddress != null && !nodeAddress.isEmpty()) {
return printContainerLogsForFinishedApplication(
- request, logCliHelper);
+ request, logCliHelper, useRegex);
} else {
return printContainerLogsForFinishedApplicationWithoutNodeId(
- request, logCliHelper);
+ request, logCliHelper, useRegex);
}
}
String nodeHttpAddress = null;
@@ -875,7 +886,7 @@ public class LogsCLI extends Configured implements Tool {
} catch (IOException | YarnException ex) {
if (isAppFinished) {
return printContainerLogsForFinishedApplicationWithoutNodeId(
- request, logCliHelper);
+ request, logCliHelper, useRegex);
} else {
System.err.println("Unable to get logs for this container:"
+ containerIdStr + "for the application:" + appIdStr
@@ -892,18 +903,19 @@ public class LogsCLI extends Configured implements Tool {
// by calling NodeManager webservice.
if (!isAppFinished) {
resultCode = printContainerLogsFromRunningApplication(getConf(), request,
- logCliHelper);
+ logCliHelper, useRegex);
} else {
// If the application is in the final state, we will directly
// get the container logs from HDFS.
resultCode = printContainerLogsForFinishedApplication(
- request, logCliHelper);
+ request, logCliHelper, useRegex);
}
return resultCode;
}
private int fetchApplicationLogs(ContainerLogsRequest options,
- LogCLIHelpers logCliHelper) throws IOException, YarnException {
+ LogCLIHelpers logCliHelper, boolean useRegex) throws IOException,
+ YarnException {
// If the application has finished, we would fetch the logs
// from HDFS.
// If the application is still running, we would get the full
@@ -912,7 +924,7 @@ public class LogsCLI extends Configured implements Tool {
int resultCode = -1;
if (options.isAppFinished()) {
ContainerLogsRequest newOptions = getMatchedLogOptions(
- options, logCliHelper);
+ options, logCliHelper, useRegex);
if (newOptions == null) {
System.err.println("Can not find any log file matching the pattern: "
+ options.getLogTypes() + " for the application: "
@@ -926,7 +938,7 @@ public class LogsCLI extends Configured implements Tool {
getContainersLogRequestForRunningApplication(options);
for (ContainerLogsRequest container : containerLogRequests) {
int result = printContainerLogsFromRunningApplication(getConf(),
- container, logCliHelper);
+ container, logCliHelper, useRegex);
if (result == 0) {
resultCode = 0;
}
@@ -955,14 +967,14 @@ public class LogsCLI extends Configured implements Tool {
}
private ContainerLogsRequest getMatchedLogOptions(
- ContainerLogsRequest request, LogCLIHelpers logCliHelper)
- throws IOException {
+ ContainerLogsRequest request, LogCLIHelpers logCliHelper,
+ boolean useRegex) throws IOException {
ContainerLogsRequest newOptions = new ContainerLogsRequest(request);
if (request.getLogTypes() != null && !request.getLogTypes().isEmpty()) {
- List<String> matchedFiles = new ArrayList<String>();
- if (!request.getLogTypes().contains(".*")) {
+ Set<String> matchedFiles = new HashSet<String>();
+ if (!request.getLogTypes().contains("ALL")) {
Set<String> files = logCliHelper.listContainerLogs(request);
- matchedFiles = getMatchedLogFiles(request, files);
+ matchedFiles = getMatchedLogFiles(request, files, useRegex);
if (matchedFiles.isEmpty()) {
return null;
}
@@ -972,20 +984,29 @@ public class LogsCLI extends Configured implements Tool {
return newOptions;
}
- private List<String> getMatchedLogFiles(ContainerLogsRequest options,
- Collection<String> candidate) throws IOException {
- List<String> matchedFiles = new ArrayList<String>();
- List<String> filePattern = options.getLogTypes();
+ private Set<String> getMatchedLogFiles(ContainerLogsRequest options,
+ Collection<String> candidate, boolean useRegex) throws IOException {
+ Set<String> matchedFiles = new HashSet<String>();
+ Set<String> filePattern = options.getLogTypes();
+ if (options.getLogTypes().contains("ALL")) {
+ return new HashSet<String>(candidate);
+ }
for (String file : candidate) {
- if (isFileMatching(file, filePattern)) {
- matchedFiles.add(file);
+ if (useRegex) {
+ if (isFileMatching(file, filePattern)) {
+ matchedFiles.add(file);
+ }
+ } else {
+ if (filePattern.contains(file)) {
+ matchedFiles.add(file);
+ }
}
}
return matchedFiles;
}
private boolean isFileMatching(String fileType,
- List<String> logTypes) {
+ Set<String> logTypes) {
for (String logType : logTypes) {
Pattern filterPattern = Pattern.compile(logType);
boolean match = filterPattern.matcher(fileType).find();
http://git-wip-us.apache.org/repos/asf/hadoop/blob/e605d47d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestLogsCLI.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestLogsCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestLogsCLI.java
index 329d856..467b204 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestLogsCLI.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestLogsCLI.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyBoolean;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
@@ -46,7 +47,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
-
+import java.util.Set;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
@@ -211,14 +212,17 @@ public class TestLogsCLI {
pw.println(" aggregated logs. This option can only be");
pw.println(" used with finished applications.");
pw.println(" -log_files <Log File Name> Specify comma-separated value to get");
- pw.println(" specified container log files. Use \"ALL\"");
- pw.println(" to fetch all the log files for the");
- pw.println(" container. It also supports Java Regex.");
+ pw.println(" exact matched log files. Use \"ALL\" or");
+ pw.println(" \"*\"to fetch all the log files for the");
+ pw.println(" container. Specific -regex for using java");
+ pw.println(" regex to find matched log files.");
pw.println(" -nodeAddress <Node Address> NodeAddress in the format nodename:port");
pw.println(" -out <Local Directory> Local directory for storing individual");
pw.println(" container logs. The container logs will");
pw.println(" be stored based on the node the container");
pw.println(" ran on.");
+ pw.println(" -regex Work with -log_files to find matched");
+ pw.println(" files by using java regex.");
pw.println(" -show_application_log_info Show the containerIds which belong to the");
pw.println(" specific Application. You can combine");
pw.println(" this with --nodeAddress to get");
@@ -286,6 +290,7 @@ public class TestLogsCLI {
// create two logs for container3 in localLogDir
logTypes.add("stdout");
+ logTypes.add("stdout1234");
createContainerLogInLocalDir(appLogsDir, containerId3, fs, logTypes);
Path path =
@@ -336,10 +341,27 @@ public class TestLogsCLI {
logMessage(containerId3, "syslog")));
assertTrue(sysOutStream.toString().contains(
logMessage(containerId3, "stdout")));
+ assertTrue(sysOutStream.toString().contains(
+ logMessage(containerId3, "stdout1234")));
+ sysOutStream.reset();
+
+ exitCode = cli.run(new String[] {"-applicationId", appId.toString(),
+ "-log_files", ".*", "-regex"});
+ assertTrue(exitCode == 0);
+ assertTrue(sysOutStream.toString().contains(
+ logMessage(containerId1, "syslog")));
+ assertTrue(sysOutStream.toString().contains(
+ logMessage(containerId2, "syslog")));
+ assertTrue(sysOutStream.toString().contains(
+ logMessage(containerId3, "syslog")));
+ assertTrue(sysOutStream.toString().contains(
+ logMessage(containerId3, "stdout")));
+ assertTrue(sysOutStream.toString().contains(
+ logMessage(containerId3, "stdout1234")));
sysOutStream.reset();
exitCode = cli.run(new String[] {"-applicationId", appId.toString(),
- "-log_files", ".*"});
+ "-log_files", "*"});
assertTrue(exitCode == 0);
assertTrue(sysOutStream.toString().contains(
logMessage(containerId1, "syslog")));
@@ -349,11 +371,13 @@ public class TestLogsCLI {
logMessage(containerId3, "syslog")));
assertTrue(sysOutStream.toString().contains(
logMessage(containerId3, "stdout")));
+ assertTrue(sysOutStream.toString().contains(
+ logMessage(containerId3, "stdout1234")));
int fullSize = sysOutStream.toByteArray().length;
sysOutStream.reset();
exitCode = cli.run(new String[] {"-applicationId", appId.toString(),
- "-log_files", "std*"});
+ "-log_files", "stdout"});
assertTrue(exitCode == 0);
assertFalse(sysOutStream.toString().contains(
logMessage(containerId1, "syslog")));
@@ -363,6 +387,23 @@ public class TestLogsCLI {
logMessage(containerId3, "syslog")));
assertTrue(sysOutStream.toString().contains(
logMessage(containerId3, "stdout")));
+ assertFalse(sysOutStream.toString().contains(
+ logMessage(containerId3, "stdout1234")));
+ sysOutStream.reset();
+
+ exitCode = cli.run(new String[] {"-applicationId", appId.toString(),
+ "-log_files", "std*", "-regex"});
+ assertTrue(exitCode == 0);
+ assertFalse(sysOutStream.toString().contains(
+ logMessage(containerId1, "syslog")));
+ assertFalse(sysOutStream.toString().contains(
+ logMessage(containerId2, "syslog")));
+ assertFalse(sysOutStream.toString().contains(
+ logMessage(containerId3, "syslog")));
+ assertTrue(sysOutStream.toString().contains(
+ logMessage(containerId3, "stdout")));
+ assertTrue(sysOutStream.toString().contains(
+ logMessage(containerId3, "stdout1234")));
sysOutStream.reset();
exitCode = cli.run(new String[] {"-applicationId", appId.toString(),
@@ -376,7 +417,7 @@ public class TestLogsCLI {
// specify the bytes which is larger than the actual file size,
// we would get the full logs
exitCode = cli.run(new String[] {"-applicationId", appId.toString(),
- "-log_files", ".*", "-size", "10000" });
+ "-log_files", "*", "-size", "10000" });
assertTrue(exitCode == 0);
assertTrue(sysOutStream.toByteArray().length == fullSize);
sysOutStream.reset();
@@ -568,7 +609,7 @@ public class TestLogsCLI {
LogsCLI cli = spy(new LogsCLIForTest(mockYarnClient));
doReturn(0).when(cli).printContainerLogsFromRunningApplication(
any(Configuration.class), any(ContainerLogsRequest.class),
- any(LogCLIHelpers.class));
+ any(LogCLIHelpers.class), anyBoolean());
cli.setConf(new YarnConfiguration());
int exitCode = cli.run(new String[] {"-applicationId", appId.toString()});
@@ -581,16 +622,16 @@ public class TestLogsCLI {
// printContainerLogsFromRunningApplication twice
verify(cli, times(2)).printContainerLogsFromRunningApplication(
any(Configuration.class), logsRequestCaptor.capture(),
- any(LogCLIHelpers.class));
+ any(LogCLIHelpers.class), anyBoolean());
- // Verify that the log-type is *
+ // Verify that the log-type is "ALL"
List<ContainerLogsRequest> capturedRequests =
logsRequestCaptor.getAllValues();
Assert.assertEquals(2, capturedRequests.size());
- List<String> logTypes0 = capturedRequests.get(0).getLogTypes();
- List<String> logTypes1 = capturedRequests.get(1).getLogTypes();
- Assert.assertEquals(".*", logTypes0.get(0));
- Assert.assertEquals(".*", logTypes1.get(0));
+ Set<String> logTypes0 = capturedRequests.get(0).getLogTypes();
+ Set<String> logTypes1 = capturedRequests.get(1).getLogTypes();
+ Assert.assertTrue(logTypes0.contains("ALL") && (logTypes0.size() == 1));
+ Assert.assertTrue(logTypes1.contains("ALL") && (logTypes1.size() == 1));
}
@Test (timeout = 15000)
http://git-wip-us.apache.org/repos/asf/hadoop/blob/e605d47d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/ContainerLogsRequest.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/ContainerLogsRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/ContainerLogsRequest.java
index af65fef..30aeb6c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/ContainerLogsRequest.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/ContainerLogsRequest.java
@@ -18,7 +18,7 @@
package org.apache.hadoop.yarn.logaggregation;
-import java.util.List;
+import java.util.Set;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ContainerState;
@@ -30,7 +30,7 @@ public class ContainerLogsRequest {
private String appOwner;
private boolean appFinished;
private String outputLocalDir;
- private List<String> logTypes;
+ private Set<String> logTypes;
private long bytes;
private ContainerState containerState;
@@ -52,7 +52,7 @@ public class ContainerLogsRequest {
public ContainerLogsRequest(ApplicationId applicationId,
boolean isAppFinished, String owner,
String address, String httpAddress, String container, String localDir,
- List<String> logs, long bytes, ContainerState containerState) {
+ Set<String> logs, long bytes, ContainerState containerState) {
this.setAppId(applicationId);
this.setAppFinished(isAppFinished);
this.setAppOwner(owner);
@@ -121,11 +121,11 @@ public class ContainerLogsRequest {
this.outputLocalDir = outputLocalDir;
}
- public List<String> getLogTypes() {
+ public Set<String> getLogTypes() {
return logTypes;
}
- public void setLogTypes(List<String> logTypes) {
+ public void setLogTypes(Set<String> logTypes) {
this.logTypes = logTypes;
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/e605d47d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/LogCLIHelpers.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/LogCLIHelpers.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/LogCLIHelpers.java
index 13934d2..3ea3fa6 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/LogCLIHelpers.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/LogCLIHelpers.java
@@ -67,7 +67,7 @@ public class LogCLIHelpers implements Configurable {
options.setContainerId(containerId);
options.setNodeId(nodeId);
options.setAppOwner(jobOwner);
- List<String> logs = new ArrayList<String>();
+ Set<String> logs = new HashSet<String>();
options.setLogTypes(logs);
options.setBytes(Long.MAX_VALUE);
return dumpAContainerLogsForLogType(options, false);
@@ -136,7 +136,7 @@ public class LogCLIHelpers implements Configurable {
String nodeId = options.getNodeId();
String containerId = options.getContainerId();
String localDir = options.getOutputLocalDir();
- List<String> logType = options.getLogTypes();
+ List<String> logType = new ArrayList<String>(options.getLogTypes());
RemoteIterator<FileStatus> nodeFiles = getRemoteNodeFileDir(
applicationId, jobOwner);
if (nodeFiles == null) {
@@ -208,7 +208,7 @@ public class LogCLIHelpers implements Configurable {
String jobOwner = options.getAppOwner();
String containerId = options.getContainerId();
String localDir = options.getOutputLocalDir();
- List<String> logType = options.getLogTypes();
+ List<String> logType = new ArrayList<String>(options.getLogTypes());
RemoteIterator<FileStatus> nodeFiles = getRemoteNodeFileDir(
applicationId, jobOwner);
if (nodeFiles == null) {
@@ -344,7 +344,7 @@ public class LogCLIHelpers implements Configurable {
ApplicationId appId = options.getAppId();
String appOwner = options.getAppOwner();
String localDir = options.getOutputLocalDir();
- List<String> logTypes = options.getLogTypes();
+ List<String> logTypes = new ArrayList<String>(options.getLogTypes());
RemoteIterator<FileStatus> nodeFiles = getRemoteNodeFileDir(
appId, appOwner);
if (nodeFiles == null) {
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[19/50] [abbrv] hadoop git commit: YARN-5457. Refactor
DistributedScheduling framework to pull out common functionality. (asuresh)
Posted by wa...@apache.org.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/82c9e061/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/DistributedSchedulingAMService.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/DistributedSchedulingAMService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/DistributedSchedulingAMService.java
deleted file mode 100644
index 843ac09..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/DistributedSchedulingAMService.java
+++ /dev/null
@@ -1,361 +0,0 @@
-/**
- * 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.hadoop.yarn.server.resourcemanager;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.ipc.RPC;
-import org.apache.hadoop.ipc.Server;
-import org.apache.hadoop.yarn.api.ApplicationMasterProtocolPB;
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.api.records.NodeId;
-import org.apache.hadoop.yarn.event.EventHandler;
-import org.apache.hadoop.yarn.server.api.DistributedSchedulingAMProtocol;
-import org.apache.hadoop.yarn.api.impl.pb.service.ApplicationMasterProtocolPBServiceImpl;
-
-
-import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
-import org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse;
-import org.apache.hadoop.yarn.server.api.protocolrecords.DistributedSchedulingAllocateRequest;
-import org.apache.hadoop.yarn.server.api.protocolrecords.DistributedSchedulingAllocateResponse;
-import org.apache.hadoop.yarn.server.api.protocolrecords.RegisterDistributedSchedulingAMResponse;
-import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterRequest;
-import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse;
-import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterRequest;
-import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse;
-
-import org.apache.hadoop.yarn.api.records.Resource;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.hadoop.yarn.ipc.YarnRPC;
-import org.apache.hadoop.yarn.proto.ApplicationMasterProtocol.ApplicationMasterProtocolService;
-
-import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer;
-import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerEvent;
-import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerEventType;
-import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerImpl;
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler;
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt;
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler;
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.distributed.NodeQueueLoadMonitor;
-
-
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.distributed.QueueLimitCalculator;
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeAddedSchedulerEvent;
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeRemovedSchedulerEvent;
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeResourceUpdateSchedulerEvent;
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeUpdateSchedulerEvent;
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEvent;
-import org.apache.hadoop.yarn.server.resourcemanager.security.AMRMTokenSecretManager;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * The DistributedSchedulingAMService is started instead of the
- * ApplicationMasterService if distributed scheduling is enabled for the YARN
- * cluster.
- * It extends the functionality of the ApplicationMasterService by servicing
- * clients (AMs and AMRMProxy request interceptors) that understand the
- * DistributedSchedulingProtocol.
- */
-public class DistributedSchedulingAMService extends ApplicationMasterService
- implements DistributedSchedulingAMProtocol, EventHandler<SchedulerEvent> {
-
- private static final Log LOG =
- LogFactory.getLog(DistributedSchedulingAMService.class);
-
- private final NodeQueueLoadMonitor nodeMonitor;
-
- private final ConcurrentHashMap<String, Set<NodeId>> rackToNode =
- new ConcurrentHashMap<>();
- private final ConcurrentHashMap<String, Set<NodeId>> hostToNode =
- new ConcurrentHashMap<>();
- private final int k;
-
- public DistributedSchedulingAMService(RMContext rmContext,
- YarnScheduler scheduler) {
- super(DistributedSchedulingAMService.class.getName(), rmContext, scheduler);
- this.k = rmContext.getYarnConfiguration().getInt(
- YarnConfiguration.DIST_SCHEDULING_NODES_NUMBER_USED,
- YarnConfiguration.DIST_SCHEDULING_NODES_NUMBER_USED_DEFAULT);
- long nodeSortInterval = rmContext.getYarnConfiguration().getLong(
- YarnConfiguration.NM_CONTAINER_QUEUING_SORTING_NODES_INTERVAL_MS,
- YarnConfiguration.
- NM_CONTAINER_QUEUING_SORTING_NODES_INTERVAL_MS_DEFAULT);
- NodeQueueLoadMonitor.LoadComparator comparator =
- NodeQueueLoadMonitor.LoadComparator.valueOf(
- rmContext.getYarnConfiguration().get(
- YarnConfiguration.NM_CONTAINER_QUEUING_LOAD_COMPARATOR,
- YarnConfiguration.
- NM_CONTAINER_QUEUING_LOAD_COMPARATOR_DEFAULT));
-
- NodeQueueLoadMonitor topKSelector =
- new NodeQueueLoadMonitor(nodeSortInterval, comparator);
-
- float sigma = rmContext.getYarnConfiguration()
- .getFloat(YarnConfiguration.NM_CONTAINER_QUEUING_LIMIT_STDEV,
- YarnConfiguration.NM_CONTAINER_QUEUING_LIMIT_STDEV_DEFAULT);
-
- int limitMin, limitMax;
-
- if (comparator == NodeQueueLoadMonitor.LoadComparator.QUEUE_LENGTH) {
- limitMin = rmContext.getYarnConfiguration()
- .getInt(YarnConfiguration.NM_CONTAINER_QUEUING_MIN_QUEUE_LENGTH,
- YarnConfiguration.
- NM_CONTAINER_QUEUING_MIN_QUEUE_LENGTH_DEFAULT);
- limitMax = rmContext.getYarnConfiguration()
- .getInt(YarnConfiguration.NM_CONTAINER_QUEUING_MAX_QUEUE_LENGTH,
- YarnConfiguration.
- NM_CONTAINER_QUEUING_MAX_QUEUE_LENGTH_DEFAULT);
- } else {
- limitMin = rmContext.getYarnConfiguration()
- .getInt(
- YarnConfiguration.NM_CONTAINER_QUEUING_MIN_QUEUE_WAIT_TIME_MS,
- YarnConfiguration.
- NM_CONTAINER_QUEUING_MIN_QUEUE_WAIT_TIME_MS_DEFAULT);
- limitMax = rmContext.getYarnConfiguration()
- .getInt(
- YarnConfiguration.NM_CONTAINER_QUEUING_MAX_QUEUE_WAIT_TIME_MS,
- YarnConfiguration.
- NM_CONTAINER_QUEUING_MAX_QUEUE_WAIT_TIME_MS_DEFAULT);
- }
-
- topKSelector.initThresholdCalculator(sigma, limitMin, limitMax);
- this.nodeMonitor = topKSelector;
- }
-
- @Override
- public Server getServer(YarnRPC rpc, Configuration serverConf,
- InetSocketAddress addr, AMRMTokenSecretManager secretManager) {
- Server server = rpc.getServer(DistributedSchedulingAMProtocol.class, this,
- addr, serverConf, secretManager,
- serverConf.getInt(YarnConfiguration.RM_SCHEDULER_CLIENT_THREAD_COUNT,
- YarnConfiguration.DEFAULT_RM_SCHEDULER_CLIENT_THREAD_COUNT));
- // To support application running on NMs that DO NOT support
- // Dist Scheduling... The server multiplexes both the
- // ApplicationMasterProtocol as well as the DistributedSchedulingProtocol
- ((RPC.Server) server).addProtocol(RPC.RpcKind.RPC_PROTOCOL_BUFFER,
- ApplicationMasterProtocolPB.class,
- ApplicationMasterProtocolService.newReflectiveBlockingService(
- new ApplicationMasterProtocolPBServiceImpl(this)));
- return server;
- }
-
- @Override
- public RegisterApplicationMasterResponse registerApplicationMaster
- (RegisterApplicationMasterRequest request) throws YarnException,
- IOException {
- return super.registerApplicationMaster(request);
- }
-
- @Override
- public FinishApplicationMasterResponse finishApplicationMaster
- (FinishApplicationMasterRequest request) throws YarnException,
- IOException {
- return super.finishApplicationMaster(request);
- }
-
- @Override
- public AllocateResponse allocate(AllocateRequest request) throws
- YarnException, IOException {
- return super.allocate(request);
- }
-
- @Override
- public RegisterDistributedSchedulingAMResponse
- registerApplicationMasterForDistributedScheduling(
- RegisterApplicationMasterRequest request) throws YarnException,
- IOException {
- RegisterApplicationMasterResponse response =
- registerApplicationMaster(request);
- RegisterDistributedSchedulingAMResponse dsResp = recordFactory
- .newRecordInstance(RegisterDistributedSchedulingAMResponse.class);
- dsResp.setRegisterResponse(response);
- dsResp.setMinContainerResource(
- Resource.newInstance(
- getConfig().getInt(
- YarnConfiguration.DIST_SCHEDULING_MIN_CONTAINER_MEMORY_MB,
- YarnConfiguration.
- DIST_SCHEDULING_MIN_CONTAINER_MEMORY_MB_DEFAULT),
- getConfig().getInt(
- YarnConfiguration.DIST_SCHEDULING_MIN_CONTAINER_VCORES,
- YarnConfiguration.DIST_SCHEDULING_MIN_CONTAINER_VCORES_DEFAULT)
- )
- );
- dsResp.setMaxContainerResource(
- Resource.newInstance(
- getConfig().getInt(
- YarnConfiguration.DIST_SCHEDULING_MAX_MEMORY_MB,
- YarnConfiguration.DIST_SCHEDULING_MAX_MEMORY_MB_DEFAULT),
- getConfig().getInt(
- YarnConfiguration.DIST_SCHEDULING_MAX_CONTAINER_VCORES,
- YarnConfiguration.DIST_SCHEDULING_MAX_CONTAINER_VCORES_DEFAULT)
- )
- );
- dsResp.setIncrContainerResource(
- Resource.newInstance(
- getConfig().getInt(
- YarnConfiguration.DIST_SCHEDULING_INCR_CONTAINER_MEMORY_MB,
- YarnConfiguration.
- DIST_SCHEDULING_INCR_CONTAINER_MEMORY_MB_DEFAULT),
- getConfig().getInt(
- YarnConfiguration.DIST_SCHEDULING_INCR_CONTAINER_VCORES,
- YarnConfiguration.DIST_SCHEDULING_INCR_CONTAINER_VCORES_DEFAULT)
- )
- );
- dsResp.setContainerTokenExpiryInterval(
- getConfig().getInt(
- YarnConfiguration.DIST_SCHEDULING_CONTAINER_TOKEN_EXPIRY_MS,
- YarnConfiguration.
- DIST_SCHEDULING_CONTAINER_TOKEN_EXPIRY_MS_DEFAULT));
- dsResp.setContainerIdStart(
- this.rmContext.getEpoch() << ResourceManager.EPOCH_BIT_SHIFT);
-
- // Set nodes to be used for scheduling
- dsResp.setNodesForScheduling(
- this.nodeMonitor.selectLeastLoadedNodes(this.k));
- return dsResp;
- }
-
- @Override
- public DistributedSchedulingAllocateResponse allocateForDistributedScheduling(
- DistributedSchedulingAllocateRequest request)
- throws YarnException, IOException {
- List<Container> distAllocContainers = request.getAllocatedContainers();
- for (Container container : distAllocContainers) {
- // Create RMContainer
- SchedulerApplicationAttempt appAttempt =
- ((AbstractYarnScheduler) rmContext.getScheduler())
- .getCurrentAttemptForContainer(container.getId());
- RMContainer rmContainer = new RMContainerImpl(container,
- appAttempt.getApplicationAttemptId(), container.getNodeId(),
- appAttempt.getUser(), rmContext, true);
- appAttempt.addRMContainer(container.getId(), rmContainer);
- rmContainer.handle(
- new RMContainerEvent(container.getId(),
- RMContainerEventType.LAUNCHED));
- }
- AllocateResponse response = allocate(request.getAllocateRequest());
- DistributedSchedulingAllocateResponse dsResp = recordFactory
- .newRecordInstance(DistributedSchedulingAllocateResponse.class);
- dsResp.setAllocateResponse(response);
- dsResp.setNodesForScheduling(
- this.nodeMonitor.selectLeastLoadedNodes(this.k));
- return dsResp;
- }
-
- private void addToMapping(ConcurrentHashMap<String, Set<NodeId>> mapping,
- String rackName, NodeId nodeId) {
- if (rackName != null) {
- mapping.putIfAbsent(rackName, new HashSet<NodeId>());
- Set<NodeId> nodeIds = mapping.get(rackName);
- synchronized (nodeIds) {
- nodeIds.add(nodeId);
- }
- }
- }
-
- private void removeFromMapping(ConcurrentHashMap<String, Set<NodeId>> mapping,
- String rackName, NodeId nodeId) {
- if (rackName != null) {
- Set<NodeId> nodeIds = mapping.get(rackName);
- synchronized (nodeIds) {
- nodeIds.remove(nodeId);
- }
- }
- }
-
- @Override
- public void handle(SchedulerEvent event) {
- switch (event.getType()) {
- case NODE_ADDED:
- if (!(event instanceof NodeAddedSchedulerEvent)) {
- throw new RuntimeException("Unexpected event type: " + event);
- }
- NodeAddedSchedulerEvent nodeAddedEvent = (NodeAddedSchedulerEvent) event;
- nodeMonitor.addNode(nodeAddedEvent.getContainerReports(),
- nodeAddedEvent.getAddedRMNode());
- addToMapping(rackToNode, nodeAddedEvent.getAddedRMNode().getRackName(),
- nodeAddedEvent.getAddedRMNode().getNodeID());
- addToMapping(hostToNode, nodeAddedEvent.getAddedRMNode().getHostName(),
- nodeAddedEvent.getAddedRMNode().getNodeID());
- break;
- case NODE_REMOVED:
- if (!(event instanceof NodeRemovedSchedulerEvent)) {
- throw new RuntimeException("Unexpected event type: " + event);
- }
- NodeRemovedSchedulerEvent nodeRemovedEvent =
- (NodeRemovedSchedulerEvent) event;
- nodeMonitor.removeNode(nodeRemovedEvent.getRemovedRMNode());
- removeFromMapping(rackToNode,
- nodeRemovedEvent.getRemovedRMNode().getRackName(),
- nodeRemovedEvent.getRemovedRMNode().getNodeID());
- removeFromMapping(hostToNode,
- nodeRemovedEvent.getRemovedRMNode().getHostName(),
- nodeRemovedEvent.getRemovedRMNode().getNodeID());
- break;
- case NODE_UPDATE:
- if (!(event instanceof NodeUpdateSchedulerEvent)) {
- throw new RuntimeException("Unexpected event type: " + event);
- }
- NodeUpdateSchedulerEvent nodeUpdatedEvent = (NodeUpdateSchedulerEvent)
- event;
- nodeMonitor.updateNode(nodeUpdatedEvent.getRMNode());
- break;
- case NODE_RESOURCE_UPDATE:
- if (!(event instanceof NodeResourceUpdateSchedulerEvent)) {
- throw new RuntimeException("Unexpected event type: " + event);
- }
- NodeResourceUpdateSchedulerEvent nodeResourceUpdatedEvent =
- (NodeResourceUpdateSchedulerEvent) event;
- nodeMonitor.updateNodeResource(nodeResourceUpdatedEvent.getRMNode(),
- nodeResourceUpdatedEvent.getResourceOption());
- break;
-
- // <-- IGNORED EVENTS : START -->
- case APP_ADDED:
- break;
- case APP_REMOVED:
- break;
- case APP_ATTEMPT_ADDED:
- break;
- case APP_ATTEMPT_REMOVED:
- break;
- case CONTAINER_EXPIRED:
- break;
- case NODE_LABELS_UPDATE:
- break;
- // <-- IGNORED EVENTS : END -->
- default:
- LOG.error("Unknown event arrived at DistributedSchedulingAMService: "
- + event.toString());
- }
-
- }
-
- public QueueLimitCalculator getNodeManagerQueueLimitCalculator() {
- return nodeMonitor.getThresholdCalculator();
- }
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/82c9e061/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/OpportunisticContainerAllocatorAMService.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/OpportunisticContainerAllocatorAMService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/OpportunisticContainerAllocatorAMService.java
new file mode 100644
index 0000000..a473b14
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/OpportunisticContainerAllocatorAMService.java
@@ -0,0 +1,367 @@
+/**
+ * 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.hadoop.yarn.server.resourcemanager;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.ipc.RPC;
+import org.apache.hadoop.ipc.Server;
+import org.apache.hadoop.yarn.api.ApplicationMasterProtocolPB;
+import org.apache.hadoop.yarn.api.records.Container;
+import org.apache.hadoop.yarn.api.records.NodeId;
+import org.apache.hadoop.yarn.event.EventHandler;
+import org.apache.hadoop.yarn.server.api.DistributedSchedulingAMProtocol;
+import org.apache.hadoop.yarn.api.impl.pb.service.ApplicationMasterProtocolPBServiceImpl;
+
+
+import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse;
+import org.apache.hadoop.yarn.server.api.protocolrecords.DistributedSchedulingAllocateRequest;
+import org.apache.hadoop.yarn.server.api.protocolrecords.DistributedSchedulingAllocateResponse;
+import org.apache.hadoop.yarn.server.api.protocolrecords.RegisterDistributedSchedulingAMResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse;
+
+import org.apache.hadoop.yarn.api.records.Resource;
+import org.apache.hadoop.yarn.conf.YarnConfiguration;
+import org.apache.hadoop.yarn.exceptions.YarnException;
+import org.apache.hadoop.yarn.ipc.YarnRPC;
+import org.apache.hadoop.yarn.proto.ApplicationMasterProtocol.ApplicationMasterProtocolService;
+
+import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer;
+import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerEventType;
+import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerImpl;
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler;
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt;
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler;
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.distributed.NodeQueueLoadMonitor;
+
+
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.distributed.QueueLimitCalculator;
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeAddedSchedulerEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeRemovedSchedulerEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeResourceUpdateSchedulerEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeUpdateSchedulerEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.security.AMRMTokenSecretManager;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * The OpportunisticContainerAllocatorAMService is started instead of the
+ * ApplicationMasterService if distributed scheduling is enabled for the YARN
+ * cluster.
+ * It extends the functionality of the ApplicationMasterService by servicing
+ * clients (AMs and AMRMProxy request interceptors) that understand the
+ * DistributedSchedulingProtocol.
+ */
+public class OpportunisticContainerAllocatorAMService
+ extends ApplicationMasterService implements DistributedSchedulingAMProtocol,
+ EventHandler<SchedulerEvent> {
+
+ private static final Log LOG =
+ LogFactory.getLog(OpportunisticContainerAllocatorAMService.class);
+
+ private final NodeQueueLoadMonitor nodeMonitor;
+
+ private final ConcurrentHashMap<String, Set<NodeId>> rackToNode =
+ new ConcurrentHashMap<>();
+ private final ConcurrentHashMap<String, Set<NodeId>> hostToNode =
+ new ConcurrentHashMap<>();
+ private final int k;
+
+ public OpportunisticContainerAllocatorAMService(RMContext rmContext,
+ YarnScheduler scheduler) {
+ super(OpportunisticContainerAllocatorAMService.class.getName(),
+ rmContext, scheduler);
+ this.k = rmContext.getYarnConfiguration().getInt(
+ YarnConfiguration.OPP_CONTAINER_ALLOCATION_NODES_NUMBER_USED,
+ YarnConfiguration.OPP_CONTAINER_ALLOCATION_NODES_NUMBER_USED_DEFAULT);
+ long nodeSortInterval = rmContext.getYarnConfiguration().getLong(
+ YarnConfiguration.NM_CONTAINER_QUEUING_SORTING_NODES_INTERVAL_MS,
+ YarnConfiguration.
+ NM_CONTAINER_QUEUING_SORTING_NODES_INTERVAL_MS_DEFAULT);
+ NodeQueueLoadMonitor.LoadComparator comparator =
+ NodeQueueLoadMonitor.LoadComparator.valueOf(
+ rmContext.getYarnConfiguration().get(
+ YarnConfiguration.NM_CONTAINER_QUEUING_LOAD_COMPARATOR,
+ YarnConfiguration.
+ NM_CONTAINER_QUEUING_LOAD_COMPARATOR_DEFAULT));
+
+ NodeQueueLoadMonitor topKSelector =
+ new NodeQueueLoadMonitor(nodeSortInterval, comparator);
+
+ float sigma = rmContext.getYarnConfiguration()
+ .getFloat(YarnConfiguration.NM_CONTAINER_QUEUING_LIMIT_STDEV,
+ YarnConfiguration.NM_CONTAINER_QUEUING_LIMIT_STDEV_DEFAULT);
+
+ int limitMin, limitMax;
+
+ if (comparator == NodeQueueLoadMonitor.LoadComparator.QUEUE_LENGTH) {
+ limitMin = rmContext.getYarnConfiguration()
+ .getInt(YarnConfiguration.NM_CONTAINER_QUEUING_MIN_QUEUE_LENGTH,
+ YarnConfiguration.
+ NM_CONTAINER_QUEUING_MIN_QUEUE_LENGTH_DEFAULT);
+ limitMax = rmContext.getYarnConfiguration()
+ .getInt(YarnConfiguration.NM_CONTAINER_QUEUING_MAX_QUEUE_LENGTH,
+ YarnConfiguration.
+ NM_CONTAINER_QUEUING_MAX_QUEUE_LENGTH_DEFAULT);
+ } else {
+ limitMin = rmContext.getYarnConfiguration()
+ .getInt(
+ YarnConfiguration.NM_CONTAINER_QUEUING_MIN_QUEUE_WAIT_TIME_MS,
+ YarnConfiguration.
+ NM_CONTAINER_QUEUING_MIN_QUEUE_WAIT_TIME_MS_DEFAULT);
+ limitMax = rmContext.getYarnConfiguration()
+ .getInt(
+ YarnConfiguration.NM_CONTAINER_QUEUING_MAX_QUEUE_WAIT_TIME_MS,
+ YarnConfiguration.
+ NM_CONTAINER_QUEUING_MAX_QUEUE_WAIT_TIME_MS_DEFAULT);
+ }
+
+ topKSelector.initThresholdCalculator(sigma, limitMin, limitMax);
+ this.nodeMonitor = topKSelector;
+ }
+
+ @Override
+ public Server getServer(YarnRPC rpc, Configuration serverConf,
+ InetSocketAddress addr, AMRMTokenSecretManager secretManager) {
+ if (YarnConfiguration.isDistSchedulingEnabled(serverConf)) {
+ Server server = rpc.getServer(DistributedSchedulingAMProtocol.class, this,
+ addr, serverConf, secretManager,
+ serverConf.getInt(YarnConfiguration.RM_SCHEDULER_CLIENT_THREAD_COUNT,
+ YarnConfiguration.DEFAULT_RM_SCHEDULER_CLIENT_THREAD_COUNT));
+ // To support application running on NMs that DO NOT support
+ // Dist Scheduling... The server multiplexes both the
+ // ApplicationMasterProtocol as well as the DistributedSchedulingProtocol
+ ((RPC.Server) server).addProtocol(RPC.RpcKind.RPC_PROTOCOL_BUFFER,
+ ApplicationMasterProtocolPB.class,
+ ApplicationMasterProtocolService.newReflectiveBlockingService(
+ new ApplicationMasterProtocolPBServiceImpl(this)));
+ return server;
+ }
+ return super.getServer(rpc, serverConf, addr, secretManager);
+ }
+
+ @Override
+ public RegisterApplicationMasterResponse registerApplicationMaster
+ (RegisterApplicationMasterRequest request) throws YarnException,
+ IOException {
+ return super.registerApplicationMaster(request);
+ }
+
+ @Override
+ public FinishApplicationMasterResponse finishApplicationMaster
+ (FinishApplicationMasterRequest request) throws YarnException,
+ IOException {
+ return super.finishApplicationMaster(request);
+ }
+
+ @Override
+ public AllocateResponse allocate(AllocateRequest request) throws
+ YarnException, IOException {
+ return super.allocate(request);
+ }
+
+ @Override
+ public RegisterDistributedSchedulingAMResponse
+ registerApplicationMasterForDistributedScheduling(
+ RegisterApplicationMasterRequest request) throws YarnException,
+ IOException {
+ RegisterApplicationMasterResponse response =
+ registerApplicationMaster(request);
+ RegisterDistributedSchedulingAMResponse dsResp = recordFactory
+ .newRecordInstance(RegisterDistributedSchedulingAMResponse.class);
+ dsResp.setRegisterResponse(response);
+ dsResp.setMinContainerResource(
+ Resource.newInstance(
+ getConfig().getInt(
+ YarnConfiguration.OPPORTUNISTIC_CONTAINERS_MIN_MEMORY_MB,
+ YarnConfiguration.
+ OPPORTUNISTIC_CONTAINERS_MIN_MEMORY_MB_DEFAULT),
+ getConfig().getInt(
+ YarnConfiguration.OPPORTUNISTIC_CONTAINERS_MIN_VCORES,
+ YarnConfiguration.OPPORTUNISTIC_CONTAINERS_MIN_VCORES_DEFAULT)
+ )
+ );
+ dsResp.setMaxContainerResource(
+ Resource.newInstance(
+ getConfig().getInt(
+ YarnConfiguration.OPPORTUNISTIC_CONTAINERS_MAX_MEMORY_MB,
+ YarnConfiguration
+ .OPPORTUNISTIC_CONTAINERS_MAX_MEMORY_MB_DEFAULT),
+ getConfig().getInt(
+ YarnConfiguration.OPPORTUNISTIC_CONTAINERS_MAX_VCORES,
+ YarnConfiguration.OPPORTUNISTIC_CONTAINERS_MAX_VCORES_DEFAULT)
+ )
+ );
+ dsResp.setIncrContainerResource(
+ Resource.newInstance(
+ getConfig().getInt(
+ YarnConfiguration.OPPORTUNISTIC_CONTAINERS_INCR_MEMORY_MB,
+ YarnConfiguration.
+ OPPORTUNISTIC_CONTAINERS_INCR_MEMORY_MB_DEFAULT),
+ getConfig().getInt(
+ YarnConfiguration.OPPORTUNISTIC_CONTAINERS_INCR_VCORES,
+ YarnConfiguration.OPPORTUNISTIC_CONTAINERS_INCR_VCORES_DEFAULT)
+ )
+ );
+ dsResp.setContainerTokenExpiryInterval(
+ getConfig().getInt(
+ YarnConfiguration.OPPORTUNISTIC_CONTAINERS_TOKEN_EXPIRY_MS,
+ YarnConfiguration.
+ OPPORTUNISTIC_CONTAINERS_TOKEN_EXPIRY_MS_DEFAULT));
+ dsResp.setContainerIdStart(
+ this.rmContext.getEpoch() << ResourceManager.EPOCH_BIT_SHIFT);
+
+ // Set nodes to be used for scheduling
+ dsResp.setNodesForScheduling(
+ this.nodeMonitor.selectLeastLoadedNodes(this.k));
+ return dsResp;
+ }
+
+ @Override
+ public DistributedSchedulingAllocateResponse allocateForDistributedScheduling(
+ DistributedSchedulingAllocateRequest request)
+ throws YarnException, IOException {
+ List<Container> distAllocContainers = request.getAllocatedContainers();
+ for (Container container : distAllocContainers) {
+ // Create RMContainer
+ SchedulerApplicationAttempt appAttempt =
+ ((AbstractYarnScheduler) rmContext.getScheduler())
+ .getCurrentAttemptForContainer(container.getId());
+ RMContainer rmContainer = new RMContainerImpl(container,
+ appAttempt.getApplicationAttemptId(), container.getNodeId(),
+ appAttempt.getUser(), rmContext, true);
+ appAttempt.addRMContainer(container.getId(), rmContainer);
+ rmContainer.handle(
+ new RMContainerEvent(container.getId(),
+ RMContainerEventType.LAUNCHED));
+ }
+ AllocateResponse response = allocate(request.getAllocateRequest());
+ DistributedSchedulingAllocateResponse dsResp = recordFactory
+ .newRecordInstance(DistributedSchedulingAllocateResponse.class);
+ dsResp.setAllocateResponse(response);
+ dsResp.setNodesForScheduling(
+ this.nodeMonitor.selectLeastLoadedNodes(this.k));
+ return dsResp;
+ }
+
+ private void addToMapping(ConcurrentHashMap<String, Set<NodeId>> mapping,
+ String rackName, NodeId nodeId) {
+ if (rackName != null) {
+ mapping.putIfAbsent(rackName, new HashSet<NodeId>());
+ Set<NodeId> nodeIds = mapping.get(rackName);
+ synchronized (nodeIds) {
+ nodeIds.add(nodeId);
+ }
+ }
+ }
+
+ private void removeFromMapping(ConcurrentHashMap<String, Set<NodeId>> mapping,
+ String rackName, NodeId nodeId) {
+ if (rackName != null) {
+ Set<NodeId> nodeIds = mapping.get(rackName);
+ synchronized (nodeIds) {
+ nodeIds.remove(nodeId);
+ }
+ }
+ }
+
+ @Override
+ public void handle(SchedulerEvent event) {
+ switch (event.getType()) {
+ case NODE_ADDED:
+ if (!(event instanceof NodeAddedSchedulerEvent)) {
+ throw new RuntimeException("Unexpected event type: " + event);
+ }
+ NodeAddedSchedulerEvent nodeAddedEvent = (NodeAddedSchedulerEvent) event;
+ nodeMonitor.addNode(nodeAddedEvent.getContainerReports(),
+ nodeAddedEvent.getAddedRMNode());
+ addToMapping(rackToNode, nodeAddedEvent.getAddedRMNode().getRackName(),
+ nodeAddedEvent.getAddedRMNode().getNodeID());
+ addToMapping(hostToNode, nodeAddedEvent.getAddedRMNode().getHostName(),
+ nodeAddedEvent.getAddedRMNode().getNodeID());
+ break;
+ case NODE_REMOVED:
+ if (!(event instanceof NodeRemovedSchedulerEvent)) {
+ throw new RuntimeException("Unexpected event type: " + event);
+ }
+ NodeRemovedSchedulerEvent nodeRemovedEvent =
+ (NodeRemovedSchedulerEvent) event;
+ nodeMonitor.removeNode(nodeRemovedEvent.getRemovedRMNode());
+ removeFromMapping(rackToNode,
+ nodeRemovedEvent.getRemovedRMNode().getRackName(),
+ nodeRemovedEvent.getRemovedRMNode().getNodeID());
+ removeFromMapping(hostToNode,
+ nodeRemovedEvent.getRemovedRMNode().getHostName(),
+ nodeRemovedEvent.getRemovedRMNode().getNodeID());
+ break;
+ case NODE_UPDATE:
+ if (!(event instanceof NodeUpdateSchedulerEvent)) {
+ throw new RuntimeException("Unexpected event type: " + event);
+ }
+ NodeUpdateSchedulerEvent nodeUpdatedEvent = (NodeUpdateSchedulerEvent)
+ event;
+ nodeMonitor.updateNode(nodeUpdatedEvent.getRMNode());
+ break;
+ case NODE_RESOURCE_UPDATE:
+ if (!(event instanceof NodeResourceUpdateSchedulerEvent)) {
+ throw new RuntimeException("Unexpected event type: " + event);
+ }
+ NodeResourceUpdateSchedulerEvent nodeResourceUpdatedEvent =
+ (NodeResourceUpdateSchedulerEvent) event;
+ nodeMonitor.updateNodeResource(nodeResourceUpdatedEvent.getRMNode(),
+ nodeResourceUpdatedEvent.getResourceOption());
+ break;
+
+ // <-- IGNORED EVENTS : START -->
+ case APP_ADDED:
+ break;
+ case APP_REMOVED:
+ break;
+ case APP_ATTEMPT_ADDED:
+ break;
+ case APP_ATTEMPT_REMOVED:
+ break;
+ case CONTAINER_EXPIRED:
+ break;
+ case NODE_LABELS_UPDATE:
+ break;
+ // <-- IGNORED EVENTS : END -->
+ default:
+ LOG.error("Unknown event arrived at" +
+ "OpportunisticContainerAllocatorAMService: " + event.toString());
+ }
+
+ }
+
+ public QueueLimitCalculator getNodeManagerQueueLimitCalculator() {
+ return nodeMonitor.getThresholdCalculator();
+ }
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/82c9e061/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java
index 4509045..bf72fc1 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java
@@ -116,7 +116,6 @@ import org.apache.hadoop.yarn.server.webproxy.AppReportFetcher;
import org.apache.hadoop.yarn.server.webproxy.ProxyUriUtils;
import org.apache.hadoop.yarn.server.webproxy.WebAppProxy;
import org.apache.hadoop.yarn.server.webproxy.WebAppProxyServlet;
-import org.apache.hadoop.yarn.util.ConverterUtils;
import org.apache.hadoop.yarn.webapp.WebApp;
import org.apache.hadoop.yarn.webapp.WebApps;
import org.apache.hadoop.yarn.webapp.WebApps.Builder;
@@ -1177,24 +1176,27 @@ public class ResourceManager extends CompositeService implements Recoverable {
}
protected ApplicationMasterService createApplicationMasterService() {
- if (this.rmContext.getYarnConfiguration().getBoolean(
- YarnConfiguration.DIST_SCHEDULING_ENABLED,
- YarnConfiguration.DIST_SCHEDULING_ENABLED_DEFAULT)) {
- DistributedSchedulingAMService distributedSchedulingService = new
- DistributedSchedulingAMService(this.rmContext, scheduler);
- EventDispatcher distSchedulerEventDispatcher =
- new EventDispatcher(distributedSchedulingService,
- DistributedSchedulingAMService.class.getName());
- // Add an event dispatcher for the DistributedSchedulingAMService
- // to handle node updates/additions and removals.
+ Configuration config = this.rmContext.getYarnConfiguration();
+ if (YarnConfiguration.isOpportunisticContainerAllocationEnabled(config)
+ || YarnConfiguration.isDistSchedulingEnabled(config)) {
+ OpportunisticContainerAllocatorAMService
+ oppContainerAllocatingAMService =
+ new OpportunisticContainerAllocatorAMService(this.rmContext,
+ scheduler);
+ EventDispatcher oppContainerAllocEventDispatcher =
+ new EventDispatcher(oppContainerAllocatingAMService,
+ OpportunisticContainerAllocatorAMService.class.getName());
+ // Add an event dispatcher for the
+ // OpportunisticContainerAllocatorAMService to handle node
+ // updates/additions and removals.
// Since the SchedulerEvent is currently a super set of theses,
// we register interest for it..
- addService(distSchedulerEventDispatcher);
+ addService(oppContainerAllocEventDispatcher);
rmDispatcher.register(SchedulerEventType.class,
- distSchedulerEventDispatcher);
+ oppContainerAllocEventDispatcher);
this.rmContext.setContainerQueueLimitCalculator(
- distributedSchedulingService.getNodeManagerQueueLimitCalculator());
- return distributedSchedulingService;
+ oppContainerAllocatingAMService.getNodeManagerQueueLimitCalculator());
+ return oppContainerAllocatingAMService;
}
return new ApplicationMasterService(this.rmContext, scheduler);
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/82c9e061/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java
index 7d1b3c3..5856e59 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java
@@ -820,9 +820,10 @@ public class MockRM extends ResourceManager {
@Override
protected ApplicationMasterService createApplicationMasterService() {
if (this.rmContext.getYarnConfiguration().getBoolean(
- YarnConfiguration.DIST_SCHEDULING_ENABLED,
- YarnConfiguration.DIST_SCHEDULING_ENABLED_DEFAULT)) {
- return new DistributedSchedulingAMService(getRMContext(), scheduler) {
+ YarnConfiguration.OPPORTUNISTIC_CONTAINER_ALLOCATION_ENABLED,
+ YarnConfiguration.OPPORTUNISTIC_CONTAINER_ALLOCATION_ENABLED_DEFAULT)) {
+ return new OpportunisticContainerAllocatorAMService(getRMContext(),
+ scheduler) {
@Override
protected void serviceStart() {
// override to not start rpc handler
http://git-wip-us.apache.org/repos/asf/hadoop/blob/82c9e061/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestDistributedSchedulingAMService.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestDistributedSchedulingAMService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestDistributedSchedulingAMService.java
deleted file mode 100644
index 0213a94..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestDistributedSchedulingAMService.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/**
- * 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.hadoop.yarn.server.resourcemanager;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.ipc.ProtobufRpcEngine;
-import org.apache.hadoop.ipc.RPC;
-import org.apache.hadoop.ipc.Server;
-import org.apache.hadoop.net.NetUtils;
-import org.apache.hadoop.yarn.api.ApplicationMasterProtocolPB;
-import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.AllocateRequestPBImpl;
-import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.AllocateResponsePBImpl;
-import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.FinishApplicationMasterRequestPBImpl;
-import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.FinishApplicationMasterResponsePBImpl;
-import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.RegisterApplicationMasterRequestPBImpl;
-import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.RegisterApplicationMasterResponsePBImpl;
-import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
-import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.hadoop.yarn.api.records.ExecutionTypeRequest;
-import org.apache.hadoop.yarn.api.records.ExecutionType;
-import org.apache.hadoop.yarn.api.records.Priority;
-import org.apache.hadoop.yarn.api.records.Resource;
-import org.apache.hadoop.yarn.api.records.ResourceRequest;
-import org.apache.hadoop.yarn.server.api.DistributedSchedulingAMProtocolPB;
-import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
-import org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse;
-import org.apache.hadoop.yarn.server.api.protocolrecords.DistributedSchedulingAllocateRequest;
-import org.apache.hadoop.yarn.server.api.protocolrecords.DistributedSchedulingAllocateResponse;
-import org.apache.hadoop.yarn.server.api.protocolrecords.RegisterDistributedSchedulingAMResponse;
-import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterRequest;
-import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse;
-import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterRequest;
-import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse;
-
-import org.apache.hadoop.yarn.api.records.NodeId;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.hadoop.yarn.factories.RecordFactory;
-import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
-import org.apache.hadoop.yarn.ipc.HadoopYarnProtoRPC;
-import org.apache.hadoop.yarn.ipc.YarnRPC;
-import org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb.DistributedSchedulingAllocateRequestPBImpl;
-import org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb.DistributedSchedulingAllocateResponsePBImpl;
-import org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb.RegisterDistributedSchedulingAMResponsePBImpl;
-import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.AMLivelinessMonitor;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Test cases for {@link DistributedSchedulingAMService}.
- */
-public class TestDistributedSchedulingAMService {
-
- // Test if the DistributedSchedulingAMService can handle both DSProtocol as
- // well as AMProtocol clients
- @Test
- public void testRPCWrapping() throws Exception {
- Configuration conf = new Configuration();
- conf.set(YarnConfiguration.IPC_RPC_IMPL, HadoopYarnProtoRPC.class
- .getName());
- YarnRPC rpc = YarnRPC.create(conf);
- String bindAddr = "localhost:0";
- InetSocketAddress addr = NetUtils.createSocketAddr(bindAddr);
- conf.setSocketAddr(YarnConfiguration.RM_SCHEDULER_ADDRESS, addr);
- final RecordFactory factory = RecordFactoryProvider.getRecordFactory(null);
- final RMContext rmContext = new RMContextImpl() {
- @Override
- public AMLivelinessMonitor getAMLivelinessMonitor() {
- return null;
- }
-
- @Override
- public Configuration getYarnConfiguration() {
- return new YarnConfiguration();
- }
- };
- Container c = factory.newRecordInstance(Container.class);
- c.setExecutionType(ExecutionType.OPPORTUNISTIC);
- c.setId(
- ContainerId.newContainerId(
- ApplicationAttemptId.newInstance(
- ApplicationId.newInstance(12345, 1), 2), 3));
- AllocateRequest allReq =
- (AllocateRequestPBImpl)factory.newRecordInstance(AllocateRequest.class);
- allReq.setAskList(Arrays.asList(
- ResourceRequest.newInstance(Priority.UNDEFINED, "a",
- Resource.newInstance(1, 2), 1, true, "exp",
- ExecutionTypeRequest.newInstance(
- ExecutionType.OPPORTUNISTIC, true))));
- DistributedSchedulingAMService service =
- createService(factory, rmContext, c);
- Server server = service.getServer(rpc, conf, addr, null);
- server.start();
-
- // Verify that the DistrubutedSchedulingService can handle vanilla
- // ApplicationMasterProtocol clients
- RPC.setProtocolEngine(conf, ApplicationMasterProtocolPB.class,
- ProtobufRpcEngine.class);
- ApplicationMasterProtocolPB ampProxy =
- RPC.getProxy(ApplicationMasterProtocolPB
- .class, 1, NetUtils.getConnectAddress(server), conf);
- RegisterApplicationMasterResponse regResp =
- new RegisterApplicationMasterResponsePBImpl(
- ampProxy.registerApplicationMaster(null,
- ((RegisterApplicationMasterRequestPBImpl)factory
- .newRecordInstance(
- RegisterApplicationMasterRequest.class)).getProto()));
- Assert.assertEquals("dummyQueue", regResp.getQueue());
- FinishApplicationMasterResponse finishResp =
- new FinishApplicationMasterResponsePBImpl(
- ampProxy.finishApplicationMaster(null,
- ((FinishApplicationMasterRequestPBImpl)factory
- .newRecordInstance(
- FinishApplicationMasterRequest.class)).getProto()
- ));
- Assert.assertEquals(false, finishResp.getIsUnregistered());
- AllocateResponse allocResp =
- new AllocateResponsePBImpl(
- ampProxy.allocate(null,
- ((AllocateRequestPBImpl)factory
- .newRecordInstance(AllocateRequest.class)).getProto())
- );
- List<Container> allocatedContainers = allocResp.getAllocatedContainers();
- Assert.assertEquals(1, allocatedContainers.size());
- Assert.assertEquals(ExecutionType.OPPORTUNISTIC,
- allocatedContainers.get(0).getExecutionType());
- Assert.assertEquals(12345, allocResp.getNumClusterNodes());
-
-
- // Verify that the DistrubutedSchedulingService can handle the
- // DistributedSchedulingAMProtocol clients as well
- RPC.setProtocolEngine(conf, DistributedSchedulingAMProtocolPB.class,
- ProtobufRpcEngine.class);
- DistributedSchedulingAMProtocolPB dsProxy =
- RPC.getProxy(DistributedSchedulingAMProtocolPB
- .class, 1, NetUtils.getConnectAddress(server), conf);
-
- RegisterDistributedSchedulingAMResponse dsRegResp =
- new RegisterDistributedSchedulingAMResponsePBImpl(
- dsProxy.registerApplicationMasterForDistributedScheduling(null,
- ((RegisterApplicationMasterRequestPBImpl)factory
- .newRecordInstance(RegisterApplicationMasterRequest.class))
- .getProto()));
- Assert.assertEquals(54321l, dsRegResp.getContainerIdStart());
- Assert.assertEquals(4,
- dsRegResp.getMaxContainerResource().getVirtualCores());
- Assert.assertEquals(1024,
- dsRegResp.getMinContainerResource().getMemorySize());
- Assert.assertEquals(2,
- dsRegResp.getIncrContainerResource().getVirtualCores());
-
- DistributedSchedulingAllocateRequestPBImpl distAllReq =
- (DistributedSchedulingAllocateRequestPBImpl)factory.newRecordInstance(
- DistributedSchedulingAllocateRequest.class);
- distAllReq.setAllocateRequest(allReq);
- distAllReq.setAllocatedContainers(Arrays.asList(c));
- DistributedSchedulingAllocateResponse dsAllocResp =
- new DistributedSchedulingAllocateResponsePBImpl(
- dsProxy.allocateForDistributedScheduling(null,
- distAllReq.getProto()));
- Assert.assertEquals(
- "h1", dsAllocResp.getNodesForScheduling().get(0).getHost());
-
- FinishApplicationMasterResponse dsfinishResp =
- new FinishApplicationMasterResponsePBImpl(
- dsProxy.finishApplicationMaster(null,
- ((FinishApplicationMasterRequestPBImpl) factory
- .newRecordInstance(FinishApplicationMasterRequest.class))
- .getProto()));
- Assert.assertEquals(
- false, dsfinishResp.getIsUnregistered());
- }
-
- private DistributedSchedulingAMService createService(final RecordFactory
- factory, final RMContext rmContext, final Container c) {
- return new DistributedSchedulingAMService(rmContext, null) {
- @Override
- public RegisterApplicationMasterResponse registerApplicationMaster(
- RegisterApplicationMasterRequest request) throws
- YarnException, IOException {
- RegisterApplicationMasterResponse resp = factory.newRecordInstance(
- RegisterApplicationMasterResponse.class);
- // Dummy Entry to Assert that we get this object back
- resp.setQueue("dummyQueue");
- return resp;
- }
-
- @Override
- public FinishApplicationMasterResponse finishApplicationMaster(
- FinishApplicationMasterRequest request) throws YarnException,
- IOException {
- FinishApplicationMasterResponse resp = factory.newRecordInstance(
- FinishApplicationMasterResponse.class);
- // Dummy Entry to Assert that we get this object back
- resp.setIsUnregistered(false);
- return resp;
- }
-
- @Override
- public AllocateResponse allocate(AllocateRequest request) throws
- YarnException, IOException {
- AllocateResponse response = factory.newRecordInstance(
- AllocateResponse.class);
- response.setNumClusterNodes(12345);
- response.setAllocatedContainers(Arrays.asList(c));
- return response;
- }
-
- @Override
- public RegisterDistributedSchedulingAMResponse
- registerApplicationMasterForDistributedScheduling(
- RegisterApplicationMasterRequest request)
- throws YarnException, IOException {
- RegisterDistributedSchedulingAMResponse resp = factory
- .newRecordInstance(RegisterDistributedSchedulingAMResponse.class);
- resp.setContainerIdStart(54321L);
- resp.setMaxContainerResource(Resource.newInstance(4096, 4));
- resp.setMinContainerResource(Resource.newInstance(1024, 1));
- resp.setIncrContainerResource(Resource.newInstance(2048, 2));
- return resp;
- }
-
- @Override
- public DistributedSchedulingAllocateResponse
- allocateForDistributedScheduling(
- DistributedSchedulingAllocateRequest request)
- throws YarnException, IOException {
- List<ResourceRequest> askList =
- request.getAllocateRequest().getAskList();
- List<Container> allocatedContainers = request.getAllocatedContainers();
- Assert.assertEquals(1, allocatedContainers.size());
- Assert.assertEquals(ExecutionType.OPPORTUNISTIC,
- allocatedContainers.get(0).getExecutionType());
- Assert.assertEquals(1, askList.size());
- Assert.assertTrue(askList.get(0)
- .getExecutionTypeRequest().getEnforceExecutionType());
- DistributedSchedulingAllocateResponse resp = factory
- .newRecordInstance(DistributedSchedulingAllocateResponse.class);
- resp.setNodesForScheduling(
- Arrays.asList(NodeId.newInstance("h1", 1234)));
- return resp;
- }
- };
- }
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/82c9e061/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestOpportunisticContainerAllocatorAMService.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestOpportunisticContainerAllocatorAMService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestOpportunisticContainerAllocatorAMService.java
new file mode 100644
index 0000000..07c6b54
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestOpportunisticContainerAllocatorAMService.java
@@ -0,0 +1,271 @@
+/**
+ * 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.hadoop.yarn.server.resourcemanager;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.ipc.ProtobufRpcEngine;
+import org.apache.hadoop.ipc.RPC;
+import org.apache.hadoop.ipc.Server;
+import org.apache.hadoop.net.NetUtils;
+import org.apache.hadoop.yarn.api.ApplicationMasterProtocolPB;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.AllocateRequestPBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.AllocateResponsePBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.FinishApplicationMasterRequestPBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.FinishApplicationMasterResponsePBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.RegisterApplicationMasterRequestPBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.RegisterApplicationMasterResponsePBImpl;
+import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
+import org.apache.hadoop.yarn.api.records.ApplicationId;
+import org.apache.hadoop.yarn.api.records.Container;
+import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.hadoop.yarn.api.records.ExecutionTypeRequest;
+import org.apache.hadoop.yarn.api.records.ExecutionType;
+import org.apache.hadoop.yarn.api.records.Priority;
+import org.apache.hadoop.yarn.api.records.Resource;
+import org.apache.hadoop.yarn.api.records.ResourceRequest;
+import org.apache.hadoop.yarn.server.api.DistributedSchedulingAMProtocolPB;
+import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse;
+import org.apache.hadoop.yarn.server.api.protocolrecords.DistributedSchedulingAllocateRequest;
+import org.apache.hadoop.yarn.server.api.protocolrecords.DistributedSchedulingAllocateResponse;
+import org.apache.hadoop.yarn.server.api.protocolrecords.RegisterDistributedSchedulingAMResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse;
+
+import org.apache.hadoop.yarn.api.records.NodeId;
+import org.apache.hadoop.yarn.conf.YarnConfiguration;
+import org.apache.hadoop.yarn.exceptions.YarnException;
+import org.apache.hadoop.yarn.factories.RecordFactory;
+import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
+import org.apache.hadoop.yarn.ipc.HadoopYarnProtoRPC;
+import org.apache.hadoop.yarn.ipc.YarnRPC;
+import org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb.DistributedSchedulingAllocateRequestPBImpl;
+import org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb.DistributedSchedulingAllocateResponsePBImpl;
+import org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb.RegisterDistributedSchedulingAMResponsePBImpl;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.AMLivelinessMonitor;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Test cases for {@link OpportunisticContainerAllocatorAMService}.
+ */
+public class TestOpportunisticContainerAllocatorAMService {
+
+ // Test if the OpportunisticContainerAllocatorAMService can handle both
+ // DSProtocol as well as AMProtocol clients
+ @Test
+ public void testRPCWrapping() throws Exception {
+ Configuration conf = new Configuration();
+ conf.set(YarnConfiguration.IPC_RPC_IMPL, HadoopYarnProtoRPC.class
+ .getName());
+ YarnRPC rpc = YarnRPC.create(conf);
+ String bindAddr = "localhost:0";
+ InetSocketAddress addr = NetUtils.createSocketAddr(bindAddr);
+ conf.setSocketAddr(YarnConfiguration.RM_SCHEDULER_ADDRESS, addr);
+ final RecordFactory factory = RecordFactoryProvider.getRecordFactory(null);
+ final RMContext rmContext = new RMContextImpl() {
+ @Override
+ public AMLivelinessMonitor getAMLivelinessMonitor() {
+ return null;
+ }
+
+ @Override
+ public Configuration getYarnConfiguration() {
+ return new YarnConfiguration();
+ }
+ };
+ Container c = factory.newRecordInstance(Container.class);
+ c.setExecutionType(ExecutionType.OPPORTUNISTIC);
+ c.setId(
+ ContainerId.newContainerId(
+ ApplicationAttemptId.newInstance(
+ ApplicationId.newInstance(12345, 1), 2), 3));
+ AllocateRequest allReq =
+ (AllocateRequestPBImpl)factory.newRecordInstance(AllocateRequest.class);
+ allReq.setAskList(Arrays.asList(
+ ResourceRequest.newInstance(Priority.UNDEFINED, "a",
+ Resource.newInstance(1, 2), 1, true, "exp",
+ ExecutionTypeRequest.newInstance(
+ ExecutionType.OPPORTUNISTIC, true))));
+ OpportunisticContainerAllocatorAMService service =
+ createService(factory, rmContext, c);
+ conf.setBoolean(YarnConfiguration.DIST_SCHEDULING_ENABLED, true);
+ Server server = service.getServer(rpc, conf, addr, null);
+ server.start();
+
+ // Verify that the DistrubutedSchedulingService can handle vanilla
+ // ApplicationMasterProtocol clients
+ RPC.setProtocolEngine(conf, ApplicationMasterProtocolPB.class,
+ ProtobufRpcEngine.class);
+ ApplicationMasterProtocolPB ampProxy =
+ RPC.getProxy(ApplicationMasterProtocolPB
+ .class, 1, NetUtils.getConnectAddress(server), conf);
+ RegisterApplicationMasterResponse regResp =
+ new RegisterApplicationMasterResponsePBImpl(
+ ampProxy.registerApplicationMaster(null,
+ ((RegisterApplicationMasterRequestPBImpl)factory
+ .newRecordInstance(
+ RegisterApplicationMasterRequest.class)).getProto()));
+ Assert.assertEquals("dummyQueue", regResp.getQueue());
+ FinishApplicationMasterResponse finishResp =
+ new FinishApplicationMasterResponsePBImpl(
+ ampProxy.finishApplicationMaster(null,
+ ((FinishApplicationMasterRequestPBImpl)factory
+ .newRecordInstance(
+ FinishApplicationMasterRequest.class)).getProto()
+ ));
+ Assert.assertEquals(false, finishResp.getIsUnregistered());
+ AllocateResponse allocResp =
+ new AllocateResponsePBImpl(
+ ampProxy.allocate(null,
+ ((AllocateRequestPBImpl)factory
+ .newRecordInstance(AllocateRequest.class)).getProto())
+ );
+ List<Container> allocatedContainers = allocResp.getAllocatedContainers();
+ Assert.assertEquals(1, allocatedContainers.size());
+ Assert.assertEquals(ExecutionType.OPPORTUNISTIC,
+ allocatedContainers.get(0).getExecutionType());
+ Assert.assertEquals(12345, allocResp.getNumClusterNodes());
+
+
+ // Verify that the DistrubutedSchedulingService can handle the
+ // DistributedSchedulingAMProtocol clients as well
+ RPC.setProtocolEngine(conf, DistributedSchedulingAMProtocolPB.class,
+ ProtobufRpcEngine.class);
+ DistributedSchedulingAMProtocolPB dsProxy =
+ RPC.getProxy(DistributedSchedulingAMProtocolPB
+ .class, 1, NetUtils.getConnectAddress(server), conf);
+
+ RegisterDistributedSchedulingAMResponse dsRegResp =
+ new RegisterDistributedSchedulingAMResponsePBImpl(
+ dsProxy.registerApplicationMasterForDistributedScheduling(null,
+ ((RegisterApplicationMasterRequestPBImpl)factory
+ .newRecordInstance(RegisterApplicationMasterRequest.class))
+ .getProto()));
+ Assert.assertEquals(54321l, dsRegResp.getContainerIdStart());
+ Assert.assertEquals(4,
+ dsRegResp.getMaxContainerResource().getVirtualCores());
+ Assert.assertEquals(1024,
+ dsRegResp.getMinContainerResource().getMemorySize());
+ Assert.assertEquals(2,
+ dsRegResp.getIncrContainerResource().getVirtualCores());
+
+ DistributedSchedulingAllocateRequestPBImpl distAllReq =
+ (DistributedSchedulingAllocateRequestPBImpl)factory.newRecordInstance(
+ DistributedSchedulingAllocateRequest.class);
+ distAllReq.setAllocateRequest(allReq);
+ distAllReq.setAllocatedContainers(Arrays.asList(c));
+ DistributedSchedulingAllocateResponse dsAllocResp =
+ new DistributedSchedulingAllocateResponsePBImpl(
+ dsProxy.allocateForDistributedScheduling(null,
+ distAllReq.getProto()));
+ Assert.assertEquals(
+ "h1", dsAllocResp.getNodesForScheduling().get(0).getHost());
+
+ FinishApplicationMasterResponse dsfinishResp =
+ new FinishApplicationMasterResponsePBImpl(
+ dsProxy.finishApplicationMaster(null,
+ ((FinishApplicationMasterRequestPBImpl) factory
+ .newRecordInstance(FinishApplicationMasterRequest.class))
+ .getProto()));
+ Assert.assertEquals(
+ false, dsfinishResp.getIsUnregistered());
+ }
+
+ private OpportunisticContainerAllocatorAMService createService(
+ final RecordFactory factory, final RMContext rmContext,
+ final Container c) {
+ return new OpportunisticContainerAllocatorAMService(rmContext, null) {
+ @Override
+ public RegisterApplicationMasterResponse registerApplicationMaster(
+ RegisterApplicationMasterRequest request) throws
+ YarnException, IOException {
+ RegisterApplicationMasterResponse resp = factory.newRecordInstance(
+ RegisterApplicationMasterResponse.class);
+ // Dummy Entry to Assert that we get this object back
+ resp.setQueue("dummyQueue");
+ return resp;
+ }
+
+ @Override
+ public FinishApplicationMasterResponse finishApplicationMaster(
+ FinishApplicationMasterRequest request) throws YarnException,
+ IOException {
+ FinishApplicationMasterResponse resp = factory.newRecordInstance(
+ FinishApplicationMasterResponse.class);
+ // Dummy Entry to Assert that we get this object back
+ resp.setIsUnregistered(false);
+ return resp;
+ }
+
+ @Override
+ public AllocateResponse allocate(AllocateRequest request) throws
+ YarnException, IOException {
+ AllocateResponse response = factory.newRecordInstance(
+ AllocateResponse.class);
+ response.setNumClusterNodes(12345);
+ response.setAllocatedContainers(Arrays.asList(c));
+ return response;
+ }
+
+ @Override
+ public RegisterDistributedSchedulingAMResponse
+ registerApplicationMasterForDistributedScheduling(
+ RegisterApplicationMasterRequest request)
+ throws YarnException, IOException {
+ RegisterDistributedSchedulingAMResponse resp = factory
+ .newRecordInstance(RegisterDistributedSchedulingAMResponse.class);
+ resp.setContainerIdStart(54321L);
+ resp.setMaxContainerResource(Resource.newInstance(4096, 4));
+ resp.setMinContainerResource(Resource.newInstance(1024, 1));
+ resp.setIncrContainerResource(Resource.newInstance(2048, 2));
+ return resp;
+ }
+
+ @Override
+ public DistributedSchedulingAllocateResponse
+ allocateForDistributedScheduling(
+ DistributedSchedulingAllocateRequest request)
+ throws YarnException, IOException {
+ List<ResourceRequest> askList =
+ request.getAllocateRequest().getAskList();
+ List<Container> allocatedContainers = request.getAllocatedContainers();
+ Assert.assertEquals(1, allocatedContainers.size());
+ Assert.assertEquals(ExecutionType.OPPORTUNISTIC,
+ allocatedContainers.get(0).getExecutionType());
+ Assert.assertEquals(1, askList.size());
+ Assert.assertTrue(askList.get(0)
+ .getExecutionTypeRequest().getEnforceExecutionType());
+ DistributedSchedulingAllocateResponse resp = factory
+ .newRecordInstance(DistributedSchedulingAllocateResponse.class);
+ resp.setNodesForScheduling(
+ Arrays.asList(NodeId.newInstance("h1", 1234)));
+ return resp;
+ }
+ };
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[47/50] [abbrv] hadoop git commit: YARN-5321. [YARN-3368] Add
resource usage for application by node managers (Wangda Tan via Sunil G)
YARN-5320. [YARN-3368] Add resource usage by applications and queues to
cluster overview page (Wangda Tan via Sunil G)
Posted by wa...@apache.org.
YARN-5321. [YARN-3368] Add resource usage for application by node managers (Wangda Tan via Sunil G)
YARN-5320. [YARN-3368] Add resource usage by applications and queues to cluster overview page (Wangda Tan via Sunil G)
YARN-5322. [YARN-3368] Add a node heat chart map (Wangda Tan via Sunil G)
YARN-5347. [YARN-3368] Applications page improvements (Sreenath Somarajapuram via Sunil G)
YARN-5348. [YARN-3368] Node details page improvements (Sreenath Somarajapuram via Sunil G)
YARN-5346. [YARN-3368] Queues page improvements (Sreenath Somarajapuram via Sunil G)
YARN-5345. [YARN-3368] Cluster overview page improvements (Sreenath Somarajapuram via Sunil G)
YARN-5344. [YARN-3368] Generic UI improvements (Sreenath Somarajapuram via Sunil G)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/3c2c918a
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/3c2c918a
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/3c2c918a
Branch: refs/heads/YARN-3368
Commit: 3c2c918a88663476809255dce245f93534a92df0
Parents: b2e8219
Author: Sunil <su...@apache.org>
Authored: Fri Jul 15 21:16:06 2016 +0530
Committer: Wangda Tan <wa...@apache.org>
Committed: Tue Aug 9 14:51:19 2016 -0700
----------------------------------------------------------------------
.../src/main/webapp/app/adapters/yarn-app.js | 14 +
.../app/components/app-usage-donut-chart.js | 67 ++++
.../src/main/webapp/app/components/bar-chart.js | 5 +
.../app/components/base-chart-component.js | 55 ++-
.../app/components/base-usage-donut-chart.js | 43 +++
.../main/webapp/app/components/donut-chart.js | 55 ++-
.../main/webapp/app/components/nodes-heatmap.js | 209 +++++++++++
...er-app-memusage-by-nodes-stacked-barchart.js | 88 +++++
...app-ncontainers-by-nodes-stacked-barchart.js | 67 ++++
.../app/components/queue-usage-donut-chart.js | 69 ++++
.../main/webapp/app/components/queue-view.js | 3 +-
.../main/webapp/app/components/simple-table.js | 9 +-
.../webapp/app/components/stacked-barchart.js | 198 +++++++++++
.../main/webapp/app/components/timeline-view.js | 2 +-
.../main/webapp/app/components/tree-selector.js | 43 ++-
.../webapp/app/controllers/cluster-overview.js | 9 +
.../webapp/app/controllers/yarn-app-attempt.js | 40 +++
.../webapp/app/controllers/yarn-app-attempts.js | 40 +++
.../src/main/webapp/app/controllers/yarn-app.js | 38 ++
.../main/webapp/app/controllers/yarn-apps.js | 9 +
.../webapp/app/controllers/yarn-node-apps.js | 39 +++
.../app/controllers/yarn-node-containers.js | 39 +++
.../main/webapp/app/controllers/yarn-node.js | 37 ++
.../app/controllers/yarn-nodes-heatmap.js | 36 ++
.../main/webapp/app/controllers/yarn-nodes.js | 33 ++
.../webapp/app/controllers/yarn-queue-apps.js | 46 +++
.../main/webapp/app/controllers/yarn-queue.js | 20 ++
.../main/webapp/app/controllers/yarn-queues.js | 34 ++
.../webapp/app/controllers/yarn-services.js | 34 ++
.../main/webapp/app/models/cluster-metric.js | 2 +-
.../main/webapp/app/models/yarn-app-attempt.js | 11 +
.../src/main/webapp/app/models/yarn-app.js | 4 +
.../src/main/webapp/app/models/yarn-rm-node.js | 7 +
.../src/main/webapp/app/router.js | 15 +-
.../src/main/webapp/app/routes/application.js | 2 +
.../main/webapp/app/routes/cluster-overview.js | 9 +-
.../main/webapp/app/routes/yarn-app-attempts.js | 30 ++
.../src/main/webapp/app/routes/yarn-app.js | 17 +-
.../src/main/webapp/app/routes/yarn-apps.js | 6 +-
.../main/webapp/app/routes/yarn-apps/apps.js | 22 ++
.../webapp/app/routes/yarn-apps/services.js | 22 ++
.../src/main/webapp/app/routes/yarn-node.js | 1 +
.../src/main/webapp/app/routes/yarn-nodes.js | 5 +-
.../webapp/app/routes/yarn-nodes/heatmap.js | 22 ++
.../main/webapp/app/routes/yarn-nodes/table.js | 22 ++
.../main/webapp/app/routes/yarn-queue-apps.js | 36 ++
.../src/main/webapp/app/routes/yarn-queues.js | 38 ++
.../webapp/app/serializers/yarn-app-attempt.js | 19 +-
.../src/main/webapp/app/serializers/yarn-app.js | 8 +-
.../webapp/app/serializers/yarn-container.js | 20 +-
.../src/main/webapp/app/styles/app.css | 139 ++++++--
.../main/webapp/app/templates/application.hbs | 99 ++++--
.../webapp/app/templates/cluster-overview.hbs | 168 ++++++---
.../app/templates/components/app-table.hbs | 10 +-
.../templates/components/node-menu-panel.hbs | 2 +-
.../app/templates/components/nodes-heatmap.hbs | 27 ++
.../components/queue-configuration-table.hbs | 4 -
.../templates/components/queue-navigator.hbs | 14 +-
.../app/templates/components/timeline-view.hbs | 3 +-
.../webapp/app/templates/yarn-app-attempt.hbs | 13 +-
.../webapp/app/templates/yarn-app-attempts.hbs | 57 +++
.../src/main/webapp/app/templates/yarn-app.hbs | 346 ++++++++++++-------
.../src/main/webapp/app/templates/yarn-apps.hbs | 82 ++++-
.../webapp/app/templates/yarn-apps/apps.hbs | 24 ++
.../webapp/app/templates/yarn-apps/services.hbs | 27 ++
.../webapp/app/templates/yarn-node-apps.hbs | 4 +
.../app/templates/yarn-node-container.hbs | 4 +
.../app/templates/yarn-node-containers.hbs | 4 +
.../src/main/webapp/app/templates/yarn-node.hbs | 148 ++++----
.../main/webapp/app/templates/yarn-nodes.hbs | 99 +++---
.../webapp/app/templates/yarn-nodes/heatmap.hbs | 30 ++
.../webapp/app/templates/yarn-nodes/table.hbs | 67 ++++
.../webapp/app/templates/yarn-queue-apps.hbs | 66 ++++
.../main/webapp/app/templates/yarn-queue.hbs | 126 ++++---
.../main/webapp/app/templates/yarn-queues.hbs | 72 ++++
.../src/main/webapp/app/utils/color-utils.js | 67 ++++
.../src/main/webapp/app/utils/converter.js | 17 +
.../main/webapp/app/utils/href-address-utils.js | 29 ++
.../src/main/webapp/app/utils/mock.js | 36 ++
.../hadoop-yarn-ui/src/main/webapp/bower.json | 3 +-
.../hadoop-yarn-ui/src/main/webapp/package.json | 4 +
.../unit/controllers/yarn-app-attempt-test.js | 30 ++
.../unit/controllers/yarn-app-attempts-test.js | 30 ++
.../tests/unit/controllers/yarn-app-test.js | 30 ++
.../unit/controllers/yarn-node-apps-test.js | 30 ++
.../controllers/yarn-node-containers-test.js | 30 ++
.../tests/unit/controllers/yarn-node-test.js | 30 ++
.../unit/controllers/yarn-nodes-heatmap-test.js | 30 ++
.../tests/unit/controllers/yarn-nodes-test.js | 30 ++
.../unit/controllers/yarn-queue-apps-test.js | 30 ++
.../tests/unit/controllers/yarn-queues-test.js | 4 +-
.../unit/controllers/yarn-services-test.js | 30 ++
.../tests/unit/routes/yarn-app-attempts-test.js | 29 ++
.../tests/unit/routes/yarn-queue-apps-test.js | 29 ++
.../tests/unit/routes/yarn-queues-test.js | 29 ++
95 files changed, 3399 insertions(+), 482 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app.js
index afd93f4..67a2847 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app.js
@@ -23,6 +23,20 @@ export default AbstractAdapter.extend({
restNameSpace: "cluster",
serverName: "RM",
+ urlForQuery(query, modelName) {
+ var url = this._buildURL();
+ if (query.state) {
+ url = url + '/apps/?state=' + query.state;
+ }
+ return url;
+ },
+
+ urlForFindRecord(id, modelName, snapshot) {
+ var url = this._buildURL();
+ url = url + '/apps/' + id;
+ return url;
+ },
+
pathForType(modelName) {
return 'apps'; // move to some common place, return path by modelname.
},
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/app-usage-donut-chart.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/app-usage-donut-chart.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/app-usage-donut-chart.js
new file mode 100644
index 0000000..0baf630
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/app-usage-donut-chart.js
@@ -0,0 +1,67 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import DonutChart from 'yarn-ui/components/donut-chart';
+import BaseUsageDonutChart from 'yarn-ui/components/base-usage-donut-chart';
+import ColorUtils from 'yarn-ui/utils/color-utils';
+import HrefAddressUtils from 'yarn-ui/utils/href-address-utils';
+
+export default BaseUsageDonutChart.extend({
+ colors: d3.scale.category20().range(),
+
+ draw: function() {
+ this.initChart();
+ var usageByApps = [];
+ var avail = 100;
+
+ this.get("data").forEach(function (app) {
+ var v = app.get("clusterUsagePercentage");
+ if (v > 1e-2) {
+ usageByApps.push({
+ label: app.get("id"),
+ link: HrefAddressUtils.getApplicationLink(app.get("id")),
+ value: v.toFixed(2)
+ });
+
+ console.log(v);
+ avail = avail - v;
+ }
+ }.bind(this));
+
+ usageByApps.sort(function(a,b) {
+ return b.value - a.value;
+ });
+
+ usageByApps = this.mergeLongTails(usageByApps, 8);
+
+ usageByApps.push({
+ label: "Available",
+ value: avail.toFixed(4)
+ })
+
+ this.colors = ColorUtils.getColors(usageByApps.length, ["others", "good"], true);
+
+ this.renderDonutChart(usageByApps, this.get("title"), this.get("showLabels"),
+ this.get("middleLabel"), "100%", "%");
+ },
+
+ didInsertElement: function() {
+ this.draw();
+ },
+})
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/bar-chart.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/bar-chart.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/bar-chart.js
index 8e48279..7bb292f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/bar-chart.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/bar-chart.js
@@ -116,6 +116,11 @@ export default BaseChartComponent.extend({
this.renderBarChart(this.get("data"), this.get("title"), this.get("textWidth"));
},
+ _dataChange: Ember.observer("data", function() {
+ this.chart.g.selectAll("*").remove();
+ this.renderBarChart(this.get("data"), this.get("title"), this.get("textWidth"));
+ }),
+
didInsertElement: function() {
this.draw();
},
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/base-chart-component.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/base-chart-component.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/base-chart-component.js
index b85b6ab..d221488 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/base-chart-component.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/base-chart-component.js
@@ -17,23 +17,26 @@
*/
import Ember from 'ember';
+import Converter from 'yarn-ui/utils/converter';
export default Ember.Component.extend({
- chart: undefined,
tooltip : undefined,
colors: d3.scale.category10().range(),
- initChart: function() {
- this.chart = {
+ init: function () {
+ this._super();
+ this.set("chart", {
svg: undefined,
g: undefined,
h: 0,
w: 0,
tooltip: undefined
- };
+ });
+ },
+ initChart: function(removeLast = false) {
// Init tooltip if it is not initialized
- this.tooltip = d3.select("#chart-tooltip");
+ // this.tooltip = d3.select("#chart-tooltip");
if (!this.tooltip) {
this.tooltip = d3.select("body")
.append("div")
@@ -42,13 +45,16 @@ export default Ember.Component.extend({
.style("opacity", 0);
}
- // Init svg
- var svg = this.chart.svg;
- if (svg) {
- svg.remove();
+ var parentId = this.get("parentId");
+
+ if (removeLast) {
+ // Init svg
+ var svg = d3.select("#" + parentId + "-svg");
+ if (svg) {
+ svg.remove();
+ }
}
- var parentId = this.get("parentId");
var parent = d3.select("#" + parentId);
var bbox = parent.node().getBoundingClientRect();
this.chart.w = bbox.width - 30;
@@ -65,12 +71,13 @@ export default Ember.Component.extend({
this.chart.svg = parent.append("svg")
.attr("width", this.chart.w)
- .attr("height", this.chart.h);
+ .attr("height", this.chart.h)
+ .attr("id", parentId + "-svg");
this.chart.g = this.chart.svg.append("g");
},
- renderTitleAndBG: function(g, title, layout) {
+ renderTitleAndBG: function(g, title, layout, background=true) {
var bg = g.append("g");
bg.append("text")
.text(title)
@@ -78,12 +85,14 @@ export default Ember.Component.extend({
.attr("y", layout.y1 + layout.margin + 20)
.attr("class", "chart-title");
- bg.append("rect")
- .attr("x", layout.x1)
- .attr("y", layout.y1)
- .attr("width", layout.x2 - layout.x1)
- .attr("height", layout.y2 - layout.y1)
- .attr("class", "chart-frame");
+ if (background) {
+ bg.append("rect")
+ .attr("x", layout.x1)
+ .attr("y", layout.y1)
+ .attr("width", layout.x2 - layout.x1)
+ .attr("height", layout.y2 - layout.y1)
+ .attr("class", "chart-frame");
+ }
},
bindTooltip: function(d) {
@@ -100,7 +109,11 @@ export default Ember.Component.extend({
}
this.tooltip.style("opacity", .9);
- this.tooltip.html(data.label + " = " + data.value)
+ var value = data.value;
+ if (this.get("type") == "memory") {
+ value = Converter.memoryToSimpliedUnit(value);
+ }
+ this.tooltip.html(data.label + " = " + value)
.style("left", (d3.event.pageX) + "px")
.style("top", (d3.event.pageY - 28) + "px");
}.bind(this))
@@ -109,6 +122,10 @@ export default Ember.Component.extend({
}.bind(this));
},
+ adjustMaxHeight: function(h) {
+ this.chart.svg.attr("height", h);
+ },
+
getLayout: function() {
var x1 = 0;
var y1 = 0;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/base-usage-donut-chart.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/base-usage-donut-chart.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/base-usage-donut-chart.js
new file mode 100644
index 0000000..bec06c9
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/base-usage-donut-chart.js
@@ -0,0 +1,43 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import DonutChart from 'yarn-ui/components/donut-chart';
+
+export default DonutChart.extend({
+ mergeLongTails: function(usages, nItemsKept) {
+ var arr = [];
+ for (var i = 0; i < Math.min(usages.length, nItemsKept); i++) {
+ arr.push(usages[i]);
+ }
+
+ var others = {
+ label: "Used by others",
+ value: 0
+ }
+
+ for (var i = nItemsKept; i < usages.length; i++) {
+ others.value += Number(usages[i].value);
+ }
+ others.value = others.value.toFixed(2);
+
+ arr.push(others)
+
+ return arr;
+ },
+})
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/donut-chart.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/donut-chart.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/donut-chart.js
index e6dcb12..9a90855 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/donut-chart.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/donut-chart.js
@@ -18,13 +18,15 @@
import Ember from 'ember';
import BaseChartComponent from 'yarn-ui/components/base-chart-component';
+import ColorUtils from 'yarn-ui/utils/color-utils';
+import Converter from 'yarn-ui/utils/converter';
export default BaseChartComponent.extend({
/*
* data = [{label="xx", value=},{...}]
*/
renderDonutChart: function(data, title, showLabels = false,
- middleLabel = "Total", middleValue = undefined) {
+ middleLabel = "Total", middleValue = undefined, suffix = "") {
var g = this.chart.g;
var layout = this.getLayout();
this.renderTitleAndBG(g, title, layout);
@@ -39,7 +41,11 @@ export default BaseChartComponent.extend({
}
if (!middleValue) {
- middleValue = total;
+ if (this.get("type") == "memory") {
+ middleValue = Converter.memoryToSimpliedUnit(total);
+ } else {
+ middleValue = total;
+ }
}
//Width and height
@@ -48,6 +54,8 @@ export default BaseChartComponent.extend({
// 50 is for title
var outerRadius = (h - 50 - 2 * layout.margin) / 2;
var innerRadius = outerRadius * 0.618;
+ console.log("inner:" + innerRadius + " outer:" + outerRadius);
+
var arc = d3.svg.arc()
.innerRadius(innerRadius)
.outerRadius(outerRadius);
@@ -104,12 +112,14 @@ export default BaseChartComponent.extend({
return this.colors[i];
}
}.bind(this))
- .attr("stroke-dasharray", function(d, i) {
- if (d.value <= 1e-6) {
- return "10,10";
- }
- }.bind(this));
this.bindTooltip(path);
+ path.on("click", function (d) {
+ var data = d.data;
+ if (data.link) {
+ this.tooltip.remove();
+ document.location.href = data.link;
+ }
+ }.bind(this))
// Show labels
if (showLabels) {
@@ -126,27 +136,30 @@ export default BaseChartComponent.extend({
}.bind(this))
.attr("x", lx)
.attr("y", function(d, i) {
- return layout.y1 + 50 + (squareW + margin) * i + layout.margin;
+ return layout.y1 + 75 + (squareW + margin) * i + layout.margin;
})
.attr("width", squareW)
.attr("height", squareW);
select.append("text")
.attr("x", lx + squareW + margin)
.attr("y", function(d, i) {
- return layout.y1 + 50 + (squareW + margin) * i + layout.margin + squareW / 2;
+ return layout.y1 + 80 + (squareW + margin) * i + layout.margin + squareW / 2;
})
.text(function(d) {
- return d.label + ' = ' + d.value;
- });
+ var value = d.value;
+ if (this.get("type") == "memory") {
+ value = Converter.memoryToSimpliedUnit(value);
+ }
+ return d.label + ' = ' + value + suffix;
+ }.bind(this));
}
if (middleLabel) {
var highLightColor = this.colors[0];
g.append("text").text(middleLabel).attr("x", cx).attr("y", cy - 10).
attr("class", "donut-highlight-text").attr("fill", highLightColor);
- g.append("text").text(middleValue).attr("x", cx).attr("y", cy + 20).
- attr("class", "donut-highlight-text").attr("fill", highLightColor).
- style("font-size", "30px");
+ g.append("text").text(middleValue).attr("x", cx).attr("y", cy + 15).
+ attr("class", "donut-highlight-sub").attr("fill", highLightColor);
}
path.transition()
@@ -154,8 +167,22 @@ export default BaseChartComponent.extend({
.attrTween('d', tweenPie);
},
+ _dataChange: Ember.observer("data", function() {
+ this.chart.g.selectAll("*").remove();
+ this.renderDonutChart(this.get("data"), this.get("title"), this.get("showLabels"),
+ this.get("middleLabel"), this.get("middleValue"));
+ }),
+
draw: function() {
this.initChart();
+
+ var colorTargets = this.get("colorTargets");
+ if (colorTargets) {
+ var colorTargetReverse = Boolean(this.get("colorTargetReverse"));
+ var targets = colorTargets.split(" ");
+ this.colors = ColorUtils.getColors(this.get("data").length, targets, colorTargetReverse);
+ }
+
this.renderDonutChart(this.get("data"), this.get("title"), this.get("showLabels"),
this.get("middleLabel"), this.get("middleValue"));
},
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/nodes-heatmap.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/nodes-heatmap.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/nodes-heatmap.js
new file mode 100644
index 0000000..af8ceb3
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/nodes-heatmap.js
@@ -0,0 +1,209 @@
+/**
+ * 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.
+ */
+
+import BaseChartComponent from 'yarn-ui/components/base-chart-component';
+import Mock from 'yarn-ui/utils/mock';
+
+export default BaseChartComponent.extend({
+ CELL_WIDTH: 250,
+ SAMPLE_CELL_WIDTH: 100,
+ SAMPLE_HEIGHT: 30,
+ CELL_HEIGHT: 30,
+ CELL_MARGIN: 2,
+ RACK_MARGIN: 20,
+ filter: "",
+
+ bindTP: function(element) {
+ element.on("mouseover", function() {
+ this.tooltip
+ .style("left", (d3.event.pageX) + "px")
+ .style("top", (d3.event.pageY - 28) + "px");
+ element.style("opacity", 1.0);
+ }.bind(this))
+ .on("mousemove", function() {
+ // Handle pie chart case
+ var text = element.attr("tooltiptext");
+
+ this.tooltip.style("opacity", .9);
+ this.tooltip.html(text)
+ .style("left", (d3.event.pageX) + "px")
+ .style("top", (d3.event.pageY - 28) + "px");
+ }.bind(this))
+ .on("mouseout", function() {
+ this.tooltip.style("opacity", 0);
+ element.style("opacity", 0.8);
+ }.bind(this));
+ },
+
+ // data:
+ // [{label=label1, value=value1}, ...]
+ // ...
+ renderCells: function (model, title) {
+ var data = [];
+ model.forEach(function (o) {
+ data.push(o);
+ });
+
+ this.chart.g.remove();
+ this.chart.g = this.chart.svg.append("g");
+ var g = this.chart.g;
+ var layout = this.getLayout();
+ layout.margin = 50;
+
+ let racks = new Set();
+ for (var i = 0; i < data.length; i++) {
+ racks.add(data[i].get("rack"));
+ }
+
+ let racksArray = [];
+ racks.forEach(v => racksArray.push(v));
+
+ var xOffset = layout.margin;
+ var yOffset = layout.margin * 3;
+
+ var colorFunc = d3.interpolate(d3.rgb("#bdddf5"), d3.rgb("#0f3957"));
+
+ var sampleXOffset = (layout.x2 - layout.x1) / 2 - 2.5 * this.SAMPLE_CELL_WIDTH -
+ 2 * this.CELL_MARGIN;
+ var sampleYOffset = layout.margin * 2;
+
+ for (var i = 1; i <= 5; i++) {
+ var ratio = i * 0.2 - 0.1;
+
+ var rect = g.append("rect")
+ .attr("x", sampleXOffset)
+ .attr("y", sampleYOffset)
+ .attr("fill", colorFunc(ratio))
+ .attr("width", this.SAMPLE_CELL_WIDTH)
+ .attr("height", this.SAMPLE_HEIGHT);
+ g.append("text")
+ .text("" + (ratio * 100).toFixed(1) + "% Used")
+ .attr("y", sampleYOffset + this.SAMPLE_HEIGHT / 2 + 5)
+ .attr("x", sampleXOffset + this.SAMPLE_CELL_WIDTH / 2)
+ .attr("class", "heatmap-cell");
+ sampleXOffset += this.CELL_MARGIN + this.SAMPLE_CELL_WIDTH;
+ }
+
+ var chartXOffset = -1;
+
+ for (var i = 0; i < racksArray.length; i++) {
+ var text = g.append("text")
+ .text(racksArray[i])
+ .attr("y", yOffset + this.CELL_HEIGHT / 2 + 5)
+ .attr("x", layout.margin)
+ .attr("class", "heatmap-rack");
+
+ if (-1 == chartXOffset) {
+ chartXOffset = layout.margin + text.node().getComputedTextLength() + 30;
+ }
+
+ xOffset = chartXOffset;
+
+ for (var j = 0; j < data.length; j++) {
+ var rack = data[j].get("rack");
+ var host = data[j].get("nodeHostName");
+
+ if (rack == racksArray[i]) {
+ if (!rack.includes(this.filter) && !host.includes(this.filter)) {
+ this.addNode(g, xOffset, yOffset, colorFunc, data[j], false);
+ var text = g.append("text")
+ .text(host)
+ .attr("y", yOffset + this.CELL_HEIGHT / 2 + 5)
+ .attr("x", xOffset + this.CELL_WIDTH / 2)
+ .attr("class", "heatmap-cell-notselected");
+ } else {
+ this.addNode(g, xOffset, yOffset, colorFunc, data[j], true);
+ g.append("text")
+ .text(host)
+ .attr("y", yOffset + this.CELL_HEIGHT / 2 + 5)
+ .attr("x", xOffset + this.CELL_WIDTH / 2)
+ .attr("class", "heatmap-cell");
+ }
+
+ xOffset += this.CELL_MARGIN + this.CELL_WIDTH;
+ if (xOffset + this.CELL_MARGIN + this.CELL_WIDTH >= layout.x2 -
+ layout.margin) {
+ xOffset = chartXOffset;
+ yOffset = yOffset + this.CELL_MARGIN + this.CELL_HEIGHT;
+ }
+
+ }
+ }
+
+ while (xOffset > chartXOffset && xOffset + this.CELL_MARGIN +
+ this.CELL_WIDTH < layout.x2 - layout.margin) {
+ this.addPlaceholderNode(g, xOffset, yOffset);
+ xOffset += this.CELL_MARGIN + this.CELL_WIDTH;
+ }
+
+ if (xOffset != chartXOffset) {
+ xOffset = chartXOffset;
+ yOffset += this.CELL_MARGIN + this.CELL_HEIGHT;
+ }
+ yOffset += this.RACK_MARGIN;
+ }
+
+ layout.y2 = yOffset + layout.margin;
+ this.adjustMaxHeight(layout.y2);
+ this.renderTitleAndBG(g, title, layout, false);
+ },
+
+ addNode: function (g, xOffset, yOffset, colorFunc, data, selected) {
+ var rect = g.append("rect")
+ .attr("y", yOffset)
+ .attr("x", xOffset)
+ .attr("height", this.CELL_HEIGHT)
+ .attr("fill", colorFunc(data.get("usedMemoryMB") /
+ (data.get("usedMemoryMB") + data.get("availMemoryMB"))))
+ .attr("width", this.CELL_WIDTH)
+ .attr("tooltiptext", data.get("toolTipText"));
+ if (selected) {
+ rect.style("opacity", 0.8);
+ this.bindTP(rect);
+ } else {
+ rect.style("opacity", 0.8);
+ rect.attr("fill", "DimGray");
+ }
+ },
+
+ addPlaceholderNode: function(g, xOffset, yOffset) {
+ var rect = g.append("rect")
+ .attr("y", yOffset)
+ .attr("x", xOffset)
+ .attr("height", this.CELL_HEIGHT)
+ .attr("fill", "grey")
+ .attr("width", this.CELL_WIDTH)
+ .style("opacity", 0.20);
+ },
+
+ draw: function() {
+ this.initChart(true);
+ this.renderCells(this.get("model"), this.get("title"), this.get("textWidth"));
+ },
+
+ didInsertElement: function () {
+ this.draw();
+ },
+
+ actions: {
+ applyFilter: function(event) {
+ this.filter = event.srcElement.value;
+ this.didInsertElement();
+ }
+ }
+})
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/per-app-memusage-by-nodes-stacked-barchart.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/per-app-memusage-by-nodes-stacked-barchart.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/per-app-memusage-by-nodes-stacked-barchart.js
new file mode 100644
index 0000000..7feb7bb
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/per-app-memusage-by-nodes-stacked-barchart.js
@@ -0,0 +1,88 @@
+/**
+ * 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.
+ */
+
+import StackedBarchart from 'yarn-ui/components/stacked-barchart';
+import Converter from 'yarn-ui/utils/converter';
+
+export default StackedBarchart.extend({
+ getDataForRender: function(containers, nodes) {
+ var arr = [];
+ var nodeToResources = {};
+ nodes.forEach(function(n) {
+ nodeToResources[n.id] =
+ {
+ used: Number(n.get("usedMemoryMB")),
+ avail: Number(n.get("availMemoryMB"))
+ }
+ });
+
+ containers.forEach(function(c) {
+ res = nodeToResources[c.get("assignedNodeId")];
+ if (res) {
+ if (!res.usedByTheApp) {
+ res.usedByTheApp = 0;
+ }
+ res.usedByTheApp += Number(c.get("allocatedMB"));
+ }
+ });
+
+ for (var nodeId in nodeToResources) {
+ var res = nodeToResources[nodeId];
+
+ var subArr = [];
+ var value = res.usedByTheApp ? res.usedByTheApp : 0;
+ subArr.push({
+ value: value,
+ bindText: "This app uses " + Converter.memoryToSimpliedUnit(value) + ". On node=" + nodeId,
+ });
+
+ value = res.used - value;
+ value = Math.max(value, 0);
+ subArr.push({
+ value: value,
+ bindText: "Other applications uses " + Converter.memoryToSimpliedUnit(value) + ". On node=" + nodeId,
+ });
+
+ subArr.push({
+ value: res.avail,
+ bindText: "Free resource " + Converter.memoryToSimpliedUnit(res.avail) + " . On node=" + nodeId
+ });
+
+ arr.push(subArr);
+ }
+
+ console.log(arr);
+
+ return arr;
+ },
+
+ didInsertElement: function() {
+ this.initChart(true);
+
+ this.colors = ["Orange", "Grey", "LimeGreen"];
+
+ var containers = this.get("rmContainers");
+ var nodes = this.get("nodes");
+
+ var data = this.getDataForRender(containers, nodes);
+
+ this.show(
+ data, this.get("title"), ["Used by this app", "Used by other apps",
+ "Available"]);
+ },
+})
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/per-app-ncontainers-by-nodes-stacked-barchart.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/per-app-ncontainers-by-nodes-stacked-barchart.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/per-app-ncontainers-by-nodes-stacked-barchart.js
new file mode 100644
index 0000000..251f557
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/per-app-ncontainers-by-nodes-stacked-barchart.js
@@ -0,0 +1,67 @@
+/**
+ * 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.
+ */
+
+import StackedBarchart from 'yarn-ui/components/stacked-barchart';
+
+export default StackedBarchart.extend({
+ getDataForRender: function(containers, nodes) {
+ var arr = [];
+ var nodeToContainers = {};
+ nodes.forEach(function(n) {
+ nodeToContainers[n.id] = 0;
+ });
+
+ containers.forEach(function(c) {
+ var nodeId = c.get("assignedNodeId");
+ var n = nodeToContainers[nodeId];
+ if (undefined != n) {
+ nodeToContainers[nodeId] += 1;
+ }
+ });
+
+ for (var nodeId in nodeToContainers) {
+ var n = nodeToContainers[nodeId];
+
+ var subArr = [];
+ subArr.push({
+ value: n,
+ bindText: "This app has " + n + " containers running on node=" + nodeId
+ });
+
+ arr.push(subArr);
+ }
+
+ console.log(arr);
+
+ return arr;
+ },
+
+ didInsertElement: function() {
+ this.initChart(true);
+
+ this.colors = ["Orange", "Grey", "Gainsboro"];
+
+ var containers = this.get("rmContainers");
+ var nodes = this.get("nodes");
+
+ var data = this.getDataForRender(containers, nodes);
+
+ this.show(
+ data, this.get("title"), ["Running containers from this app"]);
+ },
+})
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-usage-donut-chart.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-usage-donut-chart.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-usage-donut-chart.js
new file mode 100644
index 0000000..3532726
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-usage-donut-chart.js
@@ -0,0 +1,69 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import DonutChart from 'yarn-ui/components/donut-chart';
+import BaseUsageDonutChart from 'yarn-ui/components/base-usage-donut-chart';
+import ColorUtils from 'yarn-ui/utils/color-utils';
+import HrefAddressUtils from 'yarn-ui/utils/href-address-utils';
+
+export default BaseUsageDonutChart.extend({
+ colors: d3.scale.category20().range(),
+
+ draw: function() {
+ this.initChart();
+ var usageByQueues = [];
+ var avail = 100;
+
+ this.get("data").forEach(function (queue) {
+ var v = queue.get("absUsedCapacity");
+
+ if (queue.get("isLeafQueue")) {
+ if (v > 1e-2) {
+ usageByQueues.push({
+ label: queue.get("id"),
+ link: HrefAddressUtils.getQueueLink(queue.get("id")),
+ value: v.toFixed(2)
+ });
+
+ avail = avail - v;
+ }
+ }
+ });
+
+ usageByQueues.sort(function(a, b) {
+ return b.value - a.value;
+ });
+
+ usageByQueues = this.mergeLongTails(usageByQueues, 8);
+
+ usageByQueues.push({
+ label: "Available",
+ value: avail.toFixed(4)
+ });
+
+ this.colors = ColorUtils.getColors(usageByQueues.length, ["others", "good"], true);
+
+ this.renderDonutChart(usageByQueues, this.get("title"), this.get("showLabels"),
+ this.get("middleLabel"), "100%", "%");
+ },
+
+ didInsertElement: function() {
+ this.draw();
+ },
+})
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-view.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-view.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-view.js
index 2a90771..adedf9a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-view.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-view.js
@@ -90,7 +90,6 @@ export default Ember.Component.extend(ChartUtilsMixin, {
.attr("class", "queue");
circle.on('mouseover', function () {
- circle.style("fill", this.queueColors[1]);
}.bind(this));
circle.on('mouseout', function () {
if (circle != this.queues.selectedQueueCircle) {
@@ -206,7 +205,7 @@ export default Ember.Component.extend(ChartUtilsMixin, {
renderQueueCapacities: function (queue, layout) {
// Render bar chart
- this.renderBarChart(this.charts.g, [{
+ this.renderCells(this.charts.g, [{
label: "Cap",
value: queue.get("capacity")
}, {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/simple-table.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/simple-table.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/simple-table.js
index e5da81a..359583d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/simple-table.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/simple-table.js
@@ -1,3 +1,4 @@
+
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -24,6 +25,7 @@ export default Ember.Component.extend({
var ordering = this.get("ordering") ? true : this.get("ordering");
var info = this.get("info") ? true : this.get("info");
var bFilter = this.get("bFilter") ? true : this.get("bFilter");
+ var defaultSearch = this.get("defaultSearch") ? this.get("defaultSearch") : "";
// Defines sorter for the columns if not default.
// Can also specify a custom sorter.
@@ -66,11 +68,14 @@ export default Ember.Component.extend({
console.log(orderArr[0]);
Ember.$('#' + this.get('table-id')).DataTable({
"paging": paging,
- "ordering": ordering,
+ "ordering": ordering,
"info": info,
"bFilter": bFilter,
"order": orderArr,
- "columnDefs": colDefs
+ "columnDefs": colDefs,
+ "oSearch": {
+ "sSearch": defaultSearch
+ }
});
}
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/stacked-barchart.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/stacked-barchart.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/stacked-barchart.js
new file mode 100644
index 0000000..4a121fe
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/stacked-barchart.js
@@ -0,0 +1,198 @@
+/**
+ * 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.
+ */
+
+import BaseChartComponent from 'yarn-ui/components/base-chart-component';
+import Mock from 'yarn-ui/utils/mock';
+
+export default BaseChartComponent.extend({
+ MAX_BAR_HEIGHT: 120,
+ MAX_BAR_WIDTH: 30,
+ GAP: 5,
+ filter: "",
+ WIDTH_OF_SAMPLE: 200,
+
+ bindTP: function(element) {
+ element.on("mouseover", function() {
+ this.tooltip
+ .style("left", (d3.event.pageX) + "px")
+ .style("top", (d3.event.pageY - 28) + "px");
+ element.style("opacity", 1.0);
+ }.bind(this))
+ .on("mousemove", function() {
+ // Handle pie chart case
+ var text = element.attr("tooltiptext");
+
+ this.tooltip.style("opacity", .9);
+ this.tooltip.html(text)
+ .style("left", (d3.event.pageX) + "px")
+ .style("top", (d3.event.pageY - 28) + "px");
+ }.bind(this))
+ .on("mouseout", function() {
+ this.tooltip.style("opacity", 0);
+ element.style("opacity", 0.8);
+ }.bind(this));
+
+ element.on("click", function() {
+ if (element.attr("link")) {
+ this.tooltip.remove();
+ document.location.href = element.attr("link");
+ }
+ }.bind(this));
+ },
+
+ printSamples: function(n, layout, g, colorTitles) {
+ var yOffset = layout.margin * 3;
+
+ for (var i = 0; i < n; i++) {
+ var xOffset = layout.x2 - this.WIDTH_OF_SAMPLE - layout.margin;
+ g.append("rect").
+ attr("fill", this.colors[i]).
+ attr("x", xOffset).
+ attr("y", yOffset).
+ attr("width", 20).
+ attr("height", 20);
+
+ g.append("text").
+ attr("x", xOffset + 30).
+ attr("y", yOffset + 10).
+ text(colorTitles[i]);
+
+ yOffset = yOffset + 30;
+ }
+ },
+
+ // data:
+ // [[{value=xx, bindText=xx}, {value=yy, bindText=yy}], [ ... ]]
+ // __________________________________________________ ___________
+ // bar-1 bar-2
+ show: function (data, title, colorTitles) {
+ var width = this.MAX_BAR_WIDTH;
+ var height = this.MAX_BAR_HEIGHT;
+
+ this.chart.g.remove();
+ this.chart.g = this.chart.svg.append("g");
+ var g = this.chart.g;
+ var layout = this.getLayout();
+ layout.margin = 50;
+
+ var nBarPerRow = Math.floor((layout.x2 - layout.x1 - 3 * layout.margin -
+ this.WIDTH_OF_SAMPLE) /
+ (width + this.GAP));
+
+ var xOffset;
+ var yOffset = layout.margin * 2;
+
+ var maxValue = 0;
+ var maxN = 0;
+ for (var i = 0; i < data.length; i++) {
+ var total = 0;
+ for (var j = 0; j < data[i].length; j++) {
+ total += data[i][j].value;
+ }
+
+ if (total > maxValue) {
+ maxValue = total;
+ }
+ if (data[i].length > maxN) {
+ maxN = data[i].length;
+ }
+ }
+
+ // print samples
+ this.printSamples(maxN, layout, g, colorTitles);
+
+ // print data
+ data.sort(function(a, b) {
+ return b[0].value - a[0].value;
+ });
+
+ for (var i = 0; i < data.length; i++) {
+ if (i % nBarPerRow == 0) {
+ xOffset = layout.margin;
+ yOffset += layout.margin + height;
+ }
+
+ var leftTopY = yOffset;
+ for (var j = 0; j < data[i].length; j++) {
+ var dy = data[i][j].value * height / maxValue;
+ if (dy > 0) {
+ leftTopY = leftTopY - dy;
+
+ var node = g.append("rect").
+ attr("fill", this.colors[j]).
+ attr("x", xOffset).
+ attr("y", leftTopY).
+ attr("width", width).
+ attr("height", dy).
+ attr("tooltiptext",
+ (data[i][j].bindText) ? data[i][j].bindText : data[i][j].value).
+ attr("link", data[i][j].link)
+ .style("opacity", 0.8);
+
+ this.bindTP(node);
+ }
+ }
+
+ if (data[i].length == 1) {
+ g.append("text")
+ .text(data[i][0].value)
+ .attr("y", leftTopY - 10)
+ .attr("x", xOffset + width / 2)
+ .attr("class", "heatmap-cell")
+ .style("fill", "black");
+ }
+
+ xOffset += width + this.GAP;
+ }
+
+ layout.y2 = yOffset + layout.margin;
+ this.adjustMaxHeight(layout.y2);
+ this.renderTitleAndBG(g, title, layout, false);
+ },
+
+ draw: function(data, title, textWidth) {
+ this.initChart(true);
+ //Mock.initMockNodesData(this);
+
+ // mock data
+ var arr = [];
+ for (var i = 0; i < 5; i++) {
+ var subArr = [];
+ for (var j = 0; j < Math.random() * 4 + 1; j++) {
+ subArr.push({
+ value : Math.abs(Math.random())
+ });
+ }
+ arr.push(subArr);
+ }
+
+ this.show(
+ arr, this.get("title"));
+ },
+
+ didInsertElement: function () {
+ this.draw();
+ },
+
+ actions: {
+ applyFilter: function(event) {
+ this.filter = event.srcElement.value;
+ this.didInsertElement();
+ }
+ }
+})
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js
index 8a2b3de..516b114 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js
@@ -105,7 +105,7 @@ export default Ember.Component.extend({
var border = 30;
var singleBarHeight = this.getPerItemHeight();
var gap = this.getPerItemGap();
- var textWidth = 50;
+ var textWidth = 200;
/*
start-time end-time
|--------------------------------------|
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
index 1af98ab..5e7cfa0 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
@@ -18,6 +18,8 @@
import Ember from 'ember';
+const INBETWEEN_HEIGHT = 130;
+
export default Ember.Component.extend({
// Map: <queue-name, queue>
map : undefined,
@@ -124,12 +126,25 @@ export default Ember.Component.extend({
var nodeEnter = node.enter().append("g")
.attr("class", "node")
.attr("transform", function(d) { return "translate(" + source.y0 + "," + source.x0 + ")"; })
- .on("click", function(d,i){
+ .on("mouseover", function(d,i){
if (d.queueData.get("name") != this.get("selected")) {
- document.location.href = "#/yarn-queue/" + d.queueData.get("name");
+ document.location.href = "#/yarn-queues/" + d.queueData.get("name");
}
- }.bind(this));
- // .on("click", click);
+
+ Ember.run.later(this, function () {
+ var treeWidth = this.maxDepth * 200;
+ var treeHeight = this.numOfLeafQueue * INBETWEEN_HEIGHT;
+ var tree = d3.layout.tree().size([treeHeight, treeWidth]);
+ var diagonal = d3.svg.diagonal()
+ .projection(function(d) { return [d.y, d.x]; });
+
+ this.update(this.treeData, this.treeData, tree, diagonal);
+ }, 100);
+
+ }.bind(this))
+ .on("click", function (d) {
+ document.location.href = "#/yarn-queue/" + d.queueData.get("name");
+ });
nodeEnter.append("circle")
.attr("r", 1e-6)
@@ -148,6 +163,7 @@ export default Ember.Component.extend({
nodeEnter.append("text")
.attr("x", function(d) { return 0; })
.attr("dy", ".35em")
+ .attr("fill", "white")
.attr("text-anchor", function(d) { return "middle"; })
.text(function(d) {
var usedCap = d.queueData.get("usedCapacity");
@@ -161,9 +177,9 @@ export default Ember.Component.extend({
// append queue name
nodeEnter.append("text")
- .attr("x", function(d) { return 40; })
- .attr("dy", ".35em")
- .attr("text-anchor", function(d) { return "start"; })
+ .attr("x", "0px")
+ .attr("dy", "45px")
+ .attr("text-anchor", "middle")
.text(function(d) { return d.name; })
.style("fill-opacity", 1e-6);
@@ -173,14 +189,21 @@ export default Ember.Component.extend({
.attr("transform", function(d) { return "translate(" + d.y + "," + d.x + ")"; });
nodeUpdate.select("circle")
- .attr("r", 20)
+ .attr("r", 30)
.attr("href",
function(d) {
return "#/yarn-queues/" + d.queueData.get("name");
})
+ .style("stroke-width", function(d) {
+ if (d.queueData.get("name") == this.get("selected")) {
+ return 7;
+ } else {
+ return 2;
+ }
+ }.bind(this))
.style("stroke", function(d) {
if (d.queueData.get("name") == this.get("selected")) {
- return "red";
+ return "gray";
} else {
return "gray";
}
@@ -239,7 +262,7 @@ export default Ember.Component.extend({
var margin = {top: 20, right: 120, bottom: 20, left: 120};
var treeWidth = this.maxDepth * 200;
- var treeHeight = this.numOfLeafQueue * 80;
+ var treeHeight = this.numOfLeafQueue * INBETWEEN_HEIGHT;
var width = treeWidth + margin.left + margin.right;
var height = treeHeight + margin.top + margin.bottom;
var layout = { };
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/cluster-overview.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/cluster-overview.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/cluster-overview.js
index dc2f6e4..22e6267 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/cluster-overview.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/cluster-overview.js
@@ -20,4 +20,13 @@ import Ember from 'ember';
export default Ember.Controller.extend({
loading: true,
+
+ breadcrumbs: [{
+ text: "Home",
+ routeName: 'application'
+ }, {
+ text: "Cluster Overview",
+ routeName: 'cluster-overview',
+ }]
+
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app-attempt.js
new file mode 100644
index 0000000..a458842
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app-attempt.js
@@ -0,0 +1,40 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+
+ breadcrumbs: Ember.computed("model.attempt.appId", function () {
+ var appId = this.get("model.attempt.appId");
+ return [{
+ text: "Home",
+ routeName: 'application'
+ },{
+ text: "Applications",
+ routeName: 'yarn-apps'
+ }, {
+ text: `App [${appId}]`,
+ routeName: 'yarn-app',
+ model: appId
+ }, {
+ text: "Attempt",
+ }];
+ })
+
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app-attempts.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app-attempts.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app-attempts.js
new file mode 100644
index 0000000..9ebc2a6
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app-attempts.js
@@ -0,0 +1,40 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+
+ breadcrumbs: Ember.computed("model.appId", function () {
+ var appId = this.get("model.appId");
+ return [{
+ text: "Home",
+ routeName: 'application'
+ },{
+ text: "Applications",
+ routeName: 'yarn-apps'
+ }, {
+ text: `App [${appId}]`,
+ routeName: 'yarn-app',
+ model: appId
+ }, {
+ text: "Attempts",
+ }];
+ })
+
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app.js
new file mode 100644
index 0000000..f6b9404
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app.js
@@ -0,0 +1,38 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+
+ breadcrumbs: Ember.computed("model.app.id", function () {
+ var appId = this.get("model.app.id");
+ return [{
+ text: "Home",
+ routeName: 'application'
+ },{
+ text: "Applications",
+ routeName: 'yarn-apps'
+ }, {
+ text: `App [${appId}]`,
+ routeName: 'yarn-app',
+ model: appId
+ }];
+ })
+
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps.js
index dc99fd1..396f83b 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps.js
@@ -19,4 +19,13 @@
import Ember from 'ember';
export default Ember.Controller.extend({
+
+ breadcrumbs: [{
+ text: "Home",
+ routeName: 'application'
+ }, {
+ text: "Applications",
+ routeName: 'yarn-apps',
+ }]
+
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-apps.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-apps.js
new file mode 100644
index 0000000..4bfe9d0
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-apps.js
@@ -0,0 +1,39 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+
+ breadcrumbs: Ember.computed("model.attempt.appId", function () {
+ var nodeInfo = this.get("model.nodeInfo");
+ return [{
+ text: "Home",
+ routeName: 'application'
+ },{
+ text: "Nodes",
+ routeName: 'yarn-nodes'
+ }, {
+ text: `Node [ ${nodeInfo.id} ]`,
+ href: `/#/yarn-node/${nodeInfo.id}/${nodeInfo.addr}`,
+ }, {
+ text: "Applications",
+ }];
+ })
+
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-containers.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-containers.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-containers.js
new file mode 100644
index 0000000..59c8591
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-containers.js
@@ -0,0 +1,39 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+
+ breadcrumbs: Ember.computed("model.nodeInfo", function () {
+ var nodeInfo = this.get("model.nodeInfo");
+ return [{
+ text: "Home",
+ routeName: 'application'
+ },{
+ text: "Nodes",
+ routeName: 'yarn-nodes'
+ }, {
+ text: `Node [ ${nodeInfo.id} ]`,
+ href: `/#/yarn-node/${nodeInfo.id}/${nodeInfo.addr}`,
+ }, {
+ text: "Containers",
+ }];
+ })
+
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node.js
new file mode 100644
index 0000000..e505022
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node.js
@@ -0,0 +1,37 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+
+ breadcrumbs: Ember.computed("model.attempt.appId", function () {
+ var nodeInfo = this.get("model.nodeInfo");
+ return [{
+ text: "Home",
+ routeName: 'application'
+ },{
+ text: "Nodes",
+ routeName: 'yarn-nodes'
+ }, {
+ text: `Node [ ${nodeInfo.id} ]`,
+ href: `/#/yarn-node/${nodeInfo.id}/${nodeInfo.addr}`,
+ }];
+ })
+
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes-heatmap.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes-heatmap.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes-heatmap.js
new file mode 100644
index 0000000..fbe77fa
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes-heatmap.js
@@ -0,0 +1,36 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+ needReload: true,
+ selectedQueue: undefined,
+
+ breadcrumbs: [{
+ text: "Home",
+ routeName: 'application'
+ }, {
+ text: "Nodes",
+ routeName: 'yarn-nodes',
+ }, {
+ text: "Heatmap",
+ routeName: 'yarn-nodes-heatmap',
+ }]
+
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes.js
new file mode 100644
index 0000000..b4bf0f0
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes.js
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+ needReload: true,
+ selectedQueue: undefined,
+
+ breadcrumbs: [{
+ text: "Home",
+ routeName: 'application'
+ }, {
+ text: "Nodes",
+ routeName: 'yarn-nodes',
+ }]
+
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queue-apps.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queue-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queue-apps.js
new file mode 100644
index 0000000..e7bedd6
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queue-apps.js
@@ -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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+ needReload: true,
+ selectedQueue: undefined,
+
+ breadcrumbs: Ember.computed("model.selected", function () {
+ var queueName = this.get("model.selected");
+
+ return [{
+ text: "Home",
+ routeName: 'application'
+ }, {
+ text: "Queues",
+ routeName: 'yarn-queues',
+ model: 'root'
+ }, {
+ text: `Queue [ ${queueName} ]`,
+ routeName: 'yarn-queue',
+ model: queueName
+ }, {
+ text: "Applications",
+ }];
+
+ }),
+
+
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queue.js
index 38cf352..0b4150f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queue.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queue.js
@@ -21,4 +21,24 @@ import Ember from 'ember';
export default Ember.Controller.extend({
needReload: true,
selectedQueue: undefined,
+
+ breadcrumbs: Ember.computed("model.selected", function () {
+ var queueName = this.get("model.selected");
+
+ return [{
+ text: "Home",
+ routeName: 'application'
+ }, {
+ text: "Queues",
+ routeName: 'yarn-queues',
+ model: 'root'
+ }, {
+ text: `Queue [ ${queueName} ]`,
+ routeName: 'yarn-queue',
+ model: queueName
+ }];
+
+ }),
+
+
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queues.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queues.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queues.js
new file mode 100644
index 0000000..941e150
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queues.js
@@ -0,0 +1,34 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+ needReload: true,
+ selectedQueue: undefined,
+
+ breadcrumbs: [{
+ text: "Home",
+ routeName: 'application'
+ }, {
+ text: "Queues",
+ routeName: 'yarn-queues',
+ model: 'root'
+ }]
+
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-services.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-services.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-services.js
new file mode 100644
index 0000000..597962a
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-services.js
@@ -0,0 +1,34 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+
+ breadcrumbs: [{
+ text: "Home",
+ routeName: 'application'
+ }, {
+ text: "Applications",
+ routeName: 'yarn-apps',
+ }, {
+ text: "Long Running Services",
+ routeName: 'yarn-services',
+ }]
+
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-metric.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-metric.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-metric.js
index 981375a..bc6e27a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-metric.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-metric.js
@@ -125,7 +125,7 @@ export default DS.Model.extend({
});
arr.push({
label: "Available",
- value: this.get("available" + type)
+ value: Math.max(this.get("available" + type), 0)
});
return arr;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js
index b913a33..f30d143 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js
@@ -30,6 +30,17 @@ export default DS.Model.extend({
hosts: DS.attr('string'),
logsLink: DS.attr('string'),
state: DS.attr('string'),
+ appAttemptId: DS.attr('string'),
+
+ appId: Ember.computed("id",function () {
+ var id = this.get("id");
+ id = id.split("_");
+
+ id[0] = "application";
+ id.pop();
+
+ return id.join("_");
+ }),
attemptStartedTime: function() {
var startTime = this.get("startTime");
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js
index a96c17c..0a5df87 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js
@@ -36,6 +36,7 @@ export default DS.Model.extend({
unmanagedApplication: DS.attr('string'),
amNodeLabelExpression: DS.attr('string'),
applicationTags: DS.attr('string'),
+ applicationType: DS.attr('string'),
priority: DS.attr('number'),
allocatedMB: DS.attr('number'),
allocatedVCores: DS.attr('number'),
@@ -46,6 +47,9 @@ export default DS.Model.extend({
preemptedResourceVCores: DS.attr('number'),
numNonAMContainerPreempted: DS.attr('number'),
numAMContainerPreempted: DS.attr('number'),
+ clusterUsagePercentage: DS.attr('number'),
+ queueUsagePercentage: DS.attr('number'),
+ currentAppAttemptId: DS.attr('string'),
isFailed: function() {
return this.get('finalStatus') == "FAILED"
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-rm-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-rm-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-rm-node.js
index 9a1082c..a15a20f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-rm-node.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-rm-node.js
@@ -89,4 +89,11 @@ export default DS.Model.extend({
});
return arr;
}.property("availableVirtualCores", "usedVirtualCores"),
+
+ toolTipText: function() {
+ return "<p>Rack: " + this.get("rack") + '</p>' +
+ "<p>Host: " + this.get("nodeHostName") + '</p>' +
+ "<p>Used Memory: " + Math.round(this.get("usedMemoryMB")) + ' MB</p>' +
+ "<p>Available Memory: " + Math.round(this.get("availMemoryMB")) + ' MB</p>';
+ }.property(),
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js
index 8f7ce5f..87a018d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js
@@ -24,8 +24,15 @@ var Router = Ember.Router.extend({
});
Router.map(function() {
- this.route('yarn-apps');
- this.route('yarn-nodes');
+ this.route('yarn-apps', function () {
+ this.route('apps');
+ this.route('services');
+ });
+ this.route('yarn-nodes', function(){
+ this.route('table');
+ this.route('heatmap');
+ });
+ this.route('yarn-nodes-heatmap');
this.route('yarn-node', { path: '/yarn-node/:node_id/:node_addr' });
this.route('yarn-node-apps', { path: '/yarn-node-apps/:node_id/:node_addr' });
this.route('yarn-node-app',
@@ -37,11 +44,15 @@ Router.map(function() {
this.route('yarn-container-log', { path:
'/yarn-container-log/:node_id/:node_addr/:container_id/:filename' });
this.route('yarn-queue', { path: '/yarn-queue/:queue_name' });
+
this.route('cluster-overview');
this.route('yarn-app', { path: '/yarn-app/:app_id' });
this.route('yarn-app-attempt', { path: '/yarn-app-attempt/:app_attempt_id'});
this.route('error');
this.route('notfound', { path: '*:' });
+ this.route('yarn-app-attempts', { path: '/yarn-app-attempts/:app_id' });
+ this.route('yarn-queues', { path: '/yarn-queues/:queue_name' });
+ this.route('yarn-queue-apps', { path: '/yarn-queue-apps/:queue_name' });
});
export default Router;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js
index b7a5754..07b3792 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js
@@ -27,6 +27,8 @@ export default Ember.Route.extend({
* error handler page.
*/
error: function (error) {
+ Ember.Logger.log(error.stack);
+
if (error && error.errors[0] &&
error.errors[0].status == 404) {
this.intermediateTransitionTo('/notfound');
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/cluster-overview.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/cluster-overview.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/cluster-overview.js
index 4b4e554..3689274 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/cluster-overview.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/cluster-overview.js
@@ -20,7 +20,14 @@ import Ember from 'ember';
export default Ember.Route.extend({
model() {
- return this.store.findAll('ClusterMetric');
+ return Ember.RSVP.hash({
+ clusterMetrics: this.store.findAll('ClusterMetric'),
+ apps: this.store.query('yarn-app',
+ {
+ state: "RUNNING"
+ }),
+ queues: this.store.findAll('yarn-queue'),
+ });
},
afterModel() {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempts.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempts.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempts.js
new file mode 100644
index 0000000..1a526c7
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempts.js
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ return this.store.query('yarn-app-attempt', { appId: param.app_id}).then(function (attempts) {
+ return {
+ appId: param.app_id,
+ attempts: attempts
+ };
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js
index f5384b8..ab84632 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js
@@ -22,7 +22,22 @@ export default Ember.Route.extend({
model(param) {
return Ember.RSVP.hash({
app: this.store.find('yarn-app', param.app_id),
- attempts: this.store.query('yarn-app-attempt', { appId: param.app_id})
+
+ rmContainers: this.store.find('yarn-app', param.app_id).then(function(app) {
+ return this.store.query('yarn-app-attempt', {appId: param.app_id}).then(function (attempts) {
+ if (attempts && attempts.get('firstObject')) {
+ var appAttemptId = attempts.get('firstObject').get('appAttemptId');
+ var rmContainers = this.store.query('yarn-container',
+ {
+ app_attempt_id: appAttemptId,
+ is_rm: true
+ });
+ return rmContainers;
+ }
+ }.bind(this));
+ }.bind(this)),
+
+ nodes: this.store.findAll('yarn-rm-node'),
});
}
});
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[34/50] [abbrv] hadoop git commit: YARN-4849. [YARN-3368] cleanup
code base, integrate web UI related build to mvn, and fix licenses. (wangda)
Posted by wa...@apache.org.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-test.js
deleted file mode 100644
index 5877589..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-test.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleForModel, test } from 'ember-qunit';
-
-moduleForModel('yarn-node', 'Unit | Model | Node', {
- // Specify the other units that are required for this test.
- needs: []
-});
-
-test('Basic creation test', function(assert) {
- let model = this.subject();
-
- assert.ok(model);
- assert.ok(model._notifyProperties);
- assert.ok(model.didLoad);
- assert.ok(model.totalVmemAllocatedContainersMB);
- assert.ok(model.vmemCheckEnabled);
- assert.ok(model.pmemCheckEnabled);
- assert.ok(model.nodeHealthy);
- assert.ok(model.lastNodeUpdateTime);
- assert.ok(model.healthReport);
- assert.ok(model.nmStartupTime);
- assert.ok(model.nodeManagerBuildVersion);
- assert.ok(model.hadoopBuildVersion);
-});
-
-test('test fields', function(assert) {
- let model = this.subject();
-
- assert.expect(4);
- Ember.run(function () {
- model.set("totalVmemAllocatedContainersMB", 4096);
- model.set("totalPmemAllocatedContainersMB", 2048);
- model.set("totalVCoresAllocatedContainers", 4);
- model.set("hadoopBuildVersion", "3.0.0-SNAPSHOT");
- assert.equal(model.get("totalVmemAllocatedContainersMB"), 4096);
- assert.equal(model.get("totalPmemAllocatedContainersMB"), 2048);
- assert.equal(model.get("totalVCoresAllocatedContainers"), 4);
- assert.equal(model.get("hadoopBuildVersion"), "3.0.0-SNAPSHOT");
- });
-});
-
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-rm-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-rm-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-rm-node-test.js
deleted file mode 100644
index 4fd2517..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-rm-node-test.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleForModel, test } from 'ember-qunit';
-
-moduleForModel('yarn-rm-node', 'Unit | Model | RMNode', {
- // Specify the other units that are required for this test.
- needs: []
-});
-
-test('Basic creation test', function(assert) {
- let model = this.subject();
-
- assert.ok(model);
- assert.ok(model._notifyProperties);
- assert.ok(model.didLoad);
- assert.ok(model.rack);
- assert.ok(model.state);
- assert.ok(model.nodeHostName);
- assert.ok(model.nodeHTTPAddress);
- assert.ok(model.lastHealthUpdate);
- assert.ok(model.healthReport);
- assert.ok(model.numContainers);
- assert.ok(model.usedMemoryMB);
- assert.ok(model.availMemoryMB);
- assert.ok(model.usedVirtualCores);
- assert.ok(model.availableVirtualCores);
- assert.ok(model.version);
- assert.ok(model.nodeLabels);
- assert.ok(model.nodeLabelsAsString);
- assert.ok(model.nodeStateStyle);
- assert.ok(model.isDummyNode);
- assert.ok(model.getMemoryDataForDonutChart);
- assert.ok(model.getVCoreDataForDonutChart);
-});
-
-test('test fields', function(assert) {
- let model = this.subject();
-
- Ember.run(function () {
- model.set("rack", "/default-rack");
- model.set("state", "RUNNING");
- model.set("nodeHostName", "localhost");
- model.set("id", "localhost:64318");
- model.set("nodeHTTPAddress", "localhost:8042");
- model.set("usedMemoryMB", 1024);
- model.set("availMemoryMB", 7168);
- model.set("usedVirtualCores", 1);
- model.set("availableVirtualCores", 7);
- model.set("nodeLabels", ["x"]);
- assert.equal(model.get("rack"), "/default-rack");
- assert.equal(model.get("state"), "RUNNING");
- assert.equal(model.get("nodeHostName"), "localhost");
- assert.equal(model.get("id"), "localhost:64318");
- assert.equal(model.get("nodeHTTPAddress"), "localhost:8042");
- assert.equal(model.get("usedMemoryMB"), 1024);
- assert.equal(model.get("availMemoryMB"), 7168);
- assert.equal(model.get("usedVirtualCores"), 1);
- assert.equal(model.get("availableVirtualCores"), 7);
- assert.equal(model.get("isDummyNode"), false);
- assert.deepEqual(model.get("nodeLabels"), ["x"]);
- assert.equal(model.get("nodeLabelsAsString"), "x");
- assert.deepEqual(model.get("nodeStateStyle"), "label label-success");
- assert.deepEqual(model.get("getMemoryDataForDonutChart"),
- [{label: "Used", value: 1024}, {label: "Available", value: 7168}]);
- assert.deepEqual(model.get("getVCoreDataForDonutChart"),
- [{label: "Used", value: 1}, {label: "Available", value: 7}]);
- model.set("state", "SHUTDOWN");
- assert.deepEqual(model.get("nodeStateStyle"), "label label-danger");
- model.set("state", "REBOOTED");
- assert.deepEqual(model.get("nodeStateStyle"), "label label-warning");
- model.set("state", "NEW");
- assert.deepEqual(model.get("nodeStateStyle"), "label label-default");
- model.set("nodeLabels", ["x","y"]);
- assert.equal(model.get("nodeLabelsAsString"), "x");
- model.set("nodeLabels", undefined);
- assert.equal(model.get("nodeLabelsAsString"), "");
- });
-});
-
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-apps-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-apps-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-apps-test.js
deleted file mode 100644
index a438b2e..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-apps-test.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('route:yarn-apps', 'Unit | Route | yarn apps', {
- // Specify the other units that are required for this test.
- // needs: ['controller:foo']
-});
-
-test('it exists', function(assert) {
- var route = this.subject();
- assert.ok(route);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-container-log-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-container-log-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-container-log-test.js
deleted file mode 100644
index 4e68da0..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-container-log-test.js
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleFor, test } from 'ember-qunit';
-import Constants from 'yarn-ui/constants';
-
-moduleFor('route:yarn-container-log', 'Unit | Route | ContainerLog', {
-});
-
-test('Basic creation test', function(assert) {
- let route = this.subject();
- assert.ok(route);
- assert.ok(route.model);
-});
-
-test('Test getting container log', function(assert) {
- var response = {
- logs: "This is syslog",
- containerID: "container_e32_1456000363780_0002_01_000001",
- logFileName: "syslog"};
- var store = {
- findRecord: function(type) {
- return new Ember.RSVP.Promise(function(resolve) {
- resolve(response);
- }
- )}
- };
- assert.expect(6);
- var route = this.subject();
- route.set('store', store);
- var model = route.model({node_id: "localhost:64318",
- node_addr: "localhost:8042",
- container_id: "container_e32_1456000363780_0002_01_000001",
- filename: "syslog"});
- model.then(function(value) {
- assert.ok(value);
- assert.ok(value.containerLog);
- assert.deepEqual(value.containerLog, response);
- assert.ok(value.nodeInfo);
- assert.equal(value.nodeInfo.addr, 'localhost:8042');
- assert.equal(value.nodeInfo.id, 'localhost:64318');
- });
-});
-
-/**
- * This can happen when an empty response is sent from server
- */
-test('Test non HTTP error while getting container log', function(assert) {
- var error = {};
- var response = {
- logs: "",
- containerID: "container_e32_1456000363780_0002_01_000001",
- logFileName: "syslog"};
- var store = {
- findRecord: function(type) {
- return new Ember.RSVP.Promise(function(resolve, reject) {
- reject(error);
- }
- )}
- };
- assert.expect(6);
- var route = this.subject();
- route.set('store', store);
- var model = route.model({node_id: "localhost:64318",
- node_addr: "localhost:8042",
- container_id: "container_e32_1456000363780_0002_01_000001",
- filename: "syslog"});
- model.then(function(value) {
- assert.ok(value);
- assert.ok(value.containerLog);
- assert.deepEqual(value.containerLog, response);
- assert.ok(value.nodeInfo);
- assert.equal(value.nodeInfo.addr, 'localhost:8042');
- assert.equal(value.nodeInfo.id, 'localhost:64318');
- });
-});
-
-test('Test HTTP error while getting container log', function(assert) {
- var error = {errors: [{status: 404, responseText: 'Not Found'}]};
- var response = {
- logs: "",
- containerID: "container_e32_1456000363780_0002_01_000001",
- logFileName: "syslog"};
- var store = {
- findRecord: function(type) {
- return new Ember.RSVP.Promise(function(resolve, reject) {
- reject(error);
- }
- )}
- };
- assert.expect(5);
- var route = this.subject();
- route.set('store', store);
- var model = route.model({node_id: "localhost:64318",
- node_addr: "localhost:8042",
- container_id: "container_e32_1456000363780_0002_01_000001",
- filename: "syslog"});
- model.then(function(value) {
- assert.ok(value);
- assert.ok(value.errors);
- assert.equal(value.errors.length, 1);
- assert.equal(value.errors[0].status, 404);
- assert.equal(value.errors[0].responseText, 'Not Found');
- });
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-app-test.js
deleted file mode 100644
index 8e5acf9..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-app-test.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('route:yarn-node-app', 'Unit | Route | NodeApp', {
-});
-
-test('Basic creation test', function(assert) {
- let route = this.subject();
- assert.ok(route);
- assert.ok(route.model);
-});
-
-test('Test getting specific app on a node', function(assert) {
- var response =
- {id:"application_1456251210105_0001", state:"FINISHED", user:"root"};
- var store = {
- queryRecord: function(type, query) {
- return new Ember.RSVP.Promise(function(resolve) {
- resolve(response);
- });
- }
- };
- assert.expect(6);
- var route = this.subject();
- route.set('store', store);
- var model =
- route.model({node_id:"localhost:64318", node_addr:"localhost:8042",
- app_id:"application_1456251210105_0001"}).
- then(
- function(value){
- assert.ok(value);
- assert.ok(value.nodeApp);
- assert.deepEqual(value.nodeApp, response);
- assert.ok(value.nodeInfo);
- assert.equal(value.nodeInfo.addr, 'localhost:8042');
- assert.equal(value.nodeInfo.id, 'localhost:64318');
- }
- );
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-apps-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-apps-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-apps-test.js
deleted file mode 100644
index 44d9995..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-apps-test.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('route:yarn-node-apps', 'Unit | Route | NodeApps', {
-});
-
-test('Basic creation test', function(assert) {
- let route = this.subject();
- assert.ok(route);
- assert.ok(route.model);
-});
-
-test('Test getting apps on a node', function(assert) {
- var response = [
- {id:"application_1456251210105_0001", state:"FINISHED", user:"root"},
- {id:"application_1456251210105_0002", state:"RUNNING",user:"root",
- containerids:["container_e38_1456251210105_0002_01_000001",
- "container_e38_1456251210105_0002_01_000002"]}];
- var store = {
- query: function(type, query) {
- return new Ember.RSVP.Promise(function(resolve) {
- resolve(response.slice());
- });
- }
- };
- assert.expect(8);
- var route = this.subject();
- route.set('store', store);
- var model =
- route.model({node_id:"localhost:64318", node_addr:"localhost:8042"}).
- then(
- function(value){
- assert.ok(value);
- assert.ok(value.apps);
- assert.equal(value.apps.length, 2);
- assert.deepEqual(response[0], value.apps[0]);
- assert.deepEqual(response[1], value.apps[1]);
- assert.ok(value.nodeInfo);
- assert.equal(value.nodeInfo.addr, 'localhost:8042');
- assert.equal(value.nodeInfo.id, 'localhost:64318');
- }
- );
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-container-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-container-test.js
deleted file mode 100644
index f0b68fc..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-container-test.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('route:yarn-node-container', 'Unit | Route | NodeContainer', {
-});
-
-test('Basic creation test', function(assert) {
- let route = this.subject();
- assert.ok(route);
- assert.ok(route.model);
-});
-
-test('Test getting specific container on a node', function(assert) {
- var response =
- {id: "container_e32_1456000363780_0002_01_000001", state: "RUNNING",
- exitCode:-1000,diagnostics:"",user:"root",totalMemoryNeededMB:2048,
- totalVCoresNeeded:1,containerLogsLink: "http://localhost:8042/node/" +
- "containerlogs/container_e32_1456000363780_0002_01_000001/root",
- nodeId: "localhost:64318", containerLogFiles:["syslog","stderr",
- "stdout"]};
- var store = {
- queryRecord: function(type, query) {
- return new Ember.RSVP.Promise(function(resolve) {
- resolve(response);
- });
- }
- };
- assert.expect(6);
- var route = this.subject();
- route.set('store', store);
- var model =
- route.model({node_id:"localhost:64318", node_addr:"localhost:8042",
- container_id:"container_e32_1456000363780_0002_01_000001"}).
- then(
- function(value){
- assert.ok(value);
- assert.ok(value.nodeContainer);
- assert.deepEqual(value.nodeContainer, response);
- assert.ok(value.nodeInfo);
- assert.equal(value.nodeInfo.addr, 'localhost:8042');
- assert.equal(value.nodeInfo.id, 'localhost:64318');
- }
- );
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-containers-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-containers-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-containers-test.js
deleted file mode 100644
index 8359713..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-containers-test.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('route:yarn-node-containers', 'Unit | Route | NodeContainers', {
-});
-
-test('Basic creation test', function(assert) {
- let route = this.subject();
- assert.ok(route);
- assert.ok(route.model);
-});
-
-test('Test getting apps on a node', function(assert) {
- var response =
- [{id: "container_e32_1456000363780_0002_01_000001", state: "RUNNING",
- exitCode:-1000,diagnostics:"",user:"root",totalMemoryNeededMB:2048,
- totalVCoresNeeded:1,containerLogsLink: "http://localhost:8042/node/" +
- "containerlogs/container_e32_1456000363780_0002_01_000001/root",
- nodeId: "localhost:64318", containerLogFiles:["syslog","stderr",
- "stdout"]},
- {id:"container_e32_1456000363780_0002_01_000003", state:"RUNNING",
- exitCode:-1000, diagnostics:"", user:"root", totalMemoryNeededMB:1024,
- totalVCoresNeeded:1,containerLogsLink:"http://localhost:8042/node" +
- "/containerlogs/container_e32_1456000363780_0002_01_000003/root",
- nodeId:"localhost:64318",containerLogFiles:["syslog","stderr",
- "syslog.shuffle","stdout"]}];
- var store = {
- query: function(type, query) {
- return new Ember.RSVP.Promise(function(resolve) {
- resolve(response.slice());
- });
- }
- };
- assert.expect(8);
- var route = this.subject();
- route.set('store', store);
- var model =
- route.model({node_id:"localhost:64318", node_addr:"localhost:8042"}).
- then(
- function(value){
- assert.ok(value);
- assert.ok(value.containers);
- assert.equal(value.containers.length, 2);
- assert.deepEqual(value.containers[0], response[0]);
- assert.deepEqual(value.containers[1], response[1]);
- assert.ok(value.nodeInfo);
- assert.equal(value.nodeInfo.addr, 'localhost:8042');
- assert.equal(value.nodeInfo.id, 'localhost:64318');
- }
- );
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-test.js
deleted file mode 100644
index 4e82f1b..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-node-test.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleFor, test } from 'ember-qunit';
-import Ember from 'ember';
-
-moduleFor('route:yarn-node', 'Unit | Route | Node', {
-});
-
-test('Basic creation test', function(assert) {
- let route = this.subject();
- assert.ok(route);
- assert.ok(route.model);
-});
-
-test('Test getting a node', function(assert) {
- var nodeResponse =
- {healthReport: "Healthy", totalVmemAllocatedContainersMB: 344064,
- totalPmemAllocatedContainersMB: 163840,
- totalVCoresAllocatedContainers: 160,
- vmemCheckEnabled: true, pmemCheckEnabled: true,
- lastNodeUpdateTime: 1456250210310, nodeHealthy: true,
- nodeManagerVersion: "3.0.0-SNAPSHOT",
- nodeManagerBuildVersion: "3.0.0-SNAPSHOT",
- nodeManagerVersionBuiltOn: "2000-01-01T00:00Z",
- hadoopVersion: "3.0.0-SNAPSHOT",
- hadoopBuildVersion: "3.0.0-SNAPSHOT",
- hadoopVersionBuiltOn: "2000-01-01T00:00Z",
- id: "localhost:64318", nodeHostName: "192.168.0.102",
- nmStartupTime: 1456250208231};
- var rmNodeResponse =
- {rack: "/default-rack", state: "RUNNING", id: "localhost:64318",
- nodeHostName: "localhost", nodeHTTPAddress: "localhost:8042",
- lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
- healthReport: "", numContainers: 0, usedMemoryMB: 0,
- availMemoryMB: 163840, usedVirtualCores: 0,
- availableVirtualCores: 160,
- resourceUtilization: {
- nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
- nodeCPUUsage: 0.14995001256465912,
- aggregatedContainersPhysicalMemoryMB: 0,
- aggregatedContainersVirtualMemoryMB: 0,
- containersCPUUsage: 0
- }};
-
- // Create store which returns appropriate responses.
- var store = {
- findRecord: function(type) {
- if (type == 'yarnNode') {
- return new Ember.RSVP.Promise(function(resolve) {
- resolve(nodeResponse);
- });
- } else if (type == 'yarnRmNode') {
- return new Ember.RSVP.Promise(function(resolve) {
- resolve(rmNodeResponse);
- });
- }
- }
- };
- var route = this.subject();
- assert.expect(4);
- route.set('store', store);
- var model = route.model(
- {node_addr:"localhost:8042", node_id:"localhost:64318"})._result;
- assert.ok(model.node);
- assert.deepEqual(model.node, nodeResponse);
- assert.ok(model.rmNode);
- assert.deepEqual(model.rmNode, rmNodeResponse);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-nodes-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-nodes-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-nodes-test.js
deleted file mode 100644
index baa5bd6..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/routes/yarn-nodes-test.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleFor, test } from 'ember-qunit';
-import Ember from 'ember';
-
-moduleFor('route:yarn-nodes', 'Unit | Route | Nodes', {
-});
-
-test('Basic creation test', function(assert) {
- let route = this.subject();
- assert.ok(route);
- assert.ok(route.model);
-});
-
-test('Test getting nodes', function(assert) {
- var response = [{
- rack: "/default-rack", state: "RUNNING", id: "192.168.1.1:64318",
- nodeHostName: "192.168.1.1", nodeHTTPAddress: "192.168.1.1:8042",
- lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
- healthReport: "", numContainers: 0, usedMemoryMB: 0,
- availMemoryMB: 163840, usedVirtualCores: 0,
- availableVirtualCores: 160,
- resourceUtilization: {
- nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
- nodeCPUUsage: 0.14995001256465912,
- aggregatedContainersPhysicalMemoryMB: 0,
- aggregatedContainersVirtualMemoryMB: 0,
- containersCPUUsage: 0
- }},
- {rack: "/default-rack", state: "RUNNING", id: "192.168.1.2:64318",
- nodeHostName: "192.168.1.2", nodeHTTPAddress: "192.168.1.2:8042",
- lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
- healthReport: "", numContainers: 0, usedMemoryMB: 0,
- availMemoryMB: 163840, usedVirtualCores: 0,
- availableVirtualCores: 160,
- resourceUtilization: {
- nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
- nodeCPUUsage: 0.14995001256465912,
- aggregatedContainersPhysicalMemoryMB: 0,
- aggregatedContainersVirtualMemoryMB: 0,
- containersCPUUsage: 0
- }}];
- var store = {
- findAll: function(type) {
- return new Ember.RSVP.Promise(function(resolve) {
- resolve(response);
- });
- }
- };
- var route = this.subject();
- route.set('store', store);
- var model = route.model()._result;
- assert.expect(4);
- assert.ok(model);
- assert.equal(model.length, 2);
- assert.deepEqual(response[0], model[0]);
- assert.deepEqual(response[1], model[1]);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-app-test.js
deleted file mode 100644
index a169fd5..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-app-test.js
+++ /dev/null
@@ -1,15 +0,0 @@
-import { moduleForModel, test } from 'ember-qunit';
-
-moduleForModel('yarn-app', 'Unit | Serializer | yarn app', {
- // Specify the other units that are required for this test.
- needs: ['serializer:yarn-app']
-});
-
-// Replace this with your real tests.
-test('it serializes records', function(assert) {
- var record = this.subject();
-
- var serializedRecord = record.serialize();
-
- assert.ok(serializedRecord);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-container-log-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-container-log-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-container-log-test.js
deleted file mode 100644
index 2349dc2..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-container-log-test.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('serializer:yarn-container-log', 'Unit | Serializer | ContainerLog', {
-});
-
-test('Basic creation test', function(assert) {
- let serializer = this.subject();
-
- assert.ok(serializer);
- assert.ok(serializer.normalizeSingleResponse);
-});
-
-test('normalizeSingleResponse test', function(assert) {
- let serializer = this.subject(),
- modelClass = {
- modelName: "yarn-container-log"
- },
- payload = "This is syslog";
- var id = "localhost:64318!container_e32_1456000363780_0002_01_000001!syslog";
- assert.expect(6);
- var response =
- serializer.normalizeSingleResponse({}, modelClass, payload, id, null);
- assert.ok(response.data);
- assert.equal(response.data.id, id);
- assert.equal(response.data.type, modelClass.modelName);
- assert.equal(response.data.attributes.logs, payload);
- assert.equal(response.data.attributes.containerID,
- "container_e32_1456000363780_0002_01_000001");
- assert.equal(response.data.attributes.logFileName, "syslog");
-});
-
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-app-test.js
deleted file mode 100644
index 21a715c..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-app-test.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('serializer:yarn-node-app', 'Unit | Serializer | NodeApp', {
-});
-
-test('Basic creation test', function(assert) {
- let serializer = this.subject();
-
- assert.ok(serializer);
- assert.ok(serializer.normalizeSingleResponse);
- assert.ok(serializer.normalizeArrayResponse);
- assert.ok(serializer.internalNormalizeSingleResponse);
-});
-
-test('normalizeArrayResponse test', function(assert) {
- let serializer = this.subject(),
- modelClass = {
- modelName: "yarn-node-app"
- },
- payload = {
- apps: {
- app: [{
- id:"application_1456251210105_0001", state:"FINISHED", user:"root"
- },{
- id:"application_1456251210105_0002", state:"RUNNING",user:"root",
- containerids:["container_e38_1456251210105_0002_01_000001",
- "container_e38_1456251210105_0002_01_000002"]
- }]
- }
- };
- assert.expect(15);
- var response =
- serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
- assert.ok(response.data);
- assert.equal(response.data.length, 2);
- assert.equal(response.data[0].attributes.containers, undefined);
- assert.equal(response.data[1].attributes.containers.length, 2);
- assert.deepEqual(response.data[1].attributes.containers,
- payload.apps.app[1].containerids);
- for (var i = 0; i < 2; i++) {
- assert.equal(response.data[i].type, modelClass.modelName);
- assert.equal(response.data[i].id, payload.apps.app[i].id);
- assert.equal(response.data[i].attributes.appId, payload.apps.app[i].id);
- assert.equal(response.data[i].attributes.state, payload.apps.app[i].state);
- assert.equal(response.data[i].attributes.user, payload.apps.app[i].user);
- }
-});
-
-test('normalizeArrayResponse no apps test', function(assert) {
- let serializer = this.subject(),
- modelClass = {
- modelName: "yarn-node-app"
- },
- payload = { apps: null };
- assert.expect(5);
- var response =
- serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
- assert.ok(response.data);
- assert.equal(response.data.length, 1);
- assert.equal(response.data[0].type, modelClass.modelName);
- assert.equal(response.data[0].id, "dummy");
- assert.equal(response.data[0].attributes.appId, undefined);
-});
-
-test('normalizeSingleResponse test', function(assert) {
- let serializer = this.subject(),
- modelClass = {
- modelName: "yarn-node-app"
- },
- payload = {
- app: {id:"application_1456251210105_0001", state:"FINISHED", user:"root"}
- };
- assert.expect(7);
- var response =
- serializer.normalizeSingleResponse({}, modelClass, payload, null, null);
- assert.ok(response.data);
- assert.equal(payload.app.id, response.data.id);
- assert.equal(modelClass.modelName, response.data.type);
- assert.equal(payload.app.id, response.data.attributes.appId);
- assert.equal(payload.app.state, response.data.attributes.state);
- assert.equal(payload.app.user, response.data.attributes.user);
- assert.equal(response.data.attributes.containers, undefined);
-});
-
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-container-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-container-test.js
deleted file mode 100644
index 1f08467..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-container-test.js
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('serializer:yarn-node-container', 'Unit | Serializer | NodeContainer', {
-});
-
-test('Basic creation test', function(assert) {
- let serializer = this.subject();
-
- assert.ok(serializer);
- assert.ok(serializer.normalizeSingleResponse);
- assert.ok(serializer.normalizeArrayResponse);
- assert.ok(serializer.internalNormalizeSingleResponse);
-});
-
-test('normalizeArrayResponse test', function(assert) {
- let serializer = this.subject(),
- modelClass = {
- modelName: "yarn-node-container"
- },
- payload = {
- containers: {
- container: [{
- id: "container_e32_1456000363780_0002_01_000001", state: "RUNNING",
- exitCode:-1000,diagnostics:"",user:"root",totalMemoryNeededMB:2048,
- totalVCoresNeeded:1,containerLogsLink: "http://localhost:8042/node/" +
- "containerlogs/container_e32_1456000363780_0002_01_000001/root",
- nodeId: "localhost:64318", containerLogFiles:["syslog","stderr",
- "stdout"]
- },{
- id:"container_e32_1456000363780_0002_01_000003", state:"RUNNING",
- exitCode:-1000, diagnostics:"", user:"root", totalMemoryNeededMB:1024,
- totalVCoresNeeded:1,containerLogsLink:"http://localhost:8042/node" +
- "/containerlogs/container_e32_1456000363780_0002_01_000003/root",
- nodeId:"localhost:64318",containerLogFiles:["syslog","stderr",
- "syslog.shuffle","stdout"]
- }]
- }
- };
- assert.expect(14);
- var response =
- serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
- assert.ok(response.data);
- assert.equal(response.data.length, 2);
- assert.equal(response.data[0].id,
- "container_e32_1456000363780_0002_01_000001");
- assert.equal(response.data[1].id,
- "container_e32_1456000363780_0002_01_000003");
- assert.equal(response.data[0].attributes.containerLogFiles.length, 3);
- assert.equal(response.data[1].attributes.containerLogFiles.length, 4);
- for (var i = 0; i < 2; i++) {
- assert.equal(response.data[i].type, modelClass.modelName);
- assert.deepEqual(response.data[i].attributes.containerLogFiles,
- payload.containers.container[i].containerLogFiles);
- assert.equal(response.data[i].attributes.state,
- payload.containers.container[i].state);
- assert.equal(response.data[i].attributes.user,
- payload.containers.container[i].user);
- }
-});
-
-test('normalizeArrayResponse no containers test', function(assert) {
- let serializer = this.subject(),
- modelClass = {
- modelName: "yarn-node-container"
- },
- payload = { containers: null };
- assert.expect(5);
- var response =
- serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
- assert.ok(response.data);
- assert.equal(response.data.length, 1);
- assert.equal(response.data[0].type, modelClass.modelName);
- assert.equal(response.data[0].id, "dummy");
- assert.equal(response.data[0].attributes.containerId, undefined);
-});
-
-test('normalizeSingleResponse test', function(assert) {
- let serializer = this.subject(),
- modelClass = {
- modelName: "yarn-node-container"
- },
- payload = {
- container: {
- id: "container_e32_1456000363780_0002_01_000001", state: "RUNNING",
- exitCode:-1000,diagnostics:"",user:"root",totalMemoryNeededMB:2048,
- totalVCoresNeeded:1,containerLogsLink: "http://localhost:8042/node/" +
- "containerlogs/container_e32_1456000363780_0002_01_000001/root",
- nodeId: "localhost:64318", containerLogFiles:["syslog","stderr",
- "stdout"]
- }
- };
- assert.expect(11);
- var response =
- serializer.normalizeSingleResponse({}, modelClass, payload, null, null);
- assert.ok(response.data);
- assert.equal(response.data.id, payload.container.id);
- assert.equal(response.data.type, modelClass.modelName);
- assert.equal(response.data.attributes.containerId, payload.container.id);
- assert.equal(response.data.attributes.state, payload.container.state);
- assert.equal(response.data.attributes.user, payload.container.user);
- assert.equal(response.data.attributes.exitCode, payload.container.exitCode);
- assert.equal(response.data.attributes.totalMemoryNeededMB,
- payload.container.totalMemoryNeeded);
- assert.equal(response.data.attributes.totalVCoresNeeded,
- payload.container.totalVCoresNeeded);
- assert.equal(response.data.attributes.containerLogFiles.length, 3);
- assert.deepEqual(response.data.attributes.containerLogFiles,
- payload.container.containerLogFiles);
-});
-
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-test.js
deleted file mode 100644
index 0e76ccb..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-test.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleFor, test } from 'ember-qunit';
-import Converter from 'yarn-ui/utils/converter';
-
-moduleFor('serializer:yarn-node', 'Unit | Serializer | Node', {
-});
-
-test('Basic creation test', function(assert) {
- let serializer = this.subject();
-
- assert.ok(serializer);
- assert.ok(serializer.normalizeSingleResponse);
- assert.ok(serializer.internalNormalizeSingleResponse);
-});
-
-test('normalizeSingleResponse test', function(assert) {
- let serializer = this.subject(),
- modelClass = {
- modelName: "yarn-node"
- },
- payload = {
- nodeInfo: {
- healthReport: "Healthy", totalVmemAllocatedContainersMB: 344064,
- totalPmemAllocatedContainersMB: 163840,
- totalVCoresAllocatedContainers: 160,
- vmemCheckEnabled: true, pmemCheckEnabled: true,
- lastNodeUpdateTime: 1456250210310, nodeHealthy: true,
- nodeManagerVersion: "3.0.0-SNAPSHOT",
- nodeManagerBuildVersion: "3.0.0-SNAPSHOT",
- nodeManagerVersionBuiltOn: "2000-01-01T00:00Z",
- hadoopVersion: "3.0.0-SNAPSHOT",
- hadoopBuildVersion: "3.0.0-SNAPSHOT",
- hadoopVersionBuiltOn: "2000-01-01T00:00Z",
- id: "localhost:64318", nodeHostName: "192.168.0.102",
- nmStartupTime: 1456250208231
- }
- };
- assert.expect(6);
- var id = "localhost:64318";
- var response = serializer.normalizeSingleResponse({}, modelClass, payload, id, null);
- assert.equal(response.data.id, id);
- assert.equal(response.data.type, modelClass.modelName);
- assert.equal(response.data.attributes.totalVmemAllocatedContainersMB,
- payload.nodeInfo.totalVmemAllocatedContainersMB);
- assert.equal(response.data.attributes.totalPmemAllocatedContainersMB,
- payload.nodeInfo.totalPmemAllocatedContainersMB);
- assert.equal(response.data.attributes.totalVCoresAllocatedContainers,
- payload.nodeInfo.totalVCoresAllocatedContainers);
- assert.equal(response.data.attributes.nmStartupTime,
- Converter.timeStampToDate(payload.nodeInfo.nmStartupTime));
-});
-
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-rm-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-rm-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-rm-node-test.js
deleted file mode 100644
index bc6397d..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-rm-node-test.js
+++ /dev/null
@@ -1,153 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('serializer:yarn-rm-node', 'Unit | Serializer | RMNode', {
-});
-
-test('Basic creation test', function(assert) {
- let serializer = this.subject();
-
- assert.ok(serializer);
- assert.ok(serializer.normalizeSingleResponse);
- assert.ok(serializer.normalizeArrayResponse);
- assert.ok(serializer.internalNormalizeSingleResponse);
-});
-
-test('normalizeArrayResponse test', function(assert) {
- let serializer = this.subject(),
- modelClass = {
- modelName: "yarn-rm-node"
- },
- payload = {
- nodes: {
- node: [{
- rack: "/default-rack", state: "RUNNING", id: "192.168.1.1:64318",
- nodeHostName: "192.168.1.1", nodeHTTPAddress: "192.168.1.1:8042",
- lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
- healthReport: "", numContainers: 0, usedMemoryMB: 2048,
- availMemoryMB: 161792, usedVirtualCores: 2,
- availableVirtualCores: 158, nodeLabels: ["x"],
- resourceUtilization: {
- nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
- nodeCPUUsage: 0.14995001256465912,
- aggregatedContainersPhysicalMemoryMB: 0,
- aggregatedContainersVirtualMemoryMB: 0,
- containersCPUUsage: 0
- }
- },{
- rack: "/default-rack", state: "RUNNING", id: "192.168.1.2:64318",
- nodeHostName: "192.168.1.2", nodeHTTPAddress: "192.168.1.2:8042",
- lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
- healthReport: "", numContainers: 0, usedMemoryMB: 0,
- availMemoryMB: 163840, usedVirtualCores: 0,
- availableVirtualCores: 160, nodeLabels: ["y"],
- resourceUtilization: {
- nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
- nodeCPUUsage: 0.14995001256465912,
- aggregatedContainersPhysicalMemoryMB: 0,
- aggregatedContainersVirtualMemoryMB: 0,
- containersCPUUsage: 0
- }
- }]
- }
- };
- assert.expect(12);
- var response =
- serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
- assert.ok(response.data);
- assert.equal(response.data.length, 2);
- assert.equal(response.data[0].id, "192.168.1.1:64318");
- assert.equal(response.data[1].id, "192.168.1.2:64318");
- for (var i = 0; i < 2; i++) {
- assert.equal(response.data[i].type, modelClass.modelName);
- assert.equal(response.data[i].attributes.nodeHostName,
- payload.nodes.node[i].nodeHostName);
- assert.equal(response.data[i].attributes.nodeHTTPAddress,
- payload.nodes.node[i].nodeHTTPAddress);
- assert.deepEqual(response.data[i].attributes.nodeLabels,
- payload.nodes.node[i].nodeLabels);
- }
-});
-
-test('normalizeArrayResponse no nodes test', function(assert) {
- let serializer = this.subject(),
- modelClass = {
- modelName: "yarn-rm-node"
- },
- payload = { nodes: null };
- assert.expect(5);
- var response =
- serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
- console.log(response);
- assert.ok(response.data);
- assert.equal(response.data.length, 1);
- assert.equal(response.data[0].type, modelClass.modelName);
- assert.equal(response.data[0].id, "dummy");
- assert.equal(response.data[0].attributes.nodeHostName, undefined);
-});
-
-test('normalizeSingleResponse test', function(assert) {
- let serializer = this.subject(),
- modelClass = {
- modelName: "yarn-rm-node"
- },
- payload = {
- node: {
- rack: "/default-rack", state: "RUNNING", id: "192.168.1.1:64318",
- nodeHostName: "192.168.1.1", nodeHTTPAddress: "192.168.1.1:8042",
- lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
- healthReport: "", numContainers: 0, usedMemoryMB: 2048,
- availMemoryMB: 161792, usedVirtualCores: 2,
- availableVirtualCores: 158, nodeLabels: ["x"],
- resourceUtilization: {
- nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
- nodeCPUUsage: 0.14995001256465912,
- aggregatedContainersPhysicalMemoryMB: 0,
- aggregatedContainersVirtualMemoryMB: 0,
- containersCPUUsage: 0
- }
- }
- };
- assert.expect(13);
- var id = "localhost:64318";
- var response =
- serializer.normalizeSingleResponse({}, modelClass, payload, id, null);
- assert.ok(response.data);
- assert.equal(response.data.id, id);
- assert.equal(response.data.type, modelClass.modelName);
- assert.equal(response.data.attributes.rack, payload.node.rack);
- assert.equal(response.data.attributes.state, payload.node.state);
- assert.equal(response.data.attributes.nodeHostName,
- payload.node.nodeHostName);
- assert.equal(response.data.attributes.nodeHTTPAddress,
- payload.node.nodeHTTPAddress);
- assert.equal(response.data.attributes.version, payload.node.version);
- assert.equal(response.data.attributes.availMemoryMB,
- payload.node.availMemoryMB);
- assert.equal(response.data.attributes.usedMemoryMB,
- payload.node.usedMemoryMB);
- assert.equal(response.data.attributes.availableVirtualCores,
- payload.node.availableVirtualCores);
- assert.equal(response.data.attributes.usedVirtualCores,
- payload.node.usedVirtualCores);
- assert.deepEqual(response.data.attributes.nodeLabels,
- payload.node.nodeLabels);
-});
-
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/converter-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/converter-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/converter-test.js
deleted file mode 100644
index 481537d..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/converter-test.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * 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.
- */
-
-import converter from '../../../utils/converter';
-import { module, test } from 'qunit';
-
-module('Unit | Utility | Converter');
-
-// Replace this with your real tests.
-test('it works', function(assert) {
- assert.ok(converter);
- assert.ok(converter.splitForContainerLogs);
-});
-
-test('split for container logs', function(assert) {
- var id = "localhost:64318!container_e32_1456000363780_0002_01_000001!" +
- "syslog";
- var arr = converter.splitForContainerLogs(id);
- assert.ok(arr);
- assert.deepEqual(arr, ["localhost:64318",
- "container_e32_1456000363780_0002_01_000001", "syslog"]);
- id = "localhost:64318!container_e32_1456000363780_0002_01_000001!" +
- "syslog!logs";
- arr = converter.splitForContainerLogs(id);
- assert.ok(arr);
- assert.deepEqual(arr, ["localhost:64318",
- "container_e32_1456000363780_0002_01_000001", "syslog!logs"]);
- id = "localhost:64318!container_e32_1456000363780_0002_01_000001";
- arr = converter.splitForContainerLogs(id);
- assert.notOk(arr);
- id = null;
- arr = converter.splitForContainerLogs(id);
- assert.notOk(arr);
- id = undefined;
- arr = converter.splitForContainerLogs(id);
- assert.notOk(arr);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/sorter-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/sorter-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/sorter-test.js
deleted file mode 100644
index 8f17380..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/sorter-test.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * 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.
- */
-
-import Sorter from 'yarn-ui/utils/sorter';
-import { module, test } from 'qunit';
-
-module('Unit | Utility | Sorter');
-
-test('Basic creation test', function(assert) {
- assert.ok(Sorter);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/vendor/.gitkeep
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/vendor/.gitkeep b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/vendor/.gitkeep
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/pom.xml
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/pom.xml b/hadoop-yarn-project/hadoop-yarn/pom.xml
index 3353e33..8c1e042 100644
--- a/hadoop-yarn-project/hadoop-yarn/pom.xml
+++ b/hadoop-yarn-project/hadoop-yarn/pom.xml
@@ -230,6 +230,7 @@
</profiles>
<modules>
+ <module>hadoop-yarn-ui</module>
<module>hadoop-yarn-api</module>
<module>hadoop-yarn-common</module>
<module>hadoop-yarn-server</module>
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[28/50] [abbrv] hadoop git commit: HADOOP-13299. JMXJsonServlet is
vulnerable to TRACE. (Haibo Chen via kasha)
Posted by wa...@apache.org.
HADOOP-13299. JMXJsonServlet is vulnerable to TRACE. (Haibo Chen via kasha)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/85422bb7
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/85422bb7
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/85422bb7
Branch: refs/heads/YARN-3368
Commit: 85422bb7c5d3e70a49f620ba1c8800e0ba4b64f2
Parents: 0f701f4
Author: Karthik Kambatla <ka...@cloudera.com>
Authored: Tue Aug 9 13:42:25 2016 -0700
Committer: Karthik Kambatla <ka...@cloudera.com>
Committed: Tue Aug 9 13:42:32 2016 -0700
----------------------------------------------------------------------
.../java/org/apache/hadoop/jmx/JMXJsonServlet.java | 11 ++++++++++-
.../java/org/apache/hadoop/jmx/TestJMXJsonServlet.java | 13 +++++++++++++
2 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/85422bb7/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/jmx/JMXJsonServlet.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/jmx/JMXJsonServlet.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/jmx/JMXJsonServlet.java
index 9ade62f..b6ec7bc 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/jmx/JMXJsonServlet.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/jmx/JMXJsonServlet.java
@@ -147,7 +147,16 @@ public class JMXJsonServlet extends HttpServlet {
return HttpServer2.isInstrumentationAccessAllowed(getServletContext(),
request, response);
}
-
+
+ /**
+ * Disable TRACE method to avoid TRACE vulnerability.
+ */
+ @Override
+ protected void doTrace(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException {
+ resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
+ }
+
/**
* Process a GET request for the specified resource.
*
http://git-wip-us.apache.org/repos/asf/hadoop/blob/85422bb7/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/jmx/TestJMXJsonServlet.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/jmx/TestJMXJsonServlet.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/jmx/TestJMXJsonServlet.java
index cf7014d..035090e 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/jmx/TestJMXJsonServlet.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/jmx/TestJMXJsonServlet.java
@@ -24,6 +24,8 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.regex.Matcher;
@@ -81,4 +83,15 @@ public class TestJMXJsonServlet extends HttpServerFunctionalTest {
assertEquals("GET", conn.getHeaderField(ACCESS_CONTROL_ALLOW_METHODS));
assertNotNull(conn.getHeaderField(ACCESS_CONTROL_ALLOW_ORIGIN));
}
+
+ @Test
+ public void testTraceRequest() throws IOException {
+ URL url = new URL(baseUrl, "/jmx");
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ conn.setRequestMethod("TRACE");
+
+ assertEquals("Unexpected response code",
+ HttpServletResponse.SC_METHOD_NOT_ALLOWED, conn.getResponseCode());
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[25/50] [abbrv] hadoop git commit: MAPREDUCE-6750. Fix
TestHSAdminServer#testRefreshSuperUserGroups (Kihwal Lee via Varun Saxena)
Posted by wa...@apache.org.
MAPREDUCE-6750. Fix TestHSAdminServer#testRefreshSuperUserGroups (Kihwal Lee via Varun Saxena)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/c4b77aed
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/c4b77aed
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/c4b77aed
Branch: refs/heads/YARN-3368
Commit: c4b77aed7e756dd463fd88141054ea0e3acd6396
Parents: 3cd386b
Author: Varun Saxena <va...@apache.org>
Authored: Tue Aug 9 23:35:44 2016 +0530
Committer: Varun Saxena <va...@apache.org>
Committed: Tue Aug 9 23:35:44 2016 +0530
----------------------------------------------------------------------
.../apache/hadoop/mapreduce/v2/hs/server/TestHSAdminServer.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c4b77aed/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/server/TestHSAdminServer.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/server/TestHSAdminServer.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/server/TestHSAdminServer.java
index d831347..1eb1d1c 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/server/TestHSAdminServer.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/server/TestHSAdminServer.java
@@ -187,7 +187,8 @@ public class TestHSAdminServer {
when(ugi.getRealUser()).thenReturn(superUser);
when(superUser.getShortUserName()).thenReturn("superuser");
when(superUser.getUserName()).thenReturn("superuser");
- when(ugi.getGroupNames()).thenReturn(new String[] { "group3" });
+ when(ugi.getGroups())
+ .thenReturn(Arrays.asList(new String[] { "group3" }));
when(ugi.getUserName()).thenReturn("regularUser");
// Set super user groups not to include groups of regularUser
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[48/50] [abbrv] hadoop git commit: YARN-5183. [YARN-3368] Support for
responsive navbar when window is resized. (Kai Sasaki via Sunil G)
Posted by wa...@apache.org.
YARN-5183. [YARN-3368] Support for responsive navbar when window is resized. (Kai Sasaki via Sunil G)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/a3d70aaa
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/a3d70aaa
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/a3d70aaa
Branch: refs/heads/YARN-3368
Commit: a3d70aaa1e12d4a5b823e759eb82db7ff17164c4
Parents: 2a32d5d
Author: Sunil <su...@apache.org>
Authored: Fri Jun 10 10:33:41 2016 +0530
Committer: Wangda Tan <wa...@apache.org>
Committed: Tue Aug 9 14:51:19 2016 -0700
----------------------------------------------------------------------
.../hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a3d70aaa/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js
index bce18ce..d21cc3e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js
@@ -32,6 +32,9 @@ module.exports = function(defaults) {
app.import("bower_components/select2/dist/js/select2.min.js");
app.import('bower_components/jquery-ui/jquery-ui.js');
app.import('bower_components/more-js/dist/more.js');
+ app.import('bower_components/bootstrap/dist/css/bootstrap.css');
+ app.import('bower_components/bootstrap/dist/css/bootstrap-theme.css');
+ app.import('bower_components/bootstrap/dist/js/bootstrap.min.js');
// Use `app.import` to add additional libraries to the generated
// output files.
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[20/50] [abbrv] hadoop git commit: YARN-5457. Refactor
DistributedScheduling framework to pull out common functionality. (asuresh)
Posted by wa...@apache.org.
YARN-5457. Refactor DistributedScheduling framework to pull out common functionality. (asuresh)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/82c9e061
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/82c9e061
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/82c9e061
Branch: refs/heads/YARN-3368
Commit: 82c9e061017c32e633e0b0cbb7978749a6df4fb2
Parents: 8f9b618
Author: Arun Suresh <as...@apache.org>
Authored: Fri Aug 5 11:13:05 2016 -0700
Committer: Arun Suresh <as...@apache.org>
Committed: Tue Aug 9 00:42:29 2016 -0700
----------------------------------------------------------------------
.../hadoop/mapred/TestMROpportunisticMaps.java | 2 +
.../hadoop/yarn/conf/YarnConfiguration.java | 107 +++---
.../api/impl/TestDistributedScheduling.java | 4 +-
.../src/main/resources/yarn-default.xml | 50 +--
.../OpportunisticContainerAllocator.java | 378 +++++++++++++++++++
.../OpportunisticContainerContext.java | 178 +++++++++
.../yarn/server/scheduler/package-info.java | 22 ++
.../hadoop/yarn/server/nodemanager/Context.java | 2 +-
.../yarn/server/nodemanager/NodeManager.java | 9 +-
.../amrmproxy/DefaultRequestInterceptor.java | 67 +++-
.../scheduler/DistributedScheduler.java | 264 +++----------
.../OpportunisticContainerAllocator.java | 190 ----------
.../amrmproxy/BaseAMRMProxyTest.java | 2 +-
.../scheduler/TestDistributedScheduler.java | 10 +-
.../DistributedSchedulingAMService.java | 361 ------------------
...pportunisticContainerAllocatorAMService.java | 367 ++++++++++++++++++
.../server/resourcemanager/ResourceManager.java | 32 +-
.../yarn/server/resourcemanager/MockRM.java | 7 +-
.../TestDistributedSchedulingAMService.java | 269 -------------
...pportunisticContainerAllocatorAMService.java | 271 +++++++++++++
20 files changed, 1445 insertions(+), 1147 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/82c9e061/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestMROpportunisticMaps.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestMROpportunisticMaps.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestMROpportunisticMaps.java
index dfe85f2..021863b 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestMROpportunisticMaps.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestMROpportunisticMaps.java
@@ -91,6 +91,8 @@ public class TestMROpportunisticMaps {
Configuration conf = new Configuration();
// Start the mini-MR and mini-DFS clusters
conf.setBoolean(YarnConfiguration.AMRM_PROXY_ENABLED, true);
+ conf.setBoolean(YarnConfiguration.
+ OPPORTUNISTIC_CONTAINER_ALLOCATION_ENABLED, true);
conf.setBoolean(YarnConfiguration.DIST_SCHEDULING_ENABLED, true);
conf.setBoolean(YarnConfiguration.NM_CONTAINER_QUEUING_ENABLED, true);
dfsCluster = new MiniDFSCluster.Builder(conf)
http://git-wip-us.apache.org/repos/asf/hadoop/blob/82c9e061/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
index 6c921cd..d1f410b 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
@@ -306,55 +306,60 @@ public class YarnConfiguration extends Configuration {
YARN_PREFIX + "distributed-scheduling.enabled";
public static final boolean DIST_SCHEDULING_ENABLED_DEFAULT = false;
- /** Minimum memory (in MB) used for allocating a container through distributed
- * scheduling. */
- public static final String DIST_SCHEDULING_MIN_CONTAINER_MEMORY_MB =
- YARN_PREFIX + "distributed-scheduling.min-container-memory-mb";
- public static final int DIST_SCHEDULING_MIN_CONTAINER_MEMORY_MB_DEFAULT = 512;
-
- /** Minimum virtual CPU cores used for allocating a container through
- * distributed scheduling. */
- public static final String DIST_SCHEDULING_MIN_CONTAINER_VCORES =
- YARN_PREFIX + "distributed-scheduling.min-container-vcores";
- public static final int DIST_SCHEDULING_MIN_CONTAINER_VCORES_DEFAULT = 1;
-
- /** Maximum memory (in MB) used for allocating a container through distributed
- * scheduling. */
- public static final String DIST_SCHEDULING_MAX_MEMORY_MB =
- YARN_PREFIX + "distributed-scheduling.max-container-memory-mb";
- public static final int DIST_SCHEDULING_MAX_MEMORY_MB_DEFAULT = 2048;
-
- /** Maximum virtual CPU cores used for allocating a container through
- * distributed scheduling. */
- public static final String DIST_SCHEDULING_MAX_CONTAINER_VCORES =
- YARN_PREFIX + "distributed-scheduling.max-container-vcores";
- public static final int DIST_SCHEDULING_MAX_CONTAINER_VCORES_DEFAULT = 4;
-
- /** Incremental memory (in MB) used for allocating a container through
- * distributed scheduling. */
- public static final String DIST_SCHEDULING_INCR_CONTAINER_MEMORY_MB =
- YARN_PREFIX + "distributed-scheduling.incr-container-memory-mb";
- public static final int DIST_SCHEDULING_INCR_CONTAINER_MEMORY_MB_DEFAULT =
+ /** Setting that controls whether opportunistic container allocation
+ * is enabled or not. */
+ public static final String OPPORTUNISTIC_CONTAINER_ALLOCATION_ENABLED =
+ YARN_PREFIX + "opportunistic-container-allocation.enabled";
+ public static final boolean
+ OPPORTUNISTIC_CONTAINER_ALLOCATION_ENABLED_DEFAULT = false;
+
+ /** Minimum memory (in MB) used for allocating an opportunistic container. */
+ public static final String OPPORTUNISTIC_CONTAINERS_MIN_MEMORY_MB =
+ YARN_PREFIX + "opportunistic-containers.min-memory-mb";
+ public static final int OPPORTUNISTIC_CONTAINERS_MIN_MEMORY_MB_DEFAULT = 512;
+
+ /** Minimum virtual CPU cores used for allocating an opportunistic container.
+ * */
+ public static final String OPPORTUNISTIC_CONTAINERS_MIN_VCORES =
+ YARN_PREFIX + "opportunistic-containers.min-vcores";
+ public static final int OPPORTUNISTIC_CONTAINERS_MIN_VCORES_DEFAULT = 1;
+
+ /** Maximum memory (in MB) used for allocating an opportunistic container. */
+ public static final String OPPORTUNISTIC_CONTAINERS_MAX_MEMORY_MB =
+ YARN_PREFIX + "opportunistic-containers.max-memory-mb";
+ public static final int OPPORTUNISTIC_CONTAINERS_MAX_MEMORY_MB_DEFAULT = 2048;
+
+ /** Maximum virtual CPU cores used for allocating an opportunistic container.
+ * */
+ public static final String OPPORTUNISTIC_CONTAINERS_MAX_VCORES =
+ YARN_PREFIX + "opportunistic-containers.max-vcores";
+ public static final int OPPORTUNISTIC_CONTAINERS_MAX_VCORES_DEFAULT = 4;
+
+ /** Incremental memory (in MB) used for allocating an opportunistic container.
+ * */
+ public static final String OPPORTUNISTIC_CONTAINERS_INCR_MEMORY_MB =
+ YARN_PREFIX + "opportunistic-containers.incr-memory-mb";
+ public static final int OPPORTUNISTIC_CONTAINERS_INCR_MEMORY_MB_DEFAULT =
512;
- /** Incremental virtual CPU cores used for allocating a container through
- * distributed scheduling. */
- public static final String DIST_SCHEDULING_INCR_CONTAINER_VCORES =
- YARN_PREFIX + "distributed-scheduling.incr-vcores";
- public static final int DIST_SCHEDULING_INCR_CONTAINER_VCORES_DEFAULT = 1;
-
- /** Container token expiry for container allocated via distributed
- * scheduling. */
- public static final String DIST_SCHEDULING_CONTAINER_TOKEN_EXPIRY_MS =
- YARN_PREFIX + "distributed-scheduling.container-token-expiry-ms";
- public static final int DIST_SCHEDULING_CONTAINER_TOKEN_EXPIRY_MS_DEFAULT =
+ /** Incremental virtual CPU cores used for allocating an opportunistic
+ * container. */
+ public static final String OPPORTUNISTIC_CONTAINERS_INCR_VCORES =
+ YARN_PREFIX + "opportunistic-containers.incr-vcores";
+ public static final int OPPORTUNISTIC_CONTAINERS_INCR_VCORES_DEFAULT = 1;
+
+ /** Container token expiry for opportunistic containers. */
+ public static final String OPPORTUNISTIC_CONTAINERS_TOKEN_EXPIRY_MS =
+ YARN_PREFIX + "opportunistic-containers.container-token-expiry-ms";
+ public static final int OPPORTUNISTIC_CONTAINERS_TOKEN_EXPIRY_MS_DEFAULT =
600000;
- /** Number of nodes to be used by the LocalScheduler of a NodeManager for
- * dispatching containers during distributed scheduling. */
- public static final String DIST_SCHEDULING_NODES_NUMBER_USED =
- YARN_PREFIX + "distributed-scheduling.nodes-used";
- public static final int DIST_SCHEDULING_NODES_NUMBER_USED_DEFAULT = 10;
+ /** Number of nodes to be used by the Opportunistic Container allocator for
+ * dispatching containers during container allocation. */
+ public static final String OPP_CONTAINER_ALLOCATION_NODES_NUMBER_USED =
+ YARN_PREFIX + "opportunistic-container-allocation.nodes-used";
+ public static final int OPP_CONTAINER_ALLOCATION_NODES_NUMBER_USED_DEFAULT =
+ 10;
/** Frequency for computing least loaded NMs. */
public static final String NM_CONTAINER_QUEUING_SORTING_NODES_INTERVAL_MS =
@@ -2829,6 +2834,18 @@ public class YarnConfiguration extends Configuration {
return clusterId;
}
+ public static boolean isDistSchedulingEnabled(Configuration conf) {
+ return conf.getBoolean(YarnConfiguration.DIST_SCHEDULING_ENABLED,
+ YarnConfiguration.DIST_SCHEDULING_ENABLED_DEFAULT);
+ }
+
+ public static boolean isOpportunisticContainerAllocationEnabled(
+ Configuration conf) {
+ return conf.getBoolean(
+ YarnConfiguration.OPPORTUNISTIC_CONTAINER_ALLOCATION_ENABLED,
+ YarnConfiguration.OPPORTUNISTIC_CONTAINER_ALLOCATION_ENABLED_DEFAULT);
+ }
+
// helper methods for timeline service configuration
/**
* Returns whether the timeline service is enabled via configuration.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/82c9e061/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestDistributedScheduling.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestDistributedScheduling.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestDistributedScheduling.java
index 71321e3..40390d4 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestDistributedScheduling.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestDistributedScheduling.java
@@ -84,7 +84,7 @@ import static org.mockito.Mockito.when;
* specifying OPPORTUNISTIC containers in its resource requests,
* the AMRMProxyService on the NM, the DistributedScheduler RequestInterceptor
* on the NM and the DistributedSchedulingProtocol used by the framework to talk
- * to the DistributedSchedulingAMService running on the RM.
+ * to the OpportunisticContainerAllocatorAMService running on the RM.
*/
public class TestDistributedScheduling extends BaseAMRMProxyE2ETest {
@@ -105,6 +105,8 @@ public class TestDistributedScheduling extends BaseAMRMProxyE2ETest {
conf = new YarnConfiguration();
conf.setBoolean(YarnConfiguration.AMRM_PROXY_ENABLED, true);
+ conf.setBoolean(YarnConfiguration.
+ OPPORTUNISTIC_CONTAINER_ALLOCATION_ENABLED, true);
conf.setBoolean(YarnConfiguration.DIST_SCHEDULING_ENABLED, true);
conf.setBoolean(YarnConfiguration.NM_CONTAINER_QUEUING_ENABLED, true);
cluster.init(conf);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/82c9e061/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml
index 3ebdc99..7305283 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml
@@ -2761,72 +2761,76 @@
<property>
<description>
- Minimum memory (in MB) used for allocating a container through distributed
- scheduling.
+ Setting that controls whether opportunistic container allocation
+ is enabled.
</description>
- <name>yarn.distributed-scheduling.min-container-memory-mb</name>
+ <name>yarn.opportunistic-container-allocation.enabled</name>
+ <value>false</value>
+ </property>
+
+ <property>
+ <description>
+ Minimum memory (in MB) used for allocating an opportunistic container.
+ </description>
+ <name>yarn.opportunistic-containers.min-memory-mb</name>
<value>512</value>
</property>
<property>
<description>
- Minimum virtual CPU cores used for allocating a container through
- distributed scheduling.
+ Minimum virtual CPU cores used for allocating an opportunistic container.
</description>
- <name>yarn.distributed-scheduling.min-container-vcores</name>
+ <name>yarn.opportunistic-containers.min-vcores</name>
<value>1</value>
</property>
<property>
<description>
- Maximum memory (in MB) used for allocating a container through distributed
- scheduling.
+ Maximum memory (in MB) used for allocating an opportunistic container.
</description>
- <name>yarn.distributed-scheduling.max-container-memory-mb</name>
+ <name>yarn.opportunistic-containers.max-memory-mb</name>
<value>2048</value>
</property>
<property>
<description>
- Maximum virtual CPU cores used for allocating a container through
- distributed scheduling.
+ Maximum virtual CPU cores used for allocating an opportunistic container.
</description>
- <name>yarn.distributed-scheduling.max-container-vcores</name>
+ <name>yarn.opportunistic-containers.max-vcores</name>
<value>4</value>
</property>
<property>
<description>
- Incremental memory (in MB) used for allocating a container through
- distributed scheduling.
+ Incremental memory (in MB) used for allocating an opportunistic container.
</description>
- <name>yarn.distributed-scheduling.incr-container-memory-mb</name>
+ <name>yarn.opportunistic-containers.incr-memory-mb</name>
<value>512</value>
</property>
<property>
<description>
- Incremental virtual CPU cores used for allocating a container through
- distributed scheduling.
+ Incremental virtual CPU cores used for allocating an opportunistic
+ container.
</description>
- <name>yarn.distributed-scheduling.incr-vcores</name>
+ <name>yarn.opportunistic-containers.incr-vcores</name>
<value>1</value>
</property>
<property>
<description>
- Container token expiry for container allocated via distributed scheduling.
+ Container token expiry for opportunistic containers.
</description>
- <name>yarn.distributed-scheduling.container-token-expiry-ms</name>
+ <name>yarn.opportunistic-containers.container-token-expiry-ms</name>
<value>600000</value>
</property>
<property>
<description>
- Number of nodes to be used by the LocalScheduler of a NodeManager for
- dispatching containers during distributed scheduling.
+ Number of nodes to be used by the Opportunistic Container Allocator for
+ dispatching containers during container allocation.
</description>
- <name>yarn.distributed-scheduling.nodes-used</name>
+ <name>yarn.opportunistic-container-allocation.nodes-used</name>
<value>10</value>
</property>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/82c9e061/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/scheduler/OpportunisticContainerAllocator.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/scheduler/OpportunisticContainerAllocator.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/scheduler/OpportunisticContainerAllocator.java
new file mode 100644
index 0000000..41b5d56
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/scheduler/OpportunisticContainerAllocator.java
@@ -0,0 +1,378 @@
+/**
+ * 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.hadoop.yarn.server.scheduler;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.net.NetUtils;
+import org.apache.hadoop.security.SecurityUtil;
+import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
+import org.apache.hadoop.yarn.api.records.*;
+import org.apache.hadoop.yarn.exceptions.YarnException;
+import org.apache.hadoop.yarn.nodelabels.CommonNodeLabelsManager;
+import org.apache.hadoop.yarn.security.ContainerTokenIdentifier;
+import org.apache.hadoop.yarn.server.api.ContainerType;
+
+import org.apache.hadoop.yarn.server.security.BaseContainerTokenSecretManager;
+import org.apache.hadoop.yarn.server.utils.BuilderUtils;
+import org.apache.hadoop.yarn.util.resource.DominantResourceCalculator;
+import org.apache.hadoop.yarn.util.resource.ResourceCalculator;
+import org.apache.hadoop.yarn.util.resource.Resources;
+
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * <p>
+ * The OpportunisticContainerAllocator allocates containers on a given list of
+ * nodes, after modifying the container sizes to respect the limits set by the
+ * ResourceManager. It tries to distribute the containers as evenly as possible.
+ * </p>
+ */
+public class OpportunisticContainerAllocator {
+
+ /**
+ * This class encapsulates application specific parameters used to build a
+ * Container.
+ */
+ public static class AllocationParams {
+ private Resource maxResource;
+ private Resource minResource;
+ private Resource incrementResource;
+ private int containerTokenExpiryInterval;
+
+ /**
+ * Return Max Resource.
+ * @return Resource
+ */
+ public Resource getMaxResource() {
+ return maxResource;
+ }
+
+ /**
+ * Set Max Resource.
+ * @param maxResource Resource
+ */
+ public void setMaxResource(Resource maxResource) {
+ this.maxResource = maxResource;
+ }
+
+ /**
+ * Get Min Resource.
+ * @return Resource
+ */
+ public Resource getMinResource() {
+ return minResource;
+ }
+
+ /**
+ * Set Min Resource.
+ * @param minResource Resource
+ */
+ public void setMinResource(Resource minResource) {
+ this.minResource = minResource;
+ }
+
+ /**
+ * Get Incremental Resource.
+ * @return Incremental Resource
+ */
+ public Resource getIncrementResource() {
+ return incrementResource;
+ }
+
+ /**
+ * Set Incremental resource.
+ * @param incrementResource Resource
+ */
+ public void setIncrementResource(Resource incrementResource) {
+ this.incrementResource = incrementResource;
+ }
+
+ /**
+ * Get Container Token Expiry interval.
+ * @return Container Token Expiry interval
+ */
+ public int getContainerTokenExpiryInterval() {
+ return containerTokenExpiryInterval;
+ }
+
+ /**
+ * Set Container Token Expiry time in ms.
+ * @param containerTokenExpiryInterval Container Token Expiry in ms
+ */
+ public void setContainerTokenExpiryInterval(
+ int containerTokenExpiryInterval) {
+ this.containerTokenExpiryInterval = containerTokenExpiryInterval;
+ }
+ }
+
+ /**
+ * A Container Id Generator.
+ */
+ public static class ContainerIdGenerator {
+
+ protected volatile AtomicLong containerIdCounter = new AtomicLong(1);
+
+ /**
+ * This method can reset the generator to a specific value.
+ * @param containerIdStart containerId
+ */
+ public void resetContainerIdCounter(long containerIdStart) {
+ this.containerIdCounter.set(containerIdStart);
+ }
+
+ /**
+ * Sets the underlying Atomic Long. To be used when implementation needs to
+ * share the underlying AtomicLong of an existing counter.
+ * @param counter AtomicLong
+ */
+ public void setContainerIdCounter(AtomicLong counter) {
+ this.containerIdCounter = counter;
+ }
+
+ /**
+ * Generates a new long value. Default implementation increments the
+ * underlying AtomicLong. Sub classes are encouraged to over-ride this
+ * behaviour.
+ * @return Counter.
+ */
+ public long generateContainerId() {
+ return this.containerIdCounter.incrementAndGet();
+ }
+ }
+
+ static class PartitionedResourceRequests {
+ private List<ResourceRequest> guaranteed = new ArrayList<>();
+ private List<ResourceRequest> opportunistic = new ArrayList<>();
+ public List<ResourceRequest> getGuaranteed() {
+ return guaranteed;
+ }
+ public List<ResourceRequest> getOpportunistic() {
+ return opportunistic;
+ }
+ }
+
+ private static final Log LOG =
+ LogFactory.getLog(OpportunisticContainerAllocator.class);
+
+ private static final ResourceCalculator RESOURCE_CALCULATOR =
+ new DominantResourceCalculator();
+
+ private final BaseContainerTokenSecretManager tokenSecretManager;
+ private int webpagePort;
+
+ /**
+ * Create a new Opportunistic Container Allocator.
+ * @param tokenSecretManager TokenSecretManager
+ * @param webpagePort Webpage Port
+ */
+ public OpportunisticContainerAllocator(
+ BaseContainerTokenSecretManager tokenSecretManager, int webpagePort) {
+ this.tokenSecretManager = tokenSecretManager;
+ this.webpagePort = webpagePort;
+ }
+
+ /**
+ * Entry point into the Opportunistic Container Allocator.
+ * @param request AllocateRequest
+ * @param applicationAttemptId ApplicationAttemptId
+ * @param appContext App Specific OpportunisticContainerContext
+ * @param rmIdentifier RM Identifier
+ * @param appSubmitter App Submitter
+ * @return List of Containers.
+ * @throws YarnException YarnException
+ */
+ public List<Container> allocateContainers(
+ AllocateRequest request, ApplicationAttemptId applicationAttemptId,
+ OpportunisticContainerContext appContext, long rmIdentifier,
+ String appSubmitter) throws YarnException {
+ // Partition requests into GUARANTEED and OPPORTUNISTIC reqs
+ PartitionedResourceRequests partitionedAsks =
+ partitionAskList(request.getAskList());
+
+ List<ContainerId> releasedContainers = request.getReleaseList();
+ int numReleasedContainers = releasedContainers.size();
+ if (numReleasedContainers > 0) {
+ LOG.info("AttemptID: " + applicationAttemptId + " released: "
+ + numReleasedContainers);
+ appContext.getContainersAllocated().removeAll(releasedContainers);
+ }
+
+ // Also, update black list
+ ResourceBlacklistRequest rbr = request.getResourceBlacklistRequest();
+ if (rbr != null) {
+ appContext.getBlacklist().removeAll(rbr.getBlacklistRemovals());
+ appContext.getBlacklist().addAll(rbr.getBlacklistAdditions());
+ }
+
+ // Add OPPORTUNISTIC reqs to the outstanding reqs
+ appContext.addToOutstandingReqs(partitionedAsks.getOpportunistic());
+
+ List<Container> allocatedContainers = new ArrayList<>();
+ for (Priority priority :
+ appContext.getOutstandingOpReqs().descendingKeySet()) {
+ // Allocated containers :
+ // Key = Requested Capability,
+ // Value = List of Containers of given Cap (The actual container size
+ // might be different than what is requested.. which is why
+ // we need the requested capability (key) to match against
+ // the outstanding reqs)
+ Map<Resource, List<Container>> allocated = allocate(rmIdentifier,
+ appContext, priority, applicationAttemptId, appSubmitter);
+ for (Map.Entry<Resource, List<Container>> e : allocated.entrySet()) {
+ appContext.matchAllocationToOutstandingRequest(
+ e.getKey(), e.getValue());
+ allocatedContainers.addAll(e.getValue());
+ }
+ }
+
+ // Send all the GUARANTEED Reqs to RM
+ request.setAskList(partitionedAsks.getGuaranteed());
+ return allocatedContainers;
+ }
+
+ private Map<Resource, List<Container>> allocate(long rmIdentifier,
+ OpportunisticContainerContext appContext, Priority priority,
+ ApplicationAttemptId appAttId, String userName) throws YarnException {
+ Map<Resource, List<Container>> containers = new HashMap<>();
+ for (ResourceRequest anyAsk :
+ appContext.getOutstandingOpReqs().get(priority).values()) {
+ allocateContainersInternal(rmIdentifier, appContext.getAppParams(),
+ appContext.getContainerIdGenerator(), appContext.getBlacklist(),
+ appAttId, appContext.getNodeMap(), userName, containers, anyAsk);
+ LOG.info("Opportunistic allocation requested for ["
+ + "priority=" + anyAsk.getPriority()
+ + ", num_containers=" + anyAsk.getNumContainers()
+ + ", capability=" + anyAsk.getCapability() + "]"
+ + " allocated = " + containers.get(anyAsk.getCapability()).size());
+ }
+ return containers;
+ }
+
+ private void allocateContainersInternal(long rmIdentifier,
+ AllocationParams appParams, ContainerIdGenerator idCounter,
+ Set<String> blacklist, ApplicationAttemptId id,
+ Map<String, NodeId> allNodes, String userName,
+ Map<Resource, List<Container>> containers, ResourceRequest anyAsk)
+ throws YarnException {
+ int toAllocate = anyAsk.getNumContainers()
+ - (containers.isEmpty() ? 0 :
+ containers.get(anyAsk.getCapability()).size());
+
+ List<NodeId> nodesForScheduling = new ArrayList<>();
+ for (Entry<String, NodeId> nodeEntry : allNodes.entrySet()) {
+ // Do not use blacklisted nodes for scheduling.
+ if (blacklist.contains(nodeEntry.getKey())) {
+ continue;
+ }
+ nodesForScheduling.add(nodeEntry.getValue());
+ }
+ int numAllocated = 0;
+ int nextNodeToSchedule = 0;
+ for (int numCont = 0; numCont < toAllocate; numCont++) {
+ nextNodeToSchedule++;
+ nextNodeToSchedule %= nodesForScheduling.size();
+ NodeId nodeId = nodesForScheduling.get(nextNodeToSchedule);
+ Container container = buildContainer(rmIdentifier, appParams, idCounter,
+ anyAsk, id, userName, nodeId);
+ List<Container> cList = containers.get(anyAsk.getCapability());
+ if (cList == null) {
+ cList = new ArrayList<>();
+ containers.put(anyAsk.getCapability(), cList);
+ }
+ cList.add(container);
+ numAllocated++;
+ LOG.info("Allocated [" + container.getId() + "] as opportunistic.");
+ }
+ LOG.info("Allocated " + numAllocated + " opportunistic containers.");
+ }
+
+ private Container buildContainer(long rmIdentifier,
+ AllocationParams appParams, ContainerIdGenerator idCounter,
+ ResourceRequest rr, ApplicationAttemptId id, String userName,
+ NodeId nodeId) throws YarnException {
+ ContainerId cId =
+ ContainerId.newContainerId(id, idCounter.generateContainerId());
+
+ // Normalize the resource asks (Similar to what the the RM scheduler does
+ // before accepting an ask)
+ Resource capability = normalizeCapability(appParams, rr);
+
+ long currTime = System.currentTimeMillis();
+ ContainerTokenIdentifier containerTokenIdentifier =
+ new ContainerTokenIdentifier(
+ cId, nodeId.getHost() + ":" + nodeId.getPort(), userName,
+ capability, currTime + appParams.containerTokenExpiryInterval,
+ tokenSecretManager.getCurrentKey().getKeyId(), rmIdentifier,
+ rr.getPriority(), currTime,
+ null, CommonNodeLabelsManager.NO_LABEL, ContainerType.TASK,
+ ExecutionType.OPPORTUNISTIC);
+ byte[] pwd =
+ tokenSecretManager.createPassword(containerTokenIdentifier);
+ Token containerToken = newContainerToken(nodeId, pwd,
+ containerTokenIdentifier);
+ Container container = BuilderUtils.newContainer(
+ cId, nodeId, nodeId.getHost() + ":" + webpagePort,
+ capability, rr.getPriority(), containerToken,
+ containerTokenIdentifier.getExecutionType(),
+ rr.getAllocationRequestId());
+ return container;
+ }
+
+ private Resource normalizeCapability(AllocationParams appParams,
+ ResourceRequest ask) {
+ return Resources.normalize(RESOURCE_CALCULATOR,
+ ask.getCapability(), appParams.minResource, appParams.maxResource,
+ appParams.incrementResource);
+ }
+
+ private static Token newContainerToken(NodeId nodeId, byte[] password,
+ ContainerTokenIdentifier tokenIdentifier) {
+ // RPC layer client expects ip:port as service for tokens
+ InetSocketAddress addr = NetUtils.createSocketAddrForHost(nodeId.getHost(),
+ nodeId.getPort());
+ // NOTE: use SecurityUtil.setTokenService if this becomes a "real" token
+ Token containerToken = Token.newInstance(tokenIdentifier.getBytes(),
+ ContainerTokenIdentifier.KIND.toString(), password, SecurityUtil
+ .buildTokenService(addr).toString());
+ return containerToken;
+ }
+
+ private PartitionedResourceRequests partitionAskList(List<ResourceRequest>
+ askList) {
+ PartitionedResourceRequests partitionedRequests =
+ new PartitionedResourceRequests();
+ for (ResourceRequest rr : askList) {
+ if (rr.getExecutionTypeRequest().getExecutionType() ==
+ ExecutionType.OPPORTUNISTIC) {
+ partitionedRequests.getOpportunistic().add(rr);
+ } else {
+ partitionedRequests.getGuaranteed().add(rr);
+ }
+ }
+ return partitionedRequests;
+ }
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/82c9e061/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/scheduler/OpportunisticContainerContext.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/scheduler/OpportunisticContainerContext.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/scheduler/OpportunisticContainerContext.java
new file mode 100644
index 0000000..1b701ea
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/scheduler/OpportunisticContainerContext.java
@@ -0,0 +1,178 @@
+/**
+ * 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.hadoop.yarn.server.scheduler;
+
+import org.apache.hadoop.yarn.api.records.Container;
+import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.hadoop.yarn.api.records.NMToken;
+import org.apache.hadoop.yarn.api.records.NodeId;
+import org.apache.hadoop.yarn.api.records.Priority;
+import org.apache.hadoop.yarn.api.records.Resource;
+import org.apache.hadoop.yarn.api.records.ResourceRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import static org.apache.hadoop.yarn.server.scheduler.OpportunisticContainerAllocator.AllocationParams;
+import static org.apache.hadoop.yarn.server.scheduler.OpportunisticContainerAllocator.ContainerIdGenerator;
+
+/**
+ * This encapsulates application specific information used by the
+ * Opportunistic Container Allocator to allocate containers.
+ */
+public class OpportunisticContainerContext {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(OpportunisticContainerContext.class);
+
+ // Currently just used to keep track of allocated containers.
+ // Can be used for reporting stats later.
+ private Set<ContainerId> containersAllocated = new HashSet<>();
+ private AllocationParams appParams =
+ new AllocationParams();
+ private ContainerIdGenerator containerIdGenerator =
+ new ContainerIdGenerator();
+
+ private Map<String, NodeId> nodeMap = new LinkedHashMap<>();
+
+ // Mapping of NodeId to NodeTokens. Populated either from RM response or
+ // generated locally if required.
+ private Map<NodeId, NMToken> nodeTokens = new HashMap<>();
+ private final Set<String> blacklist = new HashSet<>();
+
+ // This maintains a map of outstanding OPPORTUNISTIC Reqs. Key-ed by Priority,
+ // Resource Name (Host/rack/any) and capability. This mapping is required
+ // to match a received Container to an outstanding OPPORTUNISTIC
+ // ResourceRequest (ask).
+ private final TreeMap<Priority, Map<Resource, ResourceRequest>>
+ outstandingOpReqs = new TreeMap<>();
+
+ public Set<ContainerId> getContainersAllocated() {
+ return containersAllocated;
+ }
+
+ public OpportunisticContainerAllocator.AllocationParams getAppParams() {
+ return appParams;
+ }
+
+ public ContainerIdGenerator getContainerIdGenerator() {
+ return containerIdGenerator;
+ }
+
+ public void setContainerIdGenerator(
+ ContainerIdGenerator containerIdGenerator) {
+ this.containerIdGenerator = containerIdGenerator;
+ }
+
+ public Map<String, NodeId> getNodeMap() {
+ return nodeMap;
+ }
+
+ public Map<NodeId, NMToken> getNodeTokens() {
+ return nodeTokens;
+ }
+
+ public Set<String> getBlacklist() {
+ return blacklist;
+ }
+
+ public TreeMap<Priority, Map<Resource, ResourceRequest>>
+ getOutstandingOpReqs() {
+ return outstandingOpReqs;
+ }
+
+ /**
+ * Takes a list of ResourceRequests (asks), extracts the key information viz.
+ * (Priority, ResourceName, Capability) and adds to the outstanding
+ * OPPORTUNISTIC outstandingOpReqs map. The nested map is required to enforce
+ * the current YARN constraint that only a single ResourceRequest can exist at
+ * a give Priority and Capability.
+ *
+ * @param resourceAsks the list with the {@link ResourceRequest}s
+ */
+ public void addToOutstandingReqs(List<ResourceRequest> resourceAsks) {
+ for (ResourceRequest request : resourceAsks) {
+ Priority priority = request.getPriority();
+
+ // TODO: Extend for Node/Rack locality. We only handle ANY requests now
+ if (!ResourceRequest.isAnyLocation(request.getResourceName())) {
+ continue;
+ }
+
+ if (request.getNumContainers() == 0) {
+ continue;
+ }
+
+ Map<Resource, ResourceRequest> reqMap =
+ outstandingOpReqs.get(priority);
+ if (reqMap == null) {
+ reqMap = new HashMap<>();
+ outstandingOpReqs.put(priority, reqMap);
+ }
+
+ ResourceRequest resourceRequest = reqMap.get(request.getCapability());
+ if (resourceRequest == null) {
+ resourceRequest = request;
+ reqMap.put(request.getCapability(), request);
+ } else {
+ resourceRequest.setNumContainers(
+ resourceRequest.getNumContainers() + request.getNumContainers());
+ }
+ if (ResourceRequest.isAnyLocation(request.getResourceName())) {
+ LOG.info("# of outstandingOpReqs in ANY (at priority = " + priority
+ + ", with capability = " + request.getCapability() + " ) : "
+ + resourceRequest.getNumContainers());
+ }
+ }
+ }
+
+ /**
+ * This method matches a returned list of Container Allocations to any
+ * outstanding OPPORTUNISTIC ResourceRequest.
+ * @param capability Capability
+ * @param allocatedContainers Allocated Containers
+ */
+ public void matchAllocationToOutstandingRequest(Resource capability,
+ List<Container> allocatedContainers) {
+ for (Container c : allocatedContainers) {
+ containersAllocated.add(c.getId());
+ Map<Resource, ResourceRequest> asks =
+ outstandingOpReqs.get(c.getPriority());
+
+ if (asks == null) {
+ continue;
+ }
+
+ ResourceRequest rr = asks.get(capability);
+ if (rr != null) {
+ rr.setNumContainers(rr.getNumContainers() - 1);
+ if (rr.getNumContainers() == 0) {
+ asks.remove(capability);
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/82c9e061/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/scheduler/package-info.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/scheduler/package-info.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/scheduler/package-info.java
new file mode 100644
index 0000000..dd56829
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/scheduler/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+/**
+ * Utility classes used for Scheduling.
+ */
+package org.apache.hadoop.yarn.server.scheduler;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/82c9e061/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/Context.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/Context.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/Context.java
index 131eaa3..88bc29c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/Context.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/Context.java
@@ -34,7 +34,7 @@ import org.apache.hadoop.yarn.server.nodemanager.containermanager.ContainerManag
import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.Application;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container;
import org.apache.hadoop.yarn.server.nodemanager.recovery.NMStateStoreService;
-import org.apache.hadoop.yarn.server.nodemanager.scheduler.OpportunisticContainerAllocator;
+import org.apache.hadoop.yarn.server.scheduler.OpportunisticContainerAllocator;
import org.apache.hadoop.yarn.server.nodemanager.security.NMContainerTokenSecretManager;
import org.apache.hadoop.yarn.server.nodemanager.security.NMTokenSecretManagerInNM;
import org.apache.hadoop.yarn.server.nodemanager.timelineservice.NMTimelinePublisher;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/82c9e061/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java
index 5bfbb8d..280a086 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java
@@ -72,7 +72,7 @@ import org.apache.hadoop.yarn.server.nodemanager.nodelabels.ScriptBasedNodeLabel
import org.apache.hadoop.yarn.server.nodemanager.recovery.NMLeveldbStateStoreService;
import org.apache.hadoop.yarn.server.nodemanager.recovery.NMNullStateStoreService;
import org.apache.hadoop.yarn.server.nodemanager.recovery.NMStateStoreService;
-import org.apache.hadoop.yarn.server.nodemanager.scheduler.OpportunisticContainerAllocator;
+import org.apache.hadoop.yarn.server.scheduler.OpportunisticContainerAllocator;
import org.apache.hadoop.yarn.server.nodemanager.security.NMContainerTokenSecretManager;
import org.apache.hadoop.yarn.server.nodemanager.security.NMTokenSecretManagerInNM;
import org.apache.hadoop.yarn.server.nodemanager.timelineservice.NMTimelinePublisher;
@@ -336,7 +336,8 @@ public class NodeManager extends CompositeService
addService(nodeHealthChecker);
boolean isDistSchedulingEnabled =
- conf.getBoolean(YarnConfiguration.DIST_SCHEDULING_ENABLED,
+ conf.getBoolean(YarnConfiguration.
+ OPPORTUNISTIC_CONTAINER_ALLOCATION_ENABLED,
YarnConfiguration.DIST_SCHEDULING_ENABLED_DEFAULT);
this.context = createNMContext(containerTokenSecretManager,
@@ -370,8 +371,8 @@ public class NodeManager extends CompositeService
((NMContext) context).setWebServer(webServer);
((NMContext) context).setQueueableContainerAllocator(
- new OpportunisticContainerAllocator(nodeStatusUpdater, context,
- webServer.getPort()));
+ new OpportunisticContainerAllocator(
+ context.getContainerTokenSecretManager(), webServer.getPort()));
dispatcher.register(ContainerManagerEventType.class, containerManager);
dispatcher.register(NodeManagerEventType.class, this);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/82c9e061/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/DefaultRequestInterceptor.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/DefaultRequestInterceptor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/DefaultRequestInterceptor.java
index 75fe022..efbdfb4 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/DefaultRequestInterceptor.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/DefaultRequestInterceptor.java
@@ -62,7 +62,7 @@ public final class DefaultRequestInterceptor extends
AbstractRequestInterceptor {
private static final Logger LOG = LoggerFactory
.getLogger(DefaultRequestInterceptor.class);
- private DistributedSchedulingAMProtocol rmClient;
+ private ApplicationMasterProtocol rmClient;
private UserGroupInformation user = null;
@Override
@@ -76,15 +76,7 @@ public final class DefaultRequestInterceptor extends
user.addToken(appContext.getAMRMToken());
final Configuration conf = this.getConf();
- rmClient = user.doAs(
- new PrivilegedExceptionAction<DistributedSchedulingAMProtocol>() {
- @Override
- public DistributedSchedulingAMProtocol run() throws Exception {
- setAMRMTokenService(conf);
- return ServerRMProxy.createRMProxy(conf,
- DistributedSchedulingAMProtocol.class);
- }
- });
+ rmClient = createRMClient(appContext, conf);
} catch (IOException e) {
String message =
"Error while creating of RM app master service proxy for attemptId:"
@@ -100,6 +92,32 @@ public final class DefaultRequestInterceptor extends
}
}
+ private ApplicationMasterProtocol createRMClient(
+ AMRMProxyApplicationContext appContext, final Configuration conf)
+ throws IOException, InterruptedException {
+ if (appContext.getNMCotext().isDistributedSchedulingEnabled()) {
+ return user.doAs(
+ new PrivilegedExceptionAction<DistributedSchedulingAMProtocol>() {
+ @Override
+ public DistributedSchedulingAMProtocol run() throws Exception {
+ setAMRMTokenService(conf);
+ return ServerRMProxy.createRMProxy(conf,
+ DistributedSchedulingAMProtocol.class);
+ }
+ });
+ } else {
+ return user.doAs(
+ new PrivilegedExceptionAction<ApplicationMasterProtocol>() {
+ @Override
+ public ApplicationMasterProtocol run() throws Exception {
+ setAMRMTokenService(conf);
+ return ClientRMProxy.createRMProxy(conf,
+ ApplicationMasterProtocol.class);
+ }
+ });
+ }
+ }
+
@Override
public RegisterApplicationMasterResponse registerApplicationMaster(
final RegisterApplicationMasterRequest request)
@@ -127,9 +145,15 @@ public final class DefaultRequestInterceptor extends
registerApplicationMasterForDistributedScheduling
(RegisterApplicationMasterRequest request) throws YarnException,
IOException {
- LOG.info("Forwarding registerApplicationMasterForDistributedScheduling" +
- "request to the real YARN RM");
- return rmClient.registerApplicationMasterForDistributedScheduling(request);
+ if (getApplicationContext().getNMCotext()
+ .isDistributedSchedulingEnabled()) {
+ LOG.info("Forwarding registerApplicationMasterForDistributedScheduling" +
+ "request to the real YARN RM");
+ return ((DistributedSchedulingAMProtocol)rmClient)
+ .registerApplicationMasterForDistributedScheduling(request);
+ } else {
+ throw new YarnException("Distributed Scheduling is not enabled !!");
+ }
}
@Override
@@ -140,13 +164,18 @@ public final class DefaultRequestInterceptor extends
LOG.debug("Forwarding allocateForDistributedScheduling request" +
"to the real YARN RM");
}
- DistributedSchedulingAllocateResponse allocateResponse =
- rmClient.allocateForDistributedScheduling(request);
- if (allocateResponse.getAllocateResponse().getAMRMToken() != null) {
- updateAMRMToken(allocateResponse.getAllocateResponse().getAMRMToken());
+ if (getApplicationContext().getNMCotext()
+ .isDistributedSchedulingEnabled()) {
+ DistributedSchedulingAllocateResponse allocateResponse =
+ ((DistributedSchedulingAMProtocol)rmClient)
+ .allocateForDistributedScheduling(request);
+ if (allocateResponse.getAllocateResponse().getAMRMToken() != null) {
+ updateAMRMToken(allocateResponse.getAllocateResponse().getAMRMToken());
+ }
+ return allocateResponse;
+ } else {
+ throw new YarnException("Distributed Scheduling is not enabled !!");
}
-
- return allocateResponse;
}
@Override
http://git-wip-us.apache.org/repos/asf/hadoop/blob/82c9e061/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/scheduler/DistributedScheduler.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/scheduler/DistributedScheduler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/scheduler/DistributedScheduler.java
index bfb12ee..368858c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/scheduler/DistributedScheduler.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/scheduler/DistributedScheduler.java
@@ -32,34 +32,23 @@ import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterReque
import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.ContainerStatus;
import org.apache.hadoop.yarn.api.records.ExecutionType;
import org.apache.hadoop.yarn.api.records.NMToken;
import org.apache.hadoop.yarn.api.records.NodeId;
-import org.apache.hadoop.yarn.api.records.Priority;
-import org.apache.hadoop.yarn.api.records.Resource;
-import org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest;
-import org.apache.hadoop.yarn.api.records.ResourceRequest;
import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.server.nodemanager.amrmproxy.AMRMProxyApplicationContext;
import org.apache.hadoop.yarn.server.nodemanager.amrmproxy.AbstractRequestInterceptor;
-
-
-
import org.apache.hadoop.yarn.server.nodemanager.security.NMTokenSecretManagerInNM;
+
+import org.apache.hadoop.yarn.server.scheduler.OpportunisticContainerAllocator;
+import org.apache.hadoop.yarn.server.scheduler.OpportunisticContainerContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
/**
* <p>The DistributedScheduler runs on the NodeManager and is modeled as an
@@ -76,74 +65,49 @@ import java.util.TreeMap;
*/
public final class DistributedScheduler extends AbstractRequestInterceptor {
- static class PartitionedResourceRequests {
- private List<ResourceRequest> guaranteed = new ArrayList<>();
- private List<ResourceRequest> opportunistic = new ArrayList<>();
- public List<ResourceRequest> getGuaranteed() {
- return guaranteed;
- }
- public List<ResourceRequest> getOpportunistic() {
- return opportunistic;
- }
- }
-
- static class DistributedSchedulerParams {
- Resource maxResource;
- Resource minResource;
- Resource incrementResource;
- int containerTokenExpiryInterval;
- }
-
private static final Logger LOG = LoggerFactory
.getLogger(DistributedScheduler.class);
private final static RecordFactory RECORD_FACTORY =
RecordFactoryProvider.getRecordFactory(null);
- // Currently just used to keep track of allocated containers.
- // Can be used for reporting stats later.
- private Set<ContainerId> containersAllocated = new HashSet<>();
-
- private DistributedSchedulerParams appParams =
- new DistributedSchedulerParams();
- private final OpportunisticContainerAllocator.ContainerIdCounter
- containerIdCounter =
- new OpportunisticContainerAllocator.ContainerIdCounter();
- private Map<String, NodeId> nodeList = new LinkedHashMap<>();
-
- // Mapping of NodeId to NodeTokens. Populated either from RM response or
- // generated locally if required.
- private Map<NodeId, NMToken> nodeTokens = new HashMap<>();
- final Set<String> blacklist = new HashSet<>();
-
- // This maintains a map of outstanding OPPORTUNISTIC Reqs. Key-ed by Priority,
- // Resource Name (Host/rack/any) and capability. This mapping is required
- // to match a received Container to an outstanding OPPORTUNISTIC
- // ResourceRequest (ask).
- final TreeMap<Priority, Map<Resource, ResourceRequest>>
- outstandingOpReqs = new TreeMap<>();
+ private OpportunisticContainerContext oppContainerContext =
+ new OpportunisticContainerContext();
private ApplicationAttemptId applicationAttemptId;
private OpportunisticContainerAllocator containerAllocator;
private NMTokenSecretManagerInNM nmSecretManager;
private String appSubmitter;
-
- public void init(AMRMProxyApplicationContext appContext) {
- super.init(appContext);
- initLocal(appContext.getApplicationAttemptId(),
- appContext.getNMCotext().getContainerAllocator(),
- appContext.getNMCotext().getNMTokenSecretManager(),
- appContext.getUser());
+ private long rmIdentifier;
+
+ public void init(AMRMProxyApplicationContext applicationContext) {
+ super.init(applicationContext);
+ initLocal(applicationContext.getNMCotext().getNodeStatusUpdater()
+ .getRMIdentifier(),
+ applicationContext.getApplicationAttemptId(),
+ applicationContext.getNMCotext().getContainerAllocator(),
+ applicationContext.getNMCotext().getNMTokenSecretManager(),
+ applicationContext.getUser());
}
@VisibleForTesting
- void initLocal(ApplicationAttemptId applicationAttemptId,
- OpportunisticContainerAllocator containerAllocator,
+ void initLocal(long rmId, ApplicationAttemptId appAttemptId,
+ OpportunisticContainerAllocator oppContainerAllocator,
NMTokenSecretManagerInNM nmSecretManager, String appSubmitter) {
- this.applicationAttemptId = applicationAttemptId;
- this.containerAllocator = containerAllocator;
+ this.rmIdentifier = rmId;
+ this.applicationAttemptId = appAttemptId;
+ this.containerAllocator = oppContainerAllocator;
this.nmSecretManager = nmSecretManager;
this.appSubmitter = appSubmitter;
+
+ // Overrides the Generator to decrement container id.
+ this.oppContainerContext.setContainerIdGenerator(
+ new OpportunisticContainerAllocator.ContainerIdGenerator() {
+ @Override
+ public long generateContainerId() {
+ return this.containerIdCounter.decrementAndGet();
+ }
+ });
}
/**
@@ -202,7 +166,8 @@ public final class DistributedScheduler extends AbstractRequestInterceptor {
if (allocatedContainers.size() > 0) {
response.getAllocatedContainers().addAll(allocatedContainers);
for (Container alloc : allocatedContainers) {
- if (!nodeTokens.containsKey(alloc.getNodeId())) {
+ if (!oppContainerContext.getNodeTokens().containsKey(
+ alloc.getNodeId())) {
newTokens.add(nmSecretManager.generateNMToken(appSubmitter, alloc));
}
}
@@ -212,115 +177,34 @@ public final class DistributedScheduler extends AbstractRequestInterceptor {
}
}
- private PartitionedResourceRequests partitionAskList(List<ResourceRequest>
- askList) {
- PartitionedResourceRequests partitionedRequests =
- new PartitionedResourceRequests();
- for (ResourceRequest rr : askList) {
- if (rr.getExecutionTypeRequest().getExecutionType() ==
- ExecutionType.OPPORTUNISTIC) {
- partitionedRequests.getOpportunistic().add(rr);
- } else {
- partitionedRequests.getGuaranteed().add(rr);
- }
- }
- return partitionedRequests;
- }
-
private void updateParameters(
RegisterDistributedSchedulingAMResponse registerResponse) {
- appParams.minResource = registerResponse.getMinContainerResource();
- appParams.maxResource = registerResponse.getMaxContainerResource();
- appParams.incrementResource =
- registerResponse.getIncrContainerResource();
- if (appParams.incrementResource == null) {
- appParams.incrementResource = appParams.minResource;
+ oppContainerContext.getAppParams().setMinResource(
+ registerResponse.getMinContainerResource());
+ oppContainerContext.getAppParams().setMaxResource(
+ registerResponse.getMaxContainerResource());
+ oppContainerContext.getAppParams().setIncrementResource(
+ registerResponse.getIncrContainerResource());
+ if (oppContainerContext.getAppParams().getIncrementResource() == null) {
+ oppContainerContext.getAppParams().setIncrementResource(
+ oppContainerContext.getAppParams().getMinResource());
}
- appParams.containerTokenExpiryInterval = registerResponse
- .getContainerTokenExpiryInterval();
+ oppContainerContext.getAppParams().setContainerTokenExpiryInterval(
+ registerResponse.getContainerTokenExpiryInterval());
- containerIdCounter
+ oppContainerContext.getContainerIdGenerator()
.resetContainerIdCounter(registerResponse.getContainerIdStart());
setNodeList(registerResponse.getNodesForScheduling());
}
- /**
- * Takes a list of ResourceRequests (asks), extracts the key information viz.
- * (Priority, ResourceName, Capability) and adds to the outstanding
- * OPPORTUNISTIC outstandingOpReqs map. The nested map is required to enforce
- * the current YARN constraint that only a single ResourceRequest can exist at
- * a give Priority and Capability.
- *
- * @param resourceAsks the list with the {@link ResourceRequest}s
- */
- public void addToOutstandingReqs(List<ResourceRequest> resourceAsks) {
- for (ResourceRequest request : resourceAsks) {
- Priority priority = request.getPriority();
-
- // TODO: Extend for Node/Rack locality. We only handle ANY requests now
- if (!ResourceRequest.isAnyLocation(request.getResourceName())) {
- continue;
- }
-
- if (request.getNumContainers() == 0) {
- continue;
- }
-
- Map<Resource, ResourceRequest> reqMap =
- this.outstandingOpReqs.get(priority);
- if (reqMap == null) {
- reqMap = new HashMap<>();
- this.outstandingOpReqs.put(priority, reqMap);
- }
-
- ResourceRequest resourceRequest = reqMap.get(request.getCapability());
- if (resourceRequest == null) {
- resourceRequest = request;
- reqMap.put(request.getCapability(), request);
- } else {
- resourceRequest.setNumContainers(
- resourceRequest.getNumContainers() + request.getNumContainers());
- }
- if (ResourceRequest.isAnyLocation(request.getResourceName())) {
- LOG.info("# of outstandingOpReqs in ANY (at priority = " + priority
- + ", with capability = " + request.getCapability() + " ) : "
- + resourceRequest.getNumContainers());
- }
- }
- }
-
- /**
- * This method matches a returned list of Container Allocations to any
- * outstanding OPPORTUNISTIC ResourceRequest.
- */
- private void matchAllocationToOutstandingRequest(Resource capability,
- List<Container> allocatedContainers) {
- for (Container c : allocatedContainers) {
- containersAllocated.add(c.getId());
- Map<Resource, ResourceRequest> asks =
- outstandingOpReqs.get(c.getPriority());
-
- if (asks == null)
- continue;
-
- ResourceRequest rr = asks.get(capability);
- if (rr != null) {
- rr.setNumContainers(rr.getNumContainers() - 1);
- if (rr.getNumContainers() == 0) {
- asks.remove(capability);
- }
- }
- }
- }
-
private void setNodeList(List<NodeId> nodeList) {
- this.nodeList.clear();
+ oppContainerContext.getNodeMap().clear();
addToNodeList(nodeList);
}
private void addToNodeList(List<NodeId> nodes) {
for (NodeId n : nodes) {
- this.nodeList.put(n.getHost(), n);
+ oppContainerContext.getNodeMap().put(n.getHost(), n);
}
}
@@ -345,52 +229,13 @@ public final class DistributedScheduler extends AbstractRequestInterceptor {
LOG.debug("Forwarding allocate request to the" +
"Distributed Scheduler Service on YARN RM");
}
- // Partition requests into GUARANTEED and OPPORTUNISTIC reqs
- PartitionedResourceRequests partitionedAsks =
- partitionAskList(request.getAllocateRequest().getAskList());
-
- List<ContainerId> releasedContainers =
- request.getAllocateRequest().getReleaseList();
- int numReleasedContainers = releasedContainers.size();
- if (numReleasedContainers > 0) {
- LOG.info("AttemptID: " + applicationAttemptId + " released: "
- + numReleasedContainers);
- containersAllocated.removeAll(releasedContainers);
- }
-
- // Also, update black list
- ResourceBlacklistRequest rbr =
- request.getAllocateRequest().getResourceBlacklistRequest();
- if (rbr != null) {
- blacklist.removeAll(rbr.getBlacklistRemovals());
- blacklist.addAll(rbr.getBlacklistAdditions());
- }
-
- // Add OPPORTUNISTIC reqs to the outstanding reqs
- addToOutstandingReqs(partitionedAsks.getOpportunistic());
-
- List<Container> allocatedContainers = new ArrayList<>();
- for (Priority priority : outstandingOpReqs.descendingKeySet()) {
- // Allocated containers :
- // Key = Requested Capability,
- // Value = List of Containers of given Cap (The actual container size
- // might be different than what is requested.. which is why
- // we need the requested capability (key) to match against
- // the outstanding reqs)
- Map<Resource, List<Container>> allocated =
- containerAllocator.allocate(this.appParams, containerIdCounter,
- outstandingOpReqs.get(priority).values(), blacklist,
- applicationAttemptId, nodeList, appSubmitter);
- for (Map.Entry<Resource, List<Container>> e : allocated.entrySet()) {
- matchAllocationToOutstandingRequest(e.getKey(), e.getValue());
- allocatedContainers.addAll(e.getValue());
- }
- }
+ List<Container> allocatedContainers =
+ containerAllocator.allocateContainers(
+ request.getAllocateRequest(), applicationAttemptId,
+ oppContainerContext, rmIdentifier, appSubmitter);
request.setAllocatedContainers(allocatedContainers);
- // Send all the GUARANTEED Reqs to RM
- request.getAllocateRequest().setAskList(partitionedAsks.getGuaranteed());
DistributedSchedulingAllocateResponse dsResp =
getNextInterceptor().allocateForDistributedScheduling(request);
@@ -398,7 +243,7 @@ public final class DistributedScheduler extends AbstractRequestInterceptor {
setNodeList(dsResp.getNodesForScheduling());
List<NMToken> nmTokens = dsResp.getAllocateResponse().getNMTokens();
for (NMToken nmToken : nmTokens) {
- nodeTokens.put(nmToken.getNodeId(), nmToken);
+ oppContainerContext.getNodeTokens().put(nmToken.getNodeId(), nmToken);
}
List<ContainerStatus> completedContainers =
@@ -407,7 +252,8 @@ public final class DistributedScheduler extends AbstractRequestInterceptor {
// Only account for opportunistic containers
for (ContainerStatus cs : completedContainers) {
if (cs.getExecutionType() == ExecutionType.OPPORTUNISTIC) {
- containersAllocated.remove(cs.getContainerId());
+ oppContainerContext.getContainersAllocated()
+ .remove(cs.getContainerId());
}
}
@@ -417,9 +263,9 @@ public final class DistributedScheduler extends AbstractRequestInterceptor {
dsResp.getAllocateResponse(), nmTokens, allocatedContainers);
if (LOG.isDebugEnabled()) {
- LOG.debug(
- "Number of opportunistic containers currently allocated by" +
- "application: " + containersAllocated.size());
+ LOG.debug("Number of opportunistic containers currently" +
+ "allocated by application: " + oppContainerContext
+ .getContainersAllocated().size());
}
return dsResp;
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/82c9e061/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/scheduler/OpportunisticContainerAllocator.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/scheduler/OpportunisticContainerAllocator.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/scheduler/OpportunisticContainerAllocator.java
deleted file mode 100644
index 4723233..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/scheduler/OpportunisticContainerAllocator.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/**
- * 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.hadoop.yarn.server.nodemanager.scheduler;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.net.NetUtils;
-import org.apache.hadoop.security.SecurityUtil;
-import org.apache.hadoop.yarn.api.records.*;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.hadoop.yarn.nodelabels.CommonNodeLabelsManager;
-import org.apache.hadoop.yarn.security.ContainerTokenIdentifier;
-import org.apache.hadoop.yarn.server.api.ContainerType;
-import org.apache.hadoop.yarn.server.nodemanager.Context;
-import org.apache.hadoop.yarn.server.nodemanager.NodeStatusUpdater;
-import org.apache.hadoop.yarn.server.nodemanager.scheduler.DistributedScheduler.DistributedSchedulerParams;
-import org.apache.hadoop.yarn.server.utils.BuilderUtils;
-import org.apache.hadoop.yarn.util.resource.DominantResourceCalculator;
-import org.apache.hadoop.yarn.util.resource.ResourceCalculator;
-import org.apache.hadoop.yarn.util.resource.Resources;
-
-import java.net.InetSocketAddress;
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * <p>
- * The OpportunisticContainerAllocator allocates containers on a given list of
- * nodes, after modifying the container sizes to respect the limits set by the
- * ResourceManager. It tries to distribute the containers as evenly as possible.
- * It also uses the <code>NMTokenSecretManagerInNM</code> to generate the
- * required NM tokens for the allocated containers.
- * </p>
- */
-public class OpportunisticContainerAllocator {
-
- private static final Log LOG =
- LogFactory.getLog(OpportunisticContainerAllocator.class);
-
- private static final ResourceCalculator RESOURCE_CALCULATOR =
- new DominantResourceCalculator();
-
- static class ContainerIdCounter {
- final AtomicLong containerIdCounter = new AtomicLong(1);
-
- void resetContainerIdCounter(long containerIdStart) {
- this.containerIdCounter.set(containerIdStart);
- }
-
- long generateContainerId() {
- return this.containerIdCounter.decrementAndGet();
- }
- }
-
- private final NodeStatusUpdater nodeStatusUpdater;
- private final Context context;
- private int webpagePort;
-
- public OpportunisticContainerAllocator(NodeStatusUpdater nodeStatusUpdater,
- Context context, int webpagePort) {
- this.nodeStatusUpdater = nodeStatusUpdater;
- this.context = context;
- this.webpagePort = webpagePort;
- }
-
- public Map<Resource, List<Container>> allocate(
- DistributedSchedulerParams appParams, ContainerIdCounter idCounter,
- Collection<ResourceRequest> resourceAsks, Set<String> blacklist,
- ApplicationAttemptId appAttId, Map<String, NodeId> allNodes,
- String userName) throws YarnException {
- Map<Resource, List<Container>> containers = new HashMap<>();
- for (ResourceRequest anyAsk : resourceAsks) {
- allocateOpportunisticContainers(appParams, idCounter, blacklist, appAttId,
- allNodes, userName, containers, anyAsk);
- LOG.info("Opportunistic allocation requested for ["
- + "priority=" + anyAsk.getPriority()
- + ", num_containers=" + anyAsk.getNumContainers()
- + ", capability=" + anyAsk.getCapability() + "]"
- + " allocated = " + containers.get(anyAsk.getCapability()).size());
- }
- return containers;
- }
-
- private void allocateOpportunisticContainers(
- DistributedSchedulerParams appParams, ContainerIdCounter idCounter,
- Set<String> blacklist, ApplicationAttemptId id,
- Map<String, NodeId> allNodes, String userName,
- Map<Resource, List<Container>> containers, ResourceRequest anyAsk)
- throws YarnException {
- int toAllocate = anyAsk.getNumContainers()
- - (containers.isEmpty() ? 0 :
- containers.get(anyAsk.getCapability()).size());
-
- List<NodeId> nodesForScheduling = new ArrayList<>();
- for (Entry<String, NodeId> nodeEntry : allNodes.entrySet()) {
- // Do not use blacklisted nodes for scheduling.
- if (blacklist.contains(nodeEntry.getKey())) {
- continue;
- }
- nodesForScheduling.add(nodeEntry.getValue());
- }
- int numAllocated = 0;
- int nextNodeToSchedule = 0;
- for (int numCont = 0; numCont < toAllocate; numCont++) {
- nextNodeToSchedule++;
- nextNodeToSchedule %= nodesForScheduling.size();
- NodeId nodeId = nodesForScheduling.get(nextNodeToSchedule);
- Container container = buildContainer(appParams, idCounter, anyAsk, id,
- userName, nodeId);
- List<Container> cList = containers.get(anyAsk.getCapability());
- if (cList == null) {
- cList = new ArrayList<>();
- containers.put(anyAsk.getCapability(), cList);
- }
- cList.add(container);
- numAllocated++;
- LOG.info("Allocated [" + container.getId() + "] as opportunistic.");
- }
- LOG.info("Allocated " + numAllocated + " opportunistic containers.");
- }
-
- private Container buildContainer(DistributedSchedulerParams appParams,
- ContainerIdCounter idCounter, ResourceRequest rr, ApplicationAttemptId id,
- String userName, NodeId nodeId) throws YarnException {
- ContainerId cId =
- ContainerId.newContainerId(id, idCounter.generateContainerId());
-
- // Normalize the resource asks (Similar to what the the RM scheduler does
- // before accepting an ask)
- Resource capability = normalizeCapability(appParams, rr);
-
- long currTime = System.currentTimeMillis();
- ContainerTokenIdentifier containerTokenIdentifier =
- new ContainerTokenIdentifier(
- cId, nodeId.getHost() + ":" + nodeId.getPort(), userName,
- capability, currTime + appParams.containerTokenExpiryInterval,
- context.getContainerTokenSecretManager().getCurrentKey().getKeyId(),
- nodeStatusUpdater.getRMIdentifier(), rr.getPriority(), currTime,
- null, CommonNodeLabelsManager.NO_LABEL, ContainerType.TASK,
- ExecutionType.OPPORTUNISTIC);
- byte[] pwd =
- context.getContainerTokenSecretManager().createPassword(
- containerTokenIdentifier);
- Token containerToken = newContainerToken(nodeId, pwd,
- containerTokenIdentifier);
- Container container = BuilderUtils.newContainer(
- cId, nodeId, nodeId.getHost() + ":" + webpagePort,
- capability, rr.getPriority(), containerToken,
- containerTokenIdentifier.getExecutionType(),
- rr.getAllocationRequestId());
- return container;
- }
-
- private Resource normalizeCapability(DistributedSchedulerParams appParams,
- ResourceRequest ask) {
- return Resources.normalize(RESOURCE_CALCULATOR,
- ask.getCapability(), appParams.minResource, appParams.maxResource,
- appParams.incrementResource);
- }
-
- public static Token newContainerToken(NodeId nodeId, byte[] password,
- ContainerTokenIdentifier tokenIdentifier) {
- // RPC layer client expects ip:port as service for tokens
- InetSocketAddress addr = NetUtils.createSocketAddrForHost(nodeId.getHost(),
- nodeId.getPort());
- // NOTE: use SecurityUtil.setTokenService if this becomes a "real" token
- Token containerToken = Token.newInstance(tokenIdentifier.getBytes(),
- ContainerTokenIdentifier.KIND.toString(), password, SecurityUtil
- .buildTokenService(addr).toString());
- return containerToken;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/82c9e061/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/BaseAMRMProxyTest.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/BaseAMRMProxyTest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/BaseAMRMProxyTest.java
index f716d44..d8660dd 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/BaseAMRMProxyTest.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/BaseAMRMProxyTest.java
@@ -67,7 +67,7 @@ import org.apache.hadoop.yarn.server.nodemanager.containermanager.ContainerManag
import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.Application;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container;
import org.apache.hadoop.yarn.server.nodemanager.recovery.NMStateStoreService;
-import org.apache.hadoop.yarn.server.nodemanager.scheduler.OpportunisticContainerAllocator;
+import org.apache.hadoop.yarn.server.scheduler.OpportunisticContainerAllocator;
import org.apache.hadoop.yarn.server.nodemanager.security.NMContainerTokenSecretManager;
import org.apache.hadoop.yarn.server.nodemanager.security.NMTokenSecretManagerInNM;
import org.apache.hadoop.yarn.server.nodemanager.timelineservice.NMTimelinePublisher;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/82c9e061/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/scheduler/TestDistributedScheduler.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/scheduler/TestDistributedScheduler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/scheduler/TestDistributedScheduler.java
index b093b3b..8f1ae7f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/scheduler/TestDistributedScheduler.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/scheduler/TestDistributedScheduler.java
@@ -38,11 +38,12 @@ import org.apache.hadoop.yarn.server.api.protocolrecords.DistributedSchedulingAl
import org.apache.hadoop.yarn.server.api.protocolrecords.DistributedSchedulingAllocateResponse;
import org.apache.hadoop.yarn.server.api.protocolrecords.RegisterDistributedSchedulingAMResponse;
import org.apache.hadoop.yarn.server.api.records.MasterKey;
-import org.apache.hadoop.yarn.server.nodemanager.Context;
import org.apache.hadoop.yarn.server.nodemanager.NodeStatusUpdater;
import org.apache.hadoop.yarn.server.nodemanager.amrmproxy.RequestInterceptor;
import org.apache.hadoop.yarn.server.nodemanager.security.NMContainerTokenSecretManager;
import org.apache.hadoop.yarn.server.nodemanager.security.NMTokenSecretManagerInNM;
+
+import org.apache.hadoop.yarn.server.scheduler.OpportunisticContainerAllocator;
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
import org.apache.hadoop.yarn.util.Records;
import org.junit.Assert;
@@ -189,7 +190,6 @@ public class TestDistributedScheduler {
DistributedScheduler distributedScheduler) {
NodeStatusUpdater nodeStatusUpdater = Mockito.mock(NodeStatusUpdater.class);
Mockito.when(nodeStatusUpdater.getRMIdentifier()).thenReturn(12345l);
- Context context = Mockito.mock(Context.class);
NMContainerTokenSecretManager nmContainerTokenSecretManager = new
NMContainerTokenSecretManager(conf);
MasterKey mKey = new MasterKey() {
@@ -207,15 +207,13 @@ public class TestDistributedScheduler {
public void setBytes(ByteBuffer bytes) {}
};
nmContainerTokenSecretManager.setMasterKey(mKey);
- Mockito.when(context.getContainerTokenSecretManager()).thenReturn
- (nmContainerTokenSecretManager);
OpportunisticContainerAllocator containerAllocator =
- new OpportunisticContainerAllocator(nodeStatusUpdater, context, 7777);
+ new OpportunisticContainerAllocator(nmContainerTokenSecretManager, 77);
NMTokenSecretManagerInNM nmTokenSecretManagerInNM =
new NMTokenSecretManagerInNM();
nmTokenSecretManagerInNM.setMasterKey(mKey);
- distributedScheduler.initLocal(
+ distributedScheduler.initLocal(1234,
ApplicationAttemptId.newInstance(ApplicationId.newInstance(1, 1), 1),
containerAllocator, nmTokenSecretManagerInNM, "test");
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[11/50] [abbrv] hadoop git commit: HADOOP-10682. Replace
FsDatasetImpl object lock with a separate lock object. (Chen Liang)
Posted by wa...@apache.org.
HADOOP-10682. Replace FsDatasetImpl object lock with a separate lock object. (Chen Liang)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/8c063847
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/8c063847
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/8c063847
Branch: refs/heads/YARN-3368
Commit: 8c0638471f8f1dd47667b2d6727d4d2d54e4b48c
Parents: 6255859
Author: Arpit Agarwal <ar...@apache.org>
Authored: Mon Aug 8 12:02:53 2016 -0700
Committer: Arpit Agarwal <ar...@apache.org>
Committed: Mon Aug 8 12:02:53 2016 -0700
----------------------------------------------------------------------
.../hadoop/hdfs/server/datanode/DataNode.java | 3 +-
.../hdfs/server/datanode/DirectoryScanner.java | 3 +-
.../hdfs/server/datanode/DiskBalancer.java | 3 +-
.../server/datanode/fsdataset/FsDatasetSpi.java | 6 +
.../datanode/fsdataset/impl/FsDatasetImpl.java | 927 ++++++++++---------
.../datanode/fsdataset/impl/FsVolumeImpl.java | 9 +-
.../server/datanode/SimulatedFSDataset.java | 9 +
.../hdfs/server/datanode/TestBlockRecovery.java | 3 +-
.../server/datanode/TestDirectoryScanner.java | 9 +-
.../extdataset/ExternalDatasetImpl.java | 5 +
10 files changed, 533 insertions(+), 444 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/8c063847/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
index ac55397..e502f1c 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
@@ -115,6 +115,7 @@ import org.apache.hadoop.hdfs.DFSUtil;
import org.apache.hadoop.hdfs.DFSUtilClient;
import org.apache.hadoop.hdfs.HDFSPolicyProvider;
import org.apache.hadoop.hdfs.HdfsConfiguration;
+import org.apache.hadoop.util.AutoCloseableLock;
import org.apache.hadoop.hdfs.client.BlockReportOptions;
import org.apache.hadoop.hdfs.client.HdfsClientConfigKeys;
import org.apache.hadoop.hdfs.net.DomainPeerServer;
@@ -2877,7 +2878,7 @@ public class DataNode extends ReconfigurableBase
final BlockConstructionStage stage;
//get replica information
- synchronized(data) {
+ try(AutoCloseableLock lock = data.acquireDatasetLock()) {
Block storedBlock = data.getStoredBlock(b.getBlockPoolId(),
b.getBlockId());
if (null == storedBlock) {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/8c063847/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java
index 1db445e..7c8985e 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java
@@ -44,6 +44,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.util.AutoCloseableLock;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.protocol.Block;
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
@@ -583,7 +584,7 @@ public class DirectoryScanner implements Runnable {
Map<String, ScanInfo[]> diskReport = getDiskReport();
// Hold FSDataset lock to prevent further changes to the block map
- synchronized(dataset) {
+ try(AutoCloseableLock lock = dataset.acquireDatasetLock()) {
for (Entry<String, ScanInfo[]> entry : diskReport.entrySet()) {
String bpid = entry.getKey();
ScanInfo[] blockpoolReport = entry.getValue();
http://git-wip-us.apache.org/repos/asf/hadoop/blob/8c063847/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DiskBalancer.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DiskBalancer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DiskBalancer.java
index c73b10f..1f61861 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DiskBalancer.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DiskBalancer.java
@@ -22,6 +22,7 @@ import com.google.common.base.Preconditions;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.util.AutoCloseableLock;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.protocol.ExtendedBlock;
import org.apache.hadoop.hdfs.server.datanode.DiskBalancerWorkStatus
@@ -454,7 +455,7 @@ public class DiskBalancer {
Map<String, FsVolumeSpi> pathMap = new HashMap<>();
FsDatasetSpi.FsVolumeReferences references;
try {
- synchronized (this.dataset) {
+ try(AutoCloseableLock lock = this.dataset.acquireDatasetLock()) {
references = this.dataset.getFsVolumeReferences();
for (int ndx = 0; ndx < references.size(); ndx++) {
FsVolumeSpi vol = references.get(ndx);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/8c063847/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/FsDatasetSpi.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/FsDatasetSpi.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/FsDatasetSpi.java
index eeab098..acc269a 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/FsDatasetSpi.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/FsDatasetSpi.java
@@ -35,6 +35,7 @@ import java.util.Set;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.StorageType;
+import org.apache.hadoop.util.AutoCloseableLock;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.protocol.Block;
import org.apache.hadoop.hdfs.protocol.BlockListAsLongs;
@@ -639,4 +640,9 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
*/
ReplicaInfo moveBlockAcrossVolumes(final ExtendedBlock block,
FsVolumeSpi destination) throws IOException;
+
+ /**
+ * Acquire the lock of the data set.
+ */
+ AutoCloseableLock acquireDatasetLock();
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/8c063847/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java
index c0f2fbd..c4d924e 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java
@@ -60,6 +60,7 @@ import org.apache.hadoop.fs.StorageType;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.DFSUtilClient;
import org.apache.hadoop.hdfs.ExtendedBlockId;
+import org.apache.hadoop.util.AutoCloseableLock;
import org.apache.hadoop.hdfs.protocol.Block;
import org.apache.hadoop.hdfs.protocol.BlockListAsLongs;
import org.apache.hadoop.hdfs.protocol.BlockLocalPathInfo;
@@ -175,21 +176,26 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
}
@Override
- public synchronized FsVolumeImpl getVolume(final ExtendedBlock b) {
- final ReplicaInfo r = volumeMap.get(b.getBlockPoolId(), b.getLocalBlock());
- return r != null? (FsVolumeImpl)r.getVolume(): null;
+ public FsVolumeImpl getVolume(final ExtendedBlock b) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
+ final ReplicaInfo r =
+ volumeMap.get(b.getBlockPoolId(), b.getLocalBlock());
+ return r != null ? (FsVolumeImpl) r.getVolume() : null;
+ }
}
@Override // FsDatasetSpi
- public synchronized Block getStoredBlock(String bpid, long blkid)
+ public Block getStoredBlock(String bpid, long blkid)
throws IOException {
- File blockfile = getFile(bpid, blkid, false);
- if (blockfile == null) {
- return null;
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
+ File blockfile = getFile(bpid, blkid, false);
+ if (blockfile == null) {
+ return null;
+ }
+ final File metafile = FsDatasetUtil.findMetaFile(blockfile);
+ final long gs = FsDatasetUtil.parseGenerationStamp(blockfile, metafile);
+ return new Block(blkid, blockfile.length(), gs);
}
- final File metafile = FsDatasetUtil.findMetaFile(blockfile);
- final long gs = FsDatasetUtil.parseGenerationStamp(blockfile, metafile);
- return new Block(blkid, blockfile.length(), gs);
}
@@ -258,6 +264,8 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
private boolean blockPinningEnabled;
private final int maxDataLength;
+
+ private final AutoCloseableLock datasetLock;
/**
* An FSDataset has a directory where it loads its data files.
@@ -269,6 +277,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
this.dataStorage = storage;
this.conf = conf;
this.smallBufferSize = DFSUtilClient.getSmallBufferSize(conf);
+ this.datasetLock = new AutoCloseableLock();
// The number of volumes required for operation is the total number
// of volumes minus the number of failed volumes we can tolerate.
volFailuresTolerated = datanode.getDnConf().getVolFailuresTolerated();
@@ -341,6 +350,11 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
CommonConfigurationKeys.IPC_MAXIMUM_DATA_LENGTH_DEFAULT);
}
+ @Override
+ public AutoCloseableLock acquireDatasetLock() {
+ return datasetLock.acquire();
+ }
+
/**
* Gets initial volume failure information for all volumes that failed
* immediately at startup. The method works by determining the set difference
@@ -375,25 +389,27 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
* Activate a volume to serve requests.
* @throws IOException if the storage UUID already exists.
*/
- private synchronized void activateVolume(
+ private void activateVolume(
ReplicaMap replicaMap,
Storage.StorageDirectory sd, StorageType storageType,
FsVolumeReference ref) throws IOException {
- DatanodeStorage dnStorage = storageMap.get(sd.getStorageUuid());
- if (dnStorage != null) {
- final String errorMsg = String.format(
- "Found duplicated storage UUID: %s in %s.",
- sd.getStorageUuid(), sd.getVersionFile());
- LOG.error(errorMsg);
- throw new IOException(errorMsg);
- }
- volumeMap.addAll(replicaMap);
- storageMap.put(sd.getStorageUuid(),
- new DatanodeStorage(sd.getStorageUuid(),
- DatanodeStorage.State.NORMAL,
- storageType));
- asyncDiskService.addVolume(sd.getCurrentDir());
- volumes.addVolume(ref);
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
+ DatanodeStorage dnStorage = storageMap.get(sd.getStorageUuid());
+ if (dnStorage != null) {
+ final String errorMsg = String.format(
+ "Found duplicated storage UUID: %s in %s.",
+ sd.getStorageUuid(), sd.getVersionFile());
+ LOG.error(errorMsg);
+ throw new IOException(errorMsg);
+ }
+ volumeMap.addAll(replicaMap);
+ storageMap.put(sd.getStorageUuid(),
+ new DatanodeStorage(sd.getStorageUuid(),
+ DatanodeStorage.State.NORMAL,
+ storageType));
+ asyncDiskService.addVolume(sd.getCurrentDir());
+ volumes.addVolume(ref);
+ }
}
private void addVolume(Collection<StorageLocation> dataLocations,
@@ -488,7 +504,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
Map<String, List<ReplicaInfo>> blkToInvalidate = new HashMap<>();
List<String> storageToRemove = new ArrayList<>();
- synchronized (this) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
for (int idx = 0; idx < dataStorage.getNumStorageDirs(); idx++) {
Storage.StorageDirectory sd = dataStorage.getStorageDir(idx);
final File absRoot = sd.getRoot().getAbsoluteFile();
@@ -534,7 +550,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
}
}
- synchronized (this) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
for(String storageUuid : storageToRemove) {
storageMap.remove(storageUuid);
}
@@ -743,7 +759,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
boolean touch)
throws IOException {
final File f;
- synchronized(this) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
f = getFile(b.getBlockPoolId(), b.getLocalBlock().getBlockId(), touch);
}
if (f == null) {
@@ -809,22 +825,25 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
* Returns handles to the block file and its metadata file
*/
@Override // FsDatasetSpi
- public synchronized ReplicaInputStreams getTmpInputStreams(ExtendedBlock b,
+ public ReplicaInputStreams getTmpInputStreams(ExtendedBlock b,
long blkOffset, long metaOffset) throws IOException {
- ReplicaInfo info = getReplicaInfo(b);
- FsVolumeReference ref = info.getVolume().obtainReference();
- try {
- InputStream blockInStream = openAndSeek(info.getBlockFile(), blkOffset);
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
+ ReplicaInfo info = getReplicaInfo(b);
+ FsVolumeReference ref = info.getVolume().obtainReference();
try {
- InputStream metaInStream = openAndSeek(info.getMetaFile(), metaOffset);
- return new ReplicaInputStreams(blockInStream, metaInStream, ref);
+ InputStream blockInStream = openAndSeek(info.getBlockFile(), blkOffset);
+ try {
+ InputStream metaInStream =
+ openAndSeek(info.getMetaFile(), metaOffset);
+ return new ReplicaInputStreams(blockInStream, metaInStream, ref);
+ } catch (IOException e) {
+ IOUtils.cleanup(null, blockInStream);
+ throw e;
+ }
} catch (IOException e) {
- IOUtils.cleanup(null, blockInStream);
+ IOUtils.cleanup(null, ref);
throw e;
}
- } catch (IOException e) {
- IOUtils.cleanup(null, ref);
- throw e;
}
}
@@ -943,7 +962,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
}
FsVolumeReference volumeRef = null;
- synchronized (this) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
volumeRef = volumes.getNextVolume(targetStorageType, block.getNumBytes());
}
try {
@@ -985,7 +1004,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
newReplicaInfo.setNumBytes(blockFiles[1].length());
// Finalize the copied files
newReplicaInfo = finalizeReplica(block.getBlockPoolId(), newReplicaInfo);
- synchronized (this) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
// Increment numBlocks here as this block moved without knowing to BPS
FsVolumeImpl volume = (FsVolumeImpl) newReplicaInfo.getVolume();
volume.getBlockPoolSlice(block.getBlockPoolId()).incrNumBlocks();
@@ -1015,7 +1034,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
FsVolumeReference volumeRef = null;
- synchronized (this) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
volumeRef = destination.obtainReference();
}
@@ -1143,41 +1162,44 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
@Override // FsDatasetSpi
- public synchronized ReplicaHandler append(ExtendedBlock b,
+ public ReplicaHandler append(ExtendedBlock b,
long newGS, long expectedBlockLen) throws IOException {
- // If the block was successfully finalized because all packets
- // were successfully processed at the Datanode but the ack for
- // some of the packets were not received by the client. The client
- // re-opens the connection and retries sending those packets.
- // The other reason is that an "append" is occurring to this block.
-
- // check the validity of the parameter
- if (newGS < b.getGenerationStamp()) {
- throw new IOException("The new generation stamp " + newGS +
- " should be greater than the replica " + b + "'s generation stamp");
- }
- ReplicaInfo replicaInfo = getReplicaInfo(b);
- LOG.info("Appending to " + replicaInfo);
- if (replicaInfo.getState() != ReplicaState.FINALIZED) {
- throw new ReplicaNotFoundException(
- ReplicaNotFoundException.UNFINALIZED_REPLICA + b);
- }
- if (replicaInfo.getNumBytes() != expectedBlockLen) {
- throw new IOException("Corrupted replica " + replicaInfo +
- " with a length of " + replicaInfo.getNumBytes() +
- " expected length is " + expectedBlockLen);
- }
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
+ // If the block was successfully finalized because all packets
+ // were successfully processed at the Datanode but the ack for
+ // some of the packets were not received by the client. The client
+ // re-opens the connection and retries sending those packets.
+ // The other reason is that an "append" is occurring to this block.
+
+ // check the validity of the parameter
+ if (newGS < b.getGenerationStamp()) {
+ throw new IOException("The new generation stamp " + newGS +
+ " should be greater than the replica " + b + "'s generation stamp");
+ }
+ ReplicaInfo replicaInfo = getReplicaInfo(b);
+ LOG.info("Appending to " + replicaInfo);
+ if (replicaInfo.getState() != ReplicaState.FINALIZED) {
+ throw new ReplicaNotFoundException(
+ ReplicaNotFoundException.UNFINALIZED_REPLICA + b);
+ }
+ if (replicaInfo.getNumBytes() != expectedBlockLen) {
+ throw new IOException("Corrupted replica " + replicaInfo +
+ " with a length of " + replicaInfo.getNumBytes() +
+ " expected length is " + expectedBlockLen);
+ }
- FsVolumeReference ref = replicaInfo.getVolume().obtainReference();
- ReplicaBeingWritten replica = null;
- try {
- replica = append(b.getBlockPoolId(), (FinalizedReplica)replicaInfo, newGS,
- b.getNumBytes());
- } catch (IOException e) {
- IOUtils.cleanup(null, ref);
- throw e;
+ FsVolumeReference ref = replicaInfo.getVolume().obtainReference();
+ ReplicaBeingWritten replica = null;
+ try {
+ replica = append(b.getBlockPoolId(),
+ (FinalizedReplica) replicaInfo, newGS,
+ b.getNumBytes());
+ } catch (IOException e) {
+ IOUtils.cleanup(null, ref);
+ throw e;
+ }
+ return new ReplicaHandler(replica, ref);
}
- return new ReplicaHandler(replica, ref);
}
/** Append to a finalized replica
@@ -1192,66 +1214,68 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
* @throws IOException if moving the replica from finalized directory
* to rbw directory fails
*/
- private synchronized ReplicaBeingWritten append(String bpid,
+ private ReplicaBeingWritten append(String bpid,
FinalizedReplica replicaInfo, long newGS, long estimateBlockLen)
throws IOException {
- // If the block is cached, start uncaching it.
- cacheManager.uncacheBlock(bpid, replicaInfo.getBlockId());
-
- // If there are any hardlinks to the block, break them. This ensures we are
- // not appending to a file that is part of a previous/ directory.
- replicaInfo.breakHardLinksIfNeeded();
-
- // construct a RBW replica with the new GS
- File blkfile = replicaInfo.getBlockFile();
- FsVolumeImpl v = (FsVolumeImpl)replicaInfo.getVolume();
- long bytesReserved = estimateBlockLen - replicaInfo.getNumBytes();
- if (v.getAvailable() < bytesReserved) {
- throw new DiskOutOfSpaceException("Insufficient space for appending to "
- + replicaInfo);
- }
- File newBlkFile = new File(v.getRbwDir(bpid), replicaInfo.getBlockName());
- File oldmeta = replicaInfo.getMetaFile();
- ReplicaBeingWritten newReplicaInfo = new ReplicaBeingWritten(
- replicaInfo.getBlockId(), replicaInfo.getNumBytes(), newGS,
- v, newBlkFile.getParentFile(), Thread.currentThread(), bytesReserved);
- File newmeta = newReplicaInfo.getMetaFile();
-
- // rename meta file to rbw directory
- if (LOG.isDebugEnabled()) {
- LOG.debug("Renaming " + oldmeta + " to " + newmeta);
- }
- try {
- NativeIO.renameTo(oldmeta, newmeta);
- } catch (IOException e) {
- throw new IOException("Block " + replicaInfo + " reopen failed. " +
- " Unable to move meta file " + oldmeta +
- " to rbw dir " + newmeta, e);
- }
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
+ // If the block is cached, start uncaching it.
+ cacheManager.uncacheBlock(bpid, replicaInfo.getBlockId());
+
+ // If there are any hardlinks to the block, break them. This ensures we
+ // are not appending to a file that is part of a previous/ directory.
+ replicaInfo.breakHardLinksIfNeeded();
+
+ // construct a RBW replica with the new GS
+ File blkfile = replicaInfo.getBlockFile();
+ FsVolumeImpl v = (FsVolumeImpl) replicaInfo.getVolume();
+ long bytesReserved = estimateBlockLen - replicaInfo.getNumBytes();
+ if (v.getAvailable() < bytesReserved) {
+ throw new DiskOutOfSpaceException("Insufficient space for appending to "
+ + replicaInfo);
+ }
+ File newBlkFile = new File(v.getRbwDir(bpid), replicaInfo.getBlockName());
+ File oldmeta = replicaInfo.getMetaFile();
+ ReplicaBeingWritten newReplicaInfo = new ReplicaBeingWritten(
+ replicaInfo.getBlockId(), replicaInfo.getNumBytes(), newGS,
+ v, newBlkFile.getParentFile(), Thread.currentThread(), bytesReserved);
+ File newmeta = newReplicaInfo.getMetaFile();
+
+ // rename meta file to rbw directory
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Renaming " + oldmeta + " to " + newmeta);
+ }
+ try {
+ NativeIO.renameTo(oldmeta, newmeta);
+ } catch (IOException e) {
+ throw new IOException("Block " + replicaInfo + " reopen failed. " +
+ " Unable to move meta file " + oldmeta +
+ " to rbw dir " + newmeta, e);
+ }
- // rename block file to rbw directory
- if (LOG.isDebugEnabled()) {
- LOG.debug("Renaming " + blkfile + " to " + newBlkFile
- + ", file length=" + blkfile.length());
- }
- try {
- NativeIO.renameTo(blkfile, newBlkFile);
- } catch (IOException e) {
+ // rename block file to rbw directory
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Renaming " + blkfile + " to " + newBlkFile
+ + ", file length=" + blkfile.length());
+ }
try {
- NativeIO.renameTo(newmeta, oldmeta);
- } catch (IOException ex) {
- LOG.warn("Cannot move meta file " + newmeta +
- "back to the finalized directory " + oldmeta, ex);
+ NativeIO.renameTo(blkfile, newBlkFile);
+ } catch (IOException e) {
+ try {
+ NativeIO.renameTo(newmeta, oldmeta);
+ } catch (IOException ex) {
+ LOG.warn("Cannot move meta file " + newmeta +
+ "back to the finalized directory " + oldmeta, ex);
+ }
+ throw new IOException("Block " + replicaInfo + " reopen failed. " +
+ " Unable to move block file " + blkfile +
+ " to rbw dir " + newBlkFile, e);
}
- throw new IOException("Block " + replicaInfo + " reopen failed. " +
- " Unable to move block file " + blkfile +
- " to rbw dir " + newBlkFile, e);
+
+ // Replace finalized replica by a RBW replica in replicas map
+ volumeMap.add(bpid, newReplicaInfo);
+ v.reserveSpaceForReplica(bytesReserved);
+ return newReplicaInfo;
}
-
- // Replace finalized replica by a RBW replica in replicas map
- volumeMap.add(bpid, newReplicaInfo);
- v.reserveSpaceForReplica(bytesReserved);
- return newReplicaInfo;
}
private static class MustStopExistingWriter extends Exception {
@@ -1321,7 +1345,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
while (true) {
try {
- synchronized (this) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
ReplicaInfo replicaInfo = recoverCheck(b, newGS, expectedBlockLen);
FsVolumeReference ref = replicaInfo.getVolume().obtainReference();
@@ -1353,7 +1377,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
LOG.info("Recover failed close " + b);
while (true) {
try {
- synchronized (this) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
// check replica's state
ReplicaInfo replicaInfo = recoverCheck(b, newGS, expectedBlockLen);
// bump the replica's GS
@@ -1400,62 +1424,65 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
}
@Override // FsDatasetSpi
- public synchronized ReplicaHandler createRbw(
+ public ReplicaHandler createRbw(
StorageType storageType, ExtendedBlock b, boolean allowLazyPersist)
throws IOException {
- ReplicaInfo replicaInfo = volumeMap.get(b.getBlockPoolId(),
- b.getBlockId());
- if (replicaInfo != null) {
- throw new ReplicaAlreadyExistsException("Block " + b +
- " already exists in state " + replicaInfo.getState() +
- " and thus cannot be created.");
- }
- // create a new block
- FsVolumeReference ref = null;
-
- // Use ramdisk only if block size is a multiple of OS page size.
- // This simplifies reservation for partially used replicas
- // significantly.
- if (allowLazyPersist &&
- lazyWriter != null &&
- b.getNumBytes() % cacheManager.getOsPageSize() == 0 &&
- reserveLockedMemory(b.getNumBytes())) {
- try {
- // First try to place the block on a transient volume.
- ref = volumes.getNextTransientVolume(b.getNumBytes());
- datanode.getMetrics().incrRamDiskBlocksWrite();
- } catch(DiskOutOfSpaceException de) {
- // Ignore the exception since we just fall back to persistent storage.
- } finally {
- if (ref == null) {
- cacheManager.release(b.getNumBytes());
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
+ ReplicaInfo replicaInfo = volumeMap.get(b.getBlockPoolId(),
+ b.getBlockId());
+ if (replicaInfo != null) {
+ throw new ReplicaAlreadyExistsException("Block " + b +
+ " already exists in state " + replicaInfo.getState() +
+ " and thus cannot be created.");
+ }
+ // create a new block
+ FsVolumeReference ref = null;
+
+ // Use ramdisk only if block size is a multiple of OS page size.
+ // This simplifies reservation for partially used replicas
+ // significantly.
+ if (allowLazyPersist &&
+ lazyWriter != null &&
+ b.getNumBytes() % cacheManager.getOsPageSize() == 0 &&
+ reserveLockedMemory(b.getNumBytes())) {
+ try {
+ // First try to place the block on a transient volume.
+ ref = volumes.getNextTransientVolume(b.getNumBytes());
+ datanode.getMetrics().incrRamDiskBlocksWrite();
+ } catch (DiskOutOfSpaceException de) {
+ // Ignore the exception since we just fall back to persistent storage.
+ } finally {
+ if (ref == null) {
+ cacheManager.release(b.getNumBytes());
+ }
}
}
- }
- if (ref == null) {
- ref = volumes.getNextVolume(storageType, b.getNumBytes());
- }
+ if (ref == null) {
+ ref = volumes.getNextVolume(storageType, b.getNumBytes());
+ }
- FsVolumeImpl v = (FsVolumeImpl) ref.getVolume();
- // create an rbw file to hold block in the designated volume
+ FsVolumeImpl v = (FsVolumeImpl) ref.getVolume();
+ // create an rbw file to hold block in the designated volume
- if (allowLazyPersist && !v.isTransientStorage()) {
- datanode.getMetrics().incrRamDiskBlocksWriteFallback();
- }
+ if (allowLazyPersist && !v.isTransientStorage()) {
+ datanode.getMetrics().incrRamDiskBlocksWriteFallback();
+ }
- File f;
- try {
- f = v.createRbwFile(b.getBlockPoolId(), b.getLocalBlock());
- } catch (IOException e) {
- IOUtils.cleanup(null, ref);
- throw e;
- }
+ File f;
+ try {
+ f = v.createRbwFile(b.getBlockPoolId(), b.getLocalBlock());
+ } catch (IOException e) {
+ IOUtils.cleanup(null, ref);
+ throw e;
+ }
- ReplicaBeingWritten newReplicaInfo = new ReplicaBeingWritten(b.getBlockId(),
- b.getGenerationStamp(), v, f.getParentFile(), b.getNumBytes());
- volumeMap.add(b.getBlockPoolId(), newReplicaInfo);
- return new ReplicaHandler(newReplicaInfo, ref);
+ ReplicaBeingWritten newReplicaInfo =
+ new ReplicaBeingWritten(b.getBlockId(),
+ b.getGenerationStamp(), v, f.getParentFile(), b.getNumBytes());
+ volumeMap.add(b.getBlockPoolId(), newReplicaInfo);
+ return new ReplicaHandler(newReplicaInfo, ref);
+ }
}
@Override // FsDatasetSpi
@@ -1466,7 +1493,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
while (true) {
try {
- synchronized (this) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
ReplicaInfo replicaInfo = getReplicaInfo(b.getBlockPoolId(), b.getBlockId());
// check the replica's state
@@ -1487,61 +1514,64 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
}
}
- private synchronized ReplicaHandler recoverRbwImpl(ReplicaBeingWritten rbw,
+ private ReplicaHandler recoverRbwImpl(ReplicaBeingWritten rbw,
ExtendedBlock b, long newGS, long minBytesRcvd, long maxBytesRcvd)
throws IOException {
- // check generation stamp
- long replicaGenerationStamp = rbw.getGenerationStamp();
- if (replicaGenerationStamp < b.getGenerationStamp() ||
- replicaGenerationStamp > newGS) {
- throw new ReplicaNotFoundException(
- ReplicaNotFoundException.UNEXPECTED_GS_REPLICA + b +
- ". Expected GS range is [" + b.getGenerationStamp() + ", " +
- newGS + "].");
- }
-
- // check replica length
- long bytesAcked = rbw.getBytesAcked();
- long numBytes = rbw.getNumBytes();
- if (bytesAcked < minBytesRcvd || numBytes > maxBytesRcvd){
- throw new ReplicaNotFoundException("Unmatched length replica " +
- rbw + ": BytesAcked = " + bytesAcked +
- " BytesRcvd = " + numBytes + " are not in the range of [" +
- minBytesRcvd + ", " + maxBytesRcvd + "].");
- }
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
+ // check generation stamp
+ long replicaGenerationStamp = rbw.getGenerationStamp();
+ if (replicaGenerationStamp < b.getGenerationStamp() ||
+ replicaGenerationStamp > newGS) {
+ throw new ReplicaNotFoundException(
+ ReplicaNotFoundException.UNEXPECTED_GS_REPLICA + b +
+ ". Expected GS range is [" + b.getGenerationStamp() + ", " +
+ newGS + "].");
+ }
- FsVolumeReference ref = rbw.getVolume().obtainReference();
- try {
- // Truncate the potentially corrupt portion.
- // If the source was client and the last node in the pipeline was lost,
- // any corrupt data written after the acked length can go unnoticed.
- if (numBytes > bytesAcked) {
- final File replicafile = rbw.getBlockFile();
- truncateBlock(replicafile, rbw.getMetaFile(), numBytes, bytesAcked);
- rbw.setNumBytes(bytesAcked);
- rbw.setLastChecksumAndDataLen(bytesAcked, null);
- }
-
- // bump the replica's generation stamp to newGS
- bumpReplicaGS(rbw, newGS);
- } catch (IOException e) {
- IOUtils.cleanup(null, ref);
- throw e;
+ // check replica length
+ long bytesAcked = rbw.getBytesAcked();
+ long numBytes = rbw.getNumBytes();
+ if (bytesAcked < minBytesRcvd || numBytes > maxBytesRcvd) {
+ throw new ReplicaNotFoundException("Unmatched length replica " +
+ rbw + ": BytesAcked = " + bytesAcked +
+ " BytesRcvd = " + numBytes + " are not in the range of [" +
+ minBytesRcvd + ", " + maxBytesRcvd + "].");
+ }
+
+ FsVolumeReference ref = rbw.getVolume().obtainReference();
+ try {
+ // Truncate the potentially corrupt portion.
+ // If the source was client and the last node in the pipeline was lost,
+ // any corrupt data written after the acked length can go unnoticed.
+ if (numBytes > bytesAcked) {
+ final File replicafile = rbw.getBlockFile();
+ truncateBlock(replicafile, rbw.getMetaFile(), numBytes, bytesAcked);
+ rbw.setNumBytes(bytesAcked);
+ rbw.setLastChecksumAndDataLen(bytesAcked, null);
+ }
+
+ // bump the replica's generation stamp to newGS
+ bumpReplicaGS(rbw, newGS);
+ } catch (IOException e) {
+ IOUtils.cleanup(null, ref);
+ throw e;
+ }
+ return new ReplicaHandler(rbw, ref);
}
- return new ReplicaHandler(rbw, ref);
}
@Override // FsDatasetSpi
- public synchronized ReplicaInPipeline convertTemporaryToRbw(
+ public ReplicaInPipeline convertTemporaryToRbw(
final ExtendedBlock b) throws IOException {
- final long blockId = b.getBlockId();
- final long expectedGs = b.getGenerationStamp();
- final long visible = b.getNumBytes();
- LOG.info("Convert " + b + " from Temporary to RBW, visible length="
- + visible);
-
- final ReplicaInPipeline temp;
- {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
+ final long blockId = b.getBlockId();
+ final long expectedGs = b.getGenerationStamp();
+ final long visible = b.getNumBytes();
+ LOG.info("Convert " + b + " from Temporary to RBW, visible length="
+ + visible);
+
+ final ReplicaInPipeline temp;
+
// get replica
final ReplicaInfo r = volumeMap.get(b.getBlockPoolId(), blockId);
if (r == null) {
@@ -1553,43 +1583,44 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
throw new ReplicaAlreadyExistsException(
"r.getState() != ReplicaState.TEMPORARY, r=" + r);
}
- temp = (ReplicaInPipeline)r;
- }
- // check generation stamp
- if (temp.getGenerationStamp() != expectedGs) {
- throw new ReplicaAlreadyExistsException(
- "temp.getGenerationStamp() != expectedGs = " + expectedGs
- + ", temp=" + temp);
- }
+ temp = (ReplicaInPipeline) r;
- // TODO: check writer?
- // set writer to the current thread
- // temp.setWriter(Thread.currentThread());
+ // check generation stamp
+ if (temp.getGenerationStamp() != expectedGs) {
+ throw new ReplicaAlreadyExistsException(
+ "temp.getGenerationStamp() != expectedGs = " + expectedGs
+ + ", temp=" + temp);
+ }
- // check length
- final long numBytes = temp.getNumBytes();
- if (numBytes < visible) {
- throw new IOException(numBytes + " = numBytes < visible = "
- + visible + ", temp=" + temp);
- }
- // check volume
- final FsVolumeImpl v = (FsVolumeImpl)temp.getVolume();
- if (v == null) {
- throw new IOException("r.getVolume() = null, temp=" + temp);
+ // TODO: check writer?
+ // set writer to the current thread
+ // temp.setWriter(Thread.currentThread());
+
+ // check length
+ final long numBytes = temp.getNumBytes();
+ if (numBytes < visible) {
+ throw new IOException(numBytes + " = numBytes < visible = "
+ + visible + ", temp=" + temp);
+ }
+ // check volume
+ final FsVolumeImpl v = (FsVolumeImpl) temp.getVolume();
+ if (v == null) {
+ throw new IOException("r.getVolume() = null, temp=" + temp);
+ }
+
+ // move block files to the rbw directory
+ BlockPoolSlice bpslice = v.getBlockPoolSlice(b.getBlockPoolId());
+ final File dest = moveBlockFiles(b.getLocalBlock(), temp.getBlockFile(),
+ bpslice.getRbwDir());
+ // create RBW
+ final ReplicaBeingWritten rbw = new ReplicaBeingWritten(
+ blockId, numBytes, expectedGs,
+ v, dest.getParentFile(), Thread.currentThread(), 0);
+ rbw.setBytesAcked(visible);
+ // overwrite the RBW in the volume map
+ volumeMap.add(b.getBlockPoolId(), rbw);
+ return rbw;
}
-
- // move block files to the rbw directory
- BlockPoolSlice bpslice = v.getBlockPoolSlice(b.getBlockPoolId());
- final File dest = moveBlockFiles(b.getLocalBlock(), temp.getBlockFile(),
- bpslice.getRbwDir());
- // create RBW
- final ReplicaBeingWritten rbw = new ReplicaBeingWritten(
- blockId, numBytes, expectedGs,
- v, dest.getParentFile(), Thread.currentThread(), 0);
- rbw.setBytesAcked(visible);
- // overwrite the RBW in the volume map
- volumeMap.add(b.getBlockPoolId(), rbw);
- return rbw;
}
@Override // FsDatasetSpi
@@ -1599,7 +1630,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
long writerStopTimeoutMs = datanode.getDnConf().getXceiverStopTimeout();
ReplicaInfo lastFoundReplicaInfo = null;
do {
- synchronized (this) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
ReplicaInfo currentReplicaInfo =
volumeMap.get(b.getBlockPoolId(), b.getBlockId());
if (currentReplicaInfo == lastFoundReplicaInfo) {
@@ -1678,72 +1709,82 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
* Complete the block write!
*/
@Override // FsDatasetSpi
- public synchronized void finalizeBlock(ExtendedBlock b) throws IOException {
- if (Thread.interrupted()) {
- // Don't allow data modifications from interrupted threads
- throw new IOException("Cannot finalize block from Interrupted Thread");
- }
- ReplicaInfo replicaInfo = getReplicaInfo(b);
- if (replicaInfo.getState() == ReplicaState.FINALIZED) {
- // this is legal, when recovery happens on a file that has
- // been opened for append but never modified
- return;
+ public void finalizeBlock(ExtendedBlock b) throws IOException {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
+ if (Thread.interrupted()) {
+ // Don't allow data modifications from interrupted threads
+ throw new IOException("Cannot finalize block from Interrupted Thread");
+ }
+ ReplicaInfo replicaInfo = getReplicaInfo(b);
+ if (replicaInfo.getState() == ReplicaState.FINALIZED) {
+ // this is legal, when recovery happens on a file that has
+ // been opened for append but never modified
+ return;
+ }
+ finalizeReplica(b.getBlockPoolId(), replicaInfo);
}
- finalizeReplica(b.getBlockPoolId(), replicaInfo);
}
- private synchronized FinalizedReplica finalizeReplica(String bpid,
+ private FinalizedReplica finalizeReplica(String bpid,
ReplicaInfo replicaInfo) throws IOException {
- FinalizedReplica newReplicaInfo = null;
- if (replicaInfo.getState() == ReplicaState.RUR &&
- ((ReplicaUnderRecovery)replicaInfo).getOriginalReplica().getState() ==
- ReplicaState.FINALIZED) {
- newReplicaInfo = (FinalizedReplica)
- ((ReplicaUnderRecovery)replicaInfo).getOriginalReplica();
- } else {
- FsVolumeImpl v = (FsVolumeImpl)replicaInfo.getVolume();
- File f = replicaInfo.getBlockFile();
- if (v == null) {
- throw new IOException("No volume for temporary file " + f +
- " for block " + replicaInfo);
- }
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
+ FinalizedReplica newReplicaInfo = null;
+ if (replicaInfo.getState() == ReplicaState.RUR &&
+ ((ReplicaUnderRecovery) replicaInfo).getOriginalReplica().getState()
+ == ReplicaState.FINALIZED) {
+ newReplicaInfo = (FinalizedReplica)
+ ((ReplicaUnderRecovery) replicaInfo).getOriginalReplica();
+ } else {
+ FsVolumeImpl v = (FsVolumeImpl) replicaInfo.getVolume();
+ File f = replicaInfo.getBlockFile();
+ if (v == null) {
+ throw new IOException("No volume for temporary file " + f +
+ " for block " + replicaInfo);
+ }
- File dest = v.addFinalizedBlock(
- bpid, replicaInfo, f, replicaInfo.getBytesReserved());
- newReplicaInfo = new FinalizedReplica(replicaInfo, v, dest.getParentFile());
+ File dest = v.addFinalizedBlock(
+ bpid, replicaInfo, f, replicaInfo.getBytesReserved());
+ newReplicaInfo =
+ new FinalizedReplica(replicaInfo, v, dest.getParentFile());
- if (v.isTransientStorage()) {
- releaseLockedMemory(
- replicaInfo.getOriginalBytesReserved() - replicaInfo.getNumBytes(),
- false);
- ramDiskReplicaTracker.addReplica(
- bpid, replicaInfo.getBlockId(), v, replicaInfo.getNumBytes());
- datanode.getMetrics().addRamDiskBytesWrite(replicaInfo.getNumBytes());
+ if (v.isTransientStorage()) {
+ releaseLockedMemory(
+ replicaInfo.getOriginalBytesReserved()
+ - replicaInfo.getNumBytes(),
+ false);
+ ramDiskReplicaTracker.addReplica(
+ bpid, replicaInfo.getBlockId(), v, replicaInfo.getNumBytes());
+ datanode.getMetrics().addRamDiskBytesWrite(replicaInfo.getNumBytes());
+ }
}
- }
- volumeMap.add(bpid, newReplicaInfo);
+ volumeMap.add(bpid, newReplicaInfo);
- return newReplicaInfo;
+ return newReplicaInfo;
+ }
}
/**
* Remove the temporary block file (if any)
*/
@Override // FsDatasetSpi
- public synchronized void unfinalizeBlock(ExtendedBlock b) throws IOException {
- ReplicaInfo replicaInfo = volumeMap.get(b.getBlockPoolId(),
- b.getLocalBlock());
- if (replicaInfo != null && replicaInfo.getState() == ReplicaState.TEMPORARY) {
- // remove from volumeMap
- volumeMap.remove(b.getBlockPoolId(), b.getLocalBlock());
-
- // delete the on-disk temp file
- if (delBlockFromDisk(replicaInfo.getBlockFile(),
- replicaInfo.getMetaFile(), b.getLocalBlock())) {
- LOG.warn("Block " + b + " unfinalized and removed. " );
- }
- if (replicaInfo.getVolume().isTransientStorage()) {
- ramDiskReplicaTracker.discardReplica(b.getBlockPoolId(), b.getBlockId(), true);
+ public void unfinalizeBlock(ExtendedBlock b) throws IOException {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
+ ReplicaInfo replicaInfo = volumeMap.get(b.getBlockPoolId(),
+ b.getLocalBlock());
+ if (replicaInfo != null
+ && replicaInfo.getState() == ReplicaState.TEMPORARY) {
+ // remove from volumeMap
+ volumeMap.remove(b.getBlockPoolId(), b.getLocalBlock());
+
+ // delete the on-disk temp file
+ if (delBlockFromDisk(replicaInfo.getBlockFile(),
+ replicaInfo.getMetaFile(), b.getLocalBlock())) {
+ LOG.warn("Block " + b + " unfinalized and removed. ");
+ }
+ if (replicaInfo.getVolume().isTransientStorage()) {
+ ramDiskReplicaTracker.discardReplica(b.getBlockPoolId(),
+ b.getBlockId(), true);
+ }
}
}
}
@@ -1791,7 +1832,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
builders.put(v.getStorageID(), BlockListAsLongs.builder(maxDataLength));
}
- synchronized(this) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
for (ReplicaInfo b : volumeMap.replicas(bpid)) {
switch(b.getState()) {
case FINALIZED:
@@ -1824,31 +1865,36 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
* Get the list of finalized blocks from in-memory blockmap for a block pool.
*/
@Override
- public synchronized List<FinalizedReplica> getFinalizedBlocks(String bpid) {
- ArrayList<FinalizedReplica> finalized =
- new ArrayList<FinalizedReplica>(volumeMap.size(bpid));
- for (ReplicaInfo b : volumeMap.replicas(bpid)) {
- if(b.getState() == ReplicaState.FINALIZED) {
- finalized.add(new FinalizedReplica((FinalizedReplica)b));
+ public List<FinalizedReplica> getFinalizedBlocks(String bpid) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
+ ArrayList<FinalizedReplica> finalized =
+ new ArrayList<FinalizedReplica>(volumeMap.size(bpid));
+ for (ReplicaInfo b : volumeMap.replicas(bpid)) {
+ if (b.getState() == ReplicaState.FINALIZED) {
+ finalized.add(new FinalizedReplica((FinalizedReplica) b));
+ }
}
+ return finalized;
}
- return finalized;
}
/**
* Get the list of finalized blocks from in-memory blockmap for a block pool.
*/
@Override
- public synchronized List<FinalizedReplica> getFinalizedBlocksOnPersistentStorage(String bpid) {
- ArrayList<FinalizedReplica> finalized =
- new ArrayList<FinalizedReplica>(volumeMap.size(bpid));
- for (ReplicaInfo b : volumeMap.replicas(bpid)) {
- if(!b.getVolume().isTransientStorage() &&
- b.getState() == ReplicaState.FINALIZED) {
- finalized.add(new FinalizedReplica((FinalizedReplica)b));
+ public List<FinalizedReplica> getFinalizedBlocksOnPersistentStorage(
+ String bpid) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
+ ArrayList<FinalizedReplica> finalized =
+ new ArrayList<FinalizedReplica>(volumeMap.size(bpid));
+ for (ReplicaInfo b : volumeMap.replicas(bpid)) {
+ if (!b.getVolume().isTransientStorage() &&
+ b.getState() == ReplicaState.FINALIZED) {
+ finalized.add(new FinalizedReplica((FinalizedReplica) b));
+ }
}
+ return finalized;
}
- return finalized;
}
/**
@@ -1924,7 +1970,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
File validateBlockFile(String bpid, long blockId) {
//Should we check for metadata file too?
final File f;
- synchronized(this) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
f = getFile(bpid, blockId, false);
}
@@ -1973,7 +2019,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
for (int i = 0; i < invalidBlks.length; i++) {
final File f;
final FsVolumeImpl v;
- synchronized (this) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
final ReplicaInfo info = volumeMap.get(bpid, invalidBlks[i]);
if (info == null) {
// It is okay if the block is not found -- it may be deleted earlier.
@@ -2084,7 +2130,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
long length, genstamp;
Executor volumeExecutor;
- synchronized (this) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
ReplicaInfo info = volumeMap.get(bpid, blockId);
boolean success = false;
try {
@@ -2151,9 +2197,11 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
}
@Override // FsDatasetSpi
- public synchronized boolean contains(final ExtendedBlock block) {
- final long blockId = block.getLocalBlock().getBlockId();
- return getFile(block.getBlockPoolId(), blockId, false) != null;
+ public boolean contains(final ExtendedBlock block) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
+ final long blockId = block.getLocalBlock().getBlockId();
+ return getFile(block.getBlockPoolId(), blockId, false) != null;
+ }
}
/**
@@ -2279,7 +2327,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
File diskMetaFile, FsVolumeSpi vol) throws IOException {
Block corruptBlock = null;
ReplicaInfo memBlockInfo;
- synchronized (this) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
memBlockInfo = volumeMap.get(bpid, blockId);
if (memBlockInfo != null && memBlockInfo.getState() != ReplicaState.FINALIZED) {
// Block is not finalized - ignore the difference
@@ -2435,9 +2483,11 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
}
@Override
- public synchronized String getReplicaString(String bpid, long blockId) {
- final Replica r = volumeMap.get(bpid, blockId);
- return r == null? "null": r.toString();
+ public String getReplicaString(String bpid, long blockId) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
+ final Replica r = volumeMap.get(bpid, blockId);
+ return r == null ? "null" : r.toString();
+ }
}
@Override // FsDatasetSpi
@@ -2530,67 +2580,69 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
}
@Override // FsDatasetSpi
- public synchronized Replica updateReplicaUnderRecovery(
+ public Replica updateReplicaUnderRecovery(
final ExtendedBlock oldBlock,
final long recoveryId,
final long newBlockId,
final long newlength) throws IOException {
- //get replica
- final String bpid = oldBlock.getBlockPoolId();
- final ReplicaInfo replica = volumeMap.get(bpid, oldBlock.getBlockId());
- LOG.info("updateReplica: " + oldBlock
- + ", recoveryId=" + recoveryId
- + ", length=" + newlength
- + ", replica=" + replica);
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
+ //get replica
+ final String bpid = oldBlock.getBlockPoolId();
+ final ReplicaInfo replica = volumeMap.get(bpid, oldBlock.getBlockId());
+ LOG.info("updateReplica: " + oldBlock
+ + ", recoveryId=" + recoveryId
+ + ", length=" + newlength
+ + ", replica=" + replica);
- //check replica
- if (replica == null) {
- throw new ReplicaNotFoundException(oldBlock);
- }
+ //check replica
+ if (replica == null) {
+ throw new ReplicaNotFoundException(oldBlock);
+ }
- //check replica state
- if (replica.getState() != ReplicaState.RUR) {
- throw new IOException("replica.getState() != " + ReplicaState.RUR
- + ", replica=" + replica);
- }
+ //check replica state
+ if (replica.getState() != ReplicaState.RUR) {
+ throw new IOException("replica.getState() != " + ReplicaState.RUR
+ + ", replica=" + replica);
+ }
- //check replica's byte on disk
- if (replica.getBytesOnDisk() != oldBlock.getNumBytes()) {
- throw new IOException("THIS IS NOT SUPPOSED TO HAPPEN:"
- + " replica.getBytesOnDisk() != block.getNumBytes(), block="
- + oldBlock + ", replica=" + replica);
- }
-
- //check replica files before update
- checkReplicaFiles(replica);
-
- //update replica
- final FinalizedReplica finalized = updateReplicaUnderRecovery(oldBlock
- .getBlockPoolId(), (ReplicaUnderRecovery) replica, recoveryId,
- newBlockId, newlength);
-
- boolean copyTruncate = newBlockId != oldBlock.getBlockId();
- if(!copyTruncate) {
- assert finalized.getBlockId() == oldBlock.getBlockId()
- && finalized.getGenerationStamp() == recoveryId
- && finalized.getNumBytes() == newlength
- : "Replica information mismatched: oldBlock=" + oldBlock
- + ", recoveryId=" + recoveryId + ", newlength=" + newlength
- + ", newBlockId=" + newBlockId + ", finalized=" + finalized;
- } else {
- assert finalized.getBlockId() == oldBlock.getBlockId()
- && finalized.getGenerationStamp() == oldBlock.getGenerationStamp()
- && finalized.getNumBytes() == oldBlock.getNumBytes()
- : "Finalized and old information mismatched: oldBlock=" + oldBlock
- + ", genStamp=" + oldBlock.getGenerationStamp()
- + ", len=" + oldBlock.getNumBytes()
- + ", finalized=" + finalized;
- }
+ //check replica's byte on disk
+ if (replica.getBytesOnDisk() != oldBlock.getNumBytes()) {
+ throw new IOException("THIS IS NOT SUPPOSED TO HAPPEN:"
+ + " replica.getBytesOnDisk() != block.getNumBytes(), block="
+ + oldBlock + ", replica=" + replica);
+ }
+
+ //check replica files before update
+ checkReplicaFiles(replica);
+
+ //update replica
+ final FinalizedReplica finalized = updateReplicaUnderRecovery(oldBlock
+ .getBlockPoolId(), (ReplicaUnderRecovery) replica, recoveryId,
+ newBlockId, newlength);
+
+ boolean copyTruncate = newBlockId != oldBlock.getBlockId();
+ if (!copyTruncate) {
+ assert finalized.getBlockId() == oldBlock.getBlockId()
+ && finalized.getGenerationStamp() == recoveryId
+ && finalized.getNumBytes() == newlength
+ : "Replica information mismatched: oldBlock=" + oldBlock
+ + ", recoveryId=" + recoveryId + ", newlength=" + newlength
+ + ", newBlockId=" + newBlockId + ", finalized=" + finalized;
+ } else {
+ assert finalized.getBlockId() == oldBlock.getBlockId()
+ && finalized.getGenerationStamp() == oldBlock.getGenerationStamp()
+ && finalized.getNumBytes() == oldBlock.getNumBytes()
+ : "Finalized and old information mismatched: oldBlock=" + oldBlock
+ + ", genStamp=" + oldBlock.getGenerationStamp()
+ + ", len=" + oldBlock.getNumBytes()
+ + ", finalized=" + finalized;
+ }
- //check replica files after update
- checkReplicaFiles(finalized);
+ //check replica files after update
+ checkReplicaFiles(finalized);
- return finalized;
+ return finalized;
+ }
}
private FinalizedReplica updateReplicaUnderRecovery(
@@ -2668,23 +2720,25 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
}
@Override // FsDatasetSpi
- public synchronized long getReplicaVisibleLength(final ExtendedBlock block)
+ public long getReplicaVisibleLength(final ExtendedBlock block)
throws IOException {
- final Replica replica = getReplicaInfo(block.getBlockPoolId(),
- block.getBlockId());
- if (replica.getGenerationStamp() < block.getGenerationStamp()) {
- throw new IOException(
- "replica.getGenerationStamp() < block.getGenerationStamp(), block="
- + block + ", replica=" + replica);
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
+ final Replica replica = getReplicaInfo(block.getBlockPoolId(),
+ block.getBlockId());
+ if (replica.getGenerationStamp() < block.getGenerationStamp()) {
+ throw new IOException(
+ "replica.getGenerationStamp() < block.getGenerationStamp(), block="
+ + block + ", replica=" + replica);
+ }
+ return replica.getVisibleLength();
}
- return replica.getVisibleLength();
}
@Override
public void addBlockPool(String bpid, Configuration conf)
throws IOException {
LOG.info("Adding block pool " + bpid);
- synchronized(this) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
volumes.addBlockPool(bpid, conf);
volumeMap.initBlockPool(bpid);
}
@@ -2692,11 +2746,14 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
}
@Override
- public synchronized void shutdownBlockPool(String bpid) {
- LOG.info("Removing block pool " + bpid);
- Map<DatanodeStorage, BlockListAsLongs> blocksPerVolume = getBlockReports(bpid);
- volumeMap.cleanUpBlockPool(bpid);
- volumes.removeBlockPool(bpid, blocksPerVolume);
+ public void shutdownBlockPool(String bpid) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
+ LOG.info("Removing block pool " + bpid);
+ Map<DatanodeStorage, BlockListAsLongs> blocksPerVolume
+ = getBlockReports(bpid);
+ volumeMap.cleanUpBlockPool(bpid);
+ volumes.removeBlockPool(bpid, blocksPerVolume);
+ }
}
/**
@@ -2759,35 +2816,38 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
}
@Override //FsDatasetSpi
- public synchronized void deleteBlockPool(String bpid, boolean force)
+ public void deleteBlockPool(String bpid, boolean force)
throws IOException {
- List<FsVolumeImpl> curVolumes = volumes.getVolumes();
- if (!force) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
+ List<FsVolumeImpl> curVolumes = volumes.getVolumes();
+ if (!force) {
+ for (FsVolumeImpl volume : curVolumes) {
+ try (FsVolumeReference ref = volume.obtainReference()) {
+ if (!volume.isBPDirEmpty(bpid)) {
+ LOG.warn(bpid
+ + " has some block files, cannot delete unless forced");
+ throw new IOException("Cannot delete block pool, "
+ + "it contains some block files");
+ }
+ } catch (ClosedChannelException e) {
+ // ignore.
+ }
+ }
+ }
for (FsVolumeImpl volume : curVolumes) {
try (FsVolumeReference ref = volume.obtainReference()) {
- if (!volume.isBPDirEmpty(bpid)) {
- LOG.warn(bpid + " has some block files, cannot delete unless forced");
- throw new IOException("Cannot delete block pool, "
- + "it contains some block files");
- }
+ volume.deleteBPDirectories(bpid, force);
} catch (ClosedChannelException e) {
// ignore.
}
}
}
- for (FsVolumeImpl volume : curVolumes) {
- try (FsVolumeReference ref = volume.obtainReference()) {
- volume.deleteBPDirectories(bpid, force);
- } catch (ClosedChannelException e) {
- // ignore.
- }
- }
}
@Override // FsDatasetSpi
public BlockLocalPathInfo getBlockLocalPathInfo(ExtendedBlock block)
throws IOException {
- synchronized(this) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
final Replica replica = volumeMap.get(block.getBlockPoolId(),
block.getBlockId());
if (replica == null) {
@@ -2838,7 +2898,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
@Override
public void onCompleteLazyPersist(String bpId, long blockId,
long creationTime, File[] savedFiles, FsVolumeImpl targetVolume) {
- synchronized (FsDatasetImpl.this) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
ramDiskReplicaTracker.recordEndLazyPersist(bpId, blockId, savedFiles);
targetVolume.incDfsUsedAndNumBlocks(bpId, savedFiles[0].length()
@@ -2972,7 +3032,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
try {
block = ramDiskReplicaTracker.dequeueNextReplicaToPersist();
if (block != null) {
- synchronized (FsDatasetImpl.this) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
replicaInfo = volumeMap.get(block.getBlockPoolId(), block.getBlockId());
// If replicaInfo is null, the block was either deleted before
@@ -3042,7 +3102,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
long blockFileUsed, metaFileUsed;
final String bpid = replicaState.getBlockPoolId();
- synchronized (FsDatasetImpl.this) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
replicaInfo = getReplicaInfo(replicaState.getBlockPoolId(),
replicaState.getBlockId());
Preconditions.checkState(replicaInfo.getVolume().isTransientStorage());
@@ -3219,14 +3279,17 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
this.timer = newTimer;
}
- synchronized void stopAllDataxceiverThreads(FsVolumeImpl volume) {
- for (String blockPoolId : volumeMap.getBlockPoolList()) {
- Collection<ReplicaInfo> replicas = volumeMap.replicas(blockPoolId);
- for (ReplicaInfo replicaInfo : replicas) {
- if (replicaInfo instanceof ReplicaInPipeline
- && replicaInfo.getVolume().equals(volume)) {
- ReplicaInPipeline replicaInPipeline = (ReplicaInPipeline) replicaInfo;
- replicaInPipeline.interruptThread();
+ void stopAllDataxceiverThreads(FsVolumeImpl volume) {
+ try (AutoCloseableLock lock = datasetLock.acquire()) {
+ for (String blockPoolId : volumeMap.getBlockPoolList()) {
+ Collection<ReplicaInfo> replicas = volumeMap.replicas(blockPoolId);
+ for (ReplicaInfo replicaInfo : replicas) {
+ if (replicaInfo instanceof ReplicaInPipeline
+ && replicaInfo.getVolume().equals(volume)) {
+ ReplicaInPipeline replicaInPipeline
+ = (ReplicaInPipeline) replicaInfo;
+ replicaInPipeline.interruptThread();
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/8c063847/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeImpl.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeImpl.java
index 4a446d4..59c9ed4 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeImpl.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeImpl.java
@@ -45,6 +45,7 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.DF;
import org.apache.hadoop.fs.FileUtil;
import org.apache.hadoop.fs.StorageType;
+import org.apache.hadoop.util.AutoCloseableLock;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.protocol.Block;
import org.apache.hadoop.hdfs.protocol.BlockListAsLongs;
@@ -304,7 +305,7 @@ public class FsVolumeImpl implements FsVolumeSpi {
private void decDfsUsedAndNumBlocks(String bpid, long value,
boolean blockFileDeleted) {
- synchronized(dataset) {
+ try(AutoCloseableLock lock = dataset.acquireDatasetLock()) {
BlockPoolSlice bp = bpSlices.get(bpid);
if (bp != null) {
bp.decDfsUsed(value);
@@ -316,7 +317,7 @@ public class FsVolumeImpl implements FsVolumeSpi {
}
void incDfsUsedAndNumBlocks(String bpid, long value) {
- synchronized (dataset) {
+ try(AutoCloseableLock lock = dataset.acquireDatasetLock()) {
BlockPoolSlice bp = bpSlices.get(bpid);
if (bp != null) {
bp.incDfsUsed(value);
@@ -326,7 +327,7 @@ public class FsVolumeImpl implements FsVolumeSpi {
}
void incDfsUsed(String bpid, long value) {
- synchronized(dataset) {
+ try(AutoCloseableLock lock = dataset.acquireDatasetLock()) {
BlockPoolSlice bp = bpSlices.get(bpid);
if (bp != null) {
bp.incDfsUsed(value);
@@ -337,7 +338,7 @@ public class FsVolumeImpl implements FsVolumeSpi {
@VisibleForTesting
public long getDfsUsed() throws IOException {
long dfsUsed = 0;
- synchronized(dataset) {
+ try(AutoCloseableLock lock = dataset.acquireDatasetLock()) {
for(BlockPoolSlice s : bpSlices.values()) {
dfsUsed += s.getDfsUsed();
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/8c063847/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java
index 0565260..c0c76ad 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java
@@ -39,6 +39,7 @@ import javax.management.StandardMBean;
import org.apache.commons.lang.ArrayUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.StorageType;
+import org.apache.hadoop.util.AutoCloseableLock;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.protocol.Block;
import org.apache.hadoop.hdfs.protocol.BlockListAsLongs;
@@ -115,6 +116,9 @@ public class SimulatedFSDataset implements FsDatasetSpi<FsVolumeSpi> {
DatanodeStorage.State.NORMAL;
static final byte[] nullCrcFileData;
+
+ private final AutoCloseableLock datasetLock;
+
static {
DataChecksum checksum = DataChecksum.newDataChecksum(
DataChecksum.Type.NULL, 16*1024 );
@@ -550,6 +554,7 @@ public class SimulatedFSDataset implements FsDatasetSpi<FsVolumeSpi> {
conf.getLong(CONFIG_PROPERTY_CAPACITY, DEFAULT_CAPACITY),
conf.getEnum(CONFIG_PROPERTY_STATE, DEFAULT_STATE));
this.volume = new SimulatedVolume(this.storage);
+ this.datasetLock = new AutoCloseableLock();
}
public synchronized void injectBlocks(String bpid,
@@ -1366,5 +1371,9 @@ public class SimulatedFSDataset implements FsDatasetSpi<FsVolumeSpi> {
return null;
}
+ @Override
+ public AutoCloseableLock acquireDatasetLock() {
+ return datasetLock.acquire();
+ }
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/8c063847/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockRecovery.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockRecovery.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockRecovery.java
index 42e80fa..8183de8 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockRecovery.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockRecovery.java
@@ -66,6 +66,7 @@ import org.apache.hadoop.hdfs.DistributedFileSystem;
import org.apache.hadoop.hdfs.HdfsConfiguration;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.hadoop.hdfs.StripedFileTestUtil;
+import org.apache.hadoop.util.AutoCloseableLock;
import org.apache.hadoop.hdfs.protocol.DatanodeID;
import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
import org.apache.hadoop.hdfs.protocol.ErasureCodingPolicy;
@@ -725,7 +726,7 @@ public class TestBlockRecovery {
final RecoveringBlock recoveringBlock = new RecoveringBlock(
block.getBlock(), locations, block.getBlock()
.getGenerationStamp() + 1);
- synchronized (dataNode.data) {
+ try(AutoCloseableLock lock = dataNode.data.acquireDatasetLock()) {
Thread.sleep(2000);
dataNode.initReplicaRecovery(recoveringBlock);
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/8c063847/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDirectoryScanner.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDirectoryScanner.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDirectoryScanner.java
index 48d4681..3822bad 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDirectoryScanner.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDirectoryScanner.java
@@ -52,6 +52,7 @@ import org.apache.hadoop.hdfs.DFSClient;
import org.apache.hadoop.hdfs.DFSTestUtil;
import org.apache.hadoop.hdfs.HdfsConfiguration;
import org.apache.hadoop.hdfs.MiniDFSCluster;
+import org.apache.hadoop.util.AutoCloseableLock;
import org.apache.hadoop.hdfs.protocol.Block;
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
import org.apache.hadoop.hdfs.protocol.LocatedBlock;
@@ -113,7 +114,7 @@ public class TestDirectoryScanner {
/** Truncate a block file */
private long truncateBlockFile() throws IOException {
- synchronized (fds) {
+ try(AutoCloseableLock lock = fds.acquireDatasetLock()) {
for (ReplicaInfo b : FsDatasetTestUtil.getReplicas(fds, bpid)) {
File f = b.getBlockFile();
File mf = b.getMetaFile();
@@ -138,7 +139,7 @@ public class TestDirectoryScanner {
/** Delete a block file */
private long deleteBlockFile() {
- synchronized(fds) {
+ try(AutoCloseableLock lock = fds.acquireDatasetLock()) {
for (ReplicaInfo b : FsDatasetTestUtil.getReplicas(fds, bpid)) {
File f = b.getBlockFile();
File mf = b.getMetaFile();
@@ -154,7 +155,7 @@ public class TestDirectoryScanner {
/** Delete block meta file */
private long deleteMetaFile() {
- synchronized(fds) {
+ try(AutoCloseableLock lock = fds.acquireDatasetLock()) {
for (ReplicaInfo b : FsDatasetTestUtil.getReplicas(fds, bpid)) {
File file = b.getMetaFile();
// Delete a metadata file
@@ -173,7 +174,7 @@ public class TestDirectoryScanner {
* @throws IOException
*/
private void duplicateBlock(long blockId) throws IOException {
- synchronized (fds) {
+ try(AutoCloseableLock lock = fds.acquireDatasetLock()) {
ReplicaInfo b = FsDatasetTestUtil.fetchReplicaInfo(fds, bpid, blockId);
try (FsDatasetSpi.FsVolumeReferences volumes =
fds.getFsVolumeReferences()) {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/8c063847/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/extdataset/ExternalDatasetImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/extdataset/ExternalDatasetImpl.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/extdataset/ExternalDatasetImpl.java
index 8518ddd..b8564bb 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/extdataset/ExternalDatasetImpl.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/extdataset/ExternalDatasetImpl.java
@@ -23,6 +23,7 @@ import java.util.*;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.StorageType;
+import org.apache.hadoop.util.AutoCloseableLock;
import org.apache.hadoop.hdfs.protocol.Block;
import org.apache.hadoop.hdfs.protocol.BlockListAsLongs;
import org.apache.hadoop.hdfs.protocol.BlockLocalPathInfo;
@@ -450,4 +451,8 @@ public class ExternalDatasetImpl implements FsDatasetSpi<ExternalVolumeImpl> {
return null;
}
+ @Override
+ public AutoCloseableLock acquireDatasetLock() {
+ return null;
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[43/50] [abbrv] hadoop git commit: YARN-4514. [YARN-3368] Cleanup
hardcoded configurations, such as RM/ATS addresses. (Sunil G via wangda)
Posted by wa...@apache.org.
YARN-4514. [YARN-3368] Cleanup hardcoded configurations, such as RM/ATS addresses. (Sunil G via wangda)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/221edaf4
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/221edaf4
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/221edaf4
Branch: refs/heads/YARN-3368
Commit: 221edaf40c582cb2b3d5f4ed7faa74fdf069c2d0
Parents: d13f52f
Author: Wangda Tan <wa...@apache.org>
Authored: Sat Apr 16 23:04:45 2016 -0700
Committer: Wangda Tan <wa...@apache.org>
Committed: Tue Aug 9 14:48:09 2016 -0700
----------------------------------------------------------------------
.../src/main/webapp/app/adapters/abstract.js | 48 +++++++++++++
.../main/webapp/app/adapters/cluster-info.js | 22 ++----
.../main/webapp/app/adapters/cluster-metric.js | 22 ++----
.../webapp/app/adapters/yarn-app-attempt.js | 24 ++-----
.../src/main/webapp/app/adapters/yarn-app.js | 27 ++-----
.../webapp/app/adapters/yarn-container-log.js | 10 ++-
.../main/webapp/app/adapters/yarn-container.js | 20 +++---
.../main/webapp/app/adapters/yarn-node-app.js | 24 +++----
.../webapp/app/adapters/yarn-node-container.js | 24 +++----
.../src/main/webapp/app/adapters/yarn-node.js | 23 +++---
.../src/main/webapp/app/adapters/yarn-queue.js | 22 ++----
.../main/webapp/app/adapters/yarn-rm-node.js | 21 ++----
.../hadoop-yarn-ui/src/main/webapp/app/app.js | 4 +-
.../src/main/webapp/app/config.js | 5 +-
.../src/main/webapp/app/index.html | 1 +
.../src/main/webapp/app/initializers/env.js | 29 ++++++++
.../src/main/webapp/app/initializers/hosts.js | 28 ++++++++
.../src/main/webapp/app/services/env.js | 59 ++++++++++++++++
.../src/main/webapp/app/services/hosts.js | 74 ++++++++++++++++++++
.../hadoop-yarn-ui/src/main/webapp/bower.json | 25 +++----
.../src/main/webapp/config/configs.env | 48 +++++++++++++
.../src/main/webapp/config/default-config.js | 32 +++++++++
.../src/main/webapp/config/environment.js | 11 ++-
.../src/main/webapp/ember-cli-build.js | 10 ++-
.../hadoop-yarn-ui/src/main/webapp/package.json | 35 ++++-----
.../webapp/tests/unit/initializers/env-test.js | 41 +++++++++++
.../tests/unit/initializers/hosts-test.js | 41 +++++++++++
.../tests/unit/initializers/jquery-test.js | 41 +++++++++++
.../main/webapp/tests/unit/services/env-test.js | 30 ++++++++
.../webapp/tests/unit/services/hosts-test.js | 30 ++++++++
30 files changed, 637 insertions(+), 194 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/abstract.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/abstract.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/abstract.js
new file mode 100644
index 0000000..c7e5c36
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/abstract.js
@@ -0,0 +1,48 @@
+/**
+ * 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.
+ */
+import Ember from 'ember';
+
+export default DS.JSONAPIAdapter.extend({
+ address: null, //Must be set by inheriting classes
+ restNameSpace: null, //Must be set by inheriting classes
+ serverName: null, //Must be set by inheriting classes
+
+ headers: {
+ Accept: 'application/json'
+ },
+
+ host: Ember.computed("address", function () {
+ var address = this.get("address");
+ return this.get(`hosts.${address}`);
+ }),
+
+ namespace: Ember.computed("restNameSpace", function () {
+ var serverName = this.get("restNameSpace");
+ return this.get(`env.app.namespaces.${serverName}`);
+ }),
+
+ ajax: function(url, method, options) {
+ options = options || {};
+ options.crossDomain = true;
+ options.xhrFields = {
+ withCredentials: true
+ };
+ options.targetServer = this.get('serverName');
+ return this._super(url, method, options);
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-info.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-info.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-info.js
index 7dcbe61..f79df92 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-info.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-info.js
@@ -16,23 +16,15 @@
* limitations under the License.
*/
-import DS from 'ember-data';
-import Config from 'yarn-ui/config';
+import AbstractAdapter from './abstract';
-export default DS.JSONAPIAdapter.extend({
- headers: {
- Accept: 'application/json'
- },
- host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
- namespace: 'ws/v1/cluster', // common const
+export default AbstractAdapter.extend({
+ address: "rmWebAddress",
+ restNameSpace: "cluster",
+ serverName: "RM",
+
+ // Any cluster-info specific adapter changes must be added here
pathForType(modelName) {
return ''; // move to some common place, return path by modelname.
},
- ajax(url, method, hash) {
- hash = hash || {};
- hash.crossDomain = true;
- hash.xhrFields = {withCredentials: true};
- hash.targetServer = "RM";
- return this._super(url, method, hash);
- }
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-metric.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-metric.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-metric.js
index ad5ae0e..8325a4c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-metric.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-metric.js
@@ -16,23 +16,15 @@
* limitations under the License.
*/
-import DS from 'ember-data';
-import Config from 'yarn-ui/config';
+import AbstractAdapter from './abstract';
-export default DS.JSONAPIAdapter.extend({
- headers: {
- Accept: 'application/json'
- },
- host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
- namespace: 'ws/v1/cluster/metrics', // common const
+export default AbstractAdapter.extend({
+ address: "rmWebAddress",
+ restNameSpace: "metrics",
+ serverName: "RM",
+
+ // Any cluster-metric specific adapter changes must be added here
pathForType(modelName) {
return ''; // move to some common place, return path by modelname.
},
- ajax(url, method, hash) {
- hash = hash || {};
- hash.crossDomain = true;
- hash.xhrFields = {withCredentials: true};
- hash.targetServer = "RM";
- return this._super(url, method, hash);
- }
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app-attempt.js
index 7b233bc..d10ba45 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app-attempt.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app-attempt.js
@@ -16,16 +16,13 @@
* limitations under the License.
*/
-import DS from 'ember-data';
+import AbstractAdapter from './abstract';
import Converter from 'yarn-ui/utils/converter';
-import Config from 'yarn-ui/config';
-export default DS.JSONAPIAdapter.extend({
- headers: {
- Accept: 'application/json'
- },
- host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
- namespace: 'ws/v1/cluster', // common const
+export default AbstractAdapter.extend({
+ address: "rmWebAddress",
+ restNameSpace: "cluster",
+ serverName: "RM",
urlForQuery(query, modelName) {
var url = this._buildURL();
@@ -36,15 +33,8 @@ export default DS.JSONAPIAdapter.extend({
var url = this._buildURL();
var url = url + '/apps/' +
Converter.attemptIdToAppId(id) + "/appattempts/" + id;
- console.log(url);
+ console.log('app-attempt url:',url);
return url;
- },
-
- ajax(url, method, hash) {
- hash = {};
- hash.crossDomain = true;
- hash.xhrFields = {withCredentials: true};
- hash.targetServer = "RM";
- return this._super(url, method, hash);
}
+
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app.js
index 5cd888c..afd93f4 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app.js
@@ -16,29 +16,14 @@
* limitations under the License.
*/
-import DS from 'ember-data';
-import Config from 'yarn-ui/config';
+import AbstractAdapter from './abstract';
+
+export default AbstractAdapter.extend({
+ address: "rmWebAddress",
+ restNameSpace: "cluster",
+ serverName: "RM",
-export default DS.JSONAPIAdapter.extend({
- headers: {
- Accept: 'application/json'
- },
- host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
- namespace: 'ws/v1/cluster', // common const
pathForType(modelName) {
return 'apps'; // move to some common place, return path by modelname.
},
- /*
- urlForQuery(query, modelName) {
- var url = this._buildURL();
- return url + '/apps/' + query.appId + "/appattempts";
- },
- */
- ajax(url, method, hash) {
- hash = hash || {};
- hash.crossDomain = true;
- hash.xhrFields = {withCredentials: true};
- hash.targetServer = "RM";
- return this._super(url, method, hash);
- }
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container-log.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container-log.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container-log.js
index 7838c98..39c3c87 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container-log.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container-log.js
@@ -28,8 +28,14 @@ export default DS.RESTAdapter.extend({
headers: {
Accept: 'text/plain'
},
- host: 'http://localhost:1337/',
- namespace: 'ws/v1/node',
+
+ host: Ember.computed("address", function () {
+ return this.get(`hosts.localBaseAddress`);
+ }),
+
+ namespace: Ember.computed("restNameSpace", function () {
+ return this.get(`env.app.namespaces.node`);
+ }),
urlForFindRecord(id, modelName, snapshot) {
var splits = Converter.splitForContainerLogs(id);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container.js
index 67a37f7..fd6a6f8 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container.js
@@ -18,30 +18,32 @@
import DS from 'ember-data';
import Converter from 'yarn-ui/utils/converter';
-import Config from 'yarn-ui/config';
export default DS.JSONAPIAdapter.extend({
headers: {
Accept: 'application/json'
},
- rmHost: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT,
- tsHost: 'http://localhost:1337/' + Config.TS_HOST + ':' + Config.TS_PORT,
+
host: function() {
return undefined
}.property(),
- rmNamespace: 'ws/v1/cluster',
- tsNamespace: 'ws/v1/applicationhistory',
+
namespace: function() {
return undefined
}.property(),
urlForQuery(query, modelName) {
+ var rmHosts = this.get(`hosts.rmWebAddress`);
+ var tsHosts = this.get(`hosts.timelineWebAddress`);
+ var rmNamespaces = this.get(`env.app.namespaces.cluster`);
+ var tsNamespaces = this.get(`env.app.namespaces.timeline`);
+
if (query.is_rm) {
- this.set("host", this.rmHost);
- this.set("namespace", this.rmNamespace);
+ this.set("host", rmHosts);
+ this.set("namespace", rmNamespaces);
} else {
- this.set("host", this.tsHost);
- this.set("namespace", this.tsNamespace);
+ this.set("host", tsHosts);
+ this.set("namespace", tsNamespaces);
}
var url = this._buildURL();
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-app.js
index 0c60d1f..fd6c021 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-app.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-app.js
@@ -16,24 +16,23 @@
* limitations under the License.
*/
-import DS from 'ember-data';
+import AbstractAdapter from './abstract';
-export default DS.JSONAPIAdapter.extend({
- headers: {
- Accept: 'application/json'
- },
- host: 'http://localhost:1337/',
- namespace: 'ws/v1/node',
+export default AbstractAdapter.extend({
+
+ address: "localBaseAddress",
+ restNameSpace: "node",
+ serverName: "NM",
urlForQuery(query) {
- this.host = this.host + query.nodeAddr;
+ this.host = this.get("host") + query.nodeAddr;
var url = this._buildURL();
url = url + "/apps";
return url;
},
urlForQueryRecord: function (query) {
- this.host = this.host + query.nodeAddr;
+ this.host = this.get("host") + query.nodeAddr;
var url = this._buildURL();
url = url + "/apps/" + query.appId;
return url;
@@ -53,11 +52,4 @@ export default DS.JSONAPIAdapter.extend({
return this.ajax(url, 'GET', { data: query });
},
- ajax(url, method, hash) {
- hash = hash || {};
- hash.crossDomain = true;
- hash.xhrFields = {withCredentials: true};
- hash.targetServer = "NM";
- return this._super(url, method, hash);
- }
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-container.js
index e8bf7b7..caf1e3f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-container.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-container.js
@@ -16,24 +16,23 @@
* limitations under the License.
*/
-import DS from 'ember-data';
+import AbstractAdapter from './abstract';
-export default DS.JSONAPIAdapter.extend({
- headers: {
- Accept: 'application/json'
- },
- host: 'http://localhost:1337/',
- namespace: 'ws/v1/node',
+export default AbstractAdapter.extend({
+
+ address: "localBaseAddress",
+ restNameSpace: "node",
+ serverName: "NM",
urlForQuery(query) {
- this.host = this.host + query.nodeHttpAddr;
+ this.host = this.get("host") + query.nodeHttpAddr;
var url = this._buildURL();
url = url + "/containers";
return url;
},
urlForQueryRecord(query) {
- this.host = this.host + query.nodeHttpAddr;
+ this.host = this.get("host") + query.nodeHttpAddr;
var url = this._buildURL();
url = url + "/containers/" + query.containerId;
return url;
@@ -54,11 +53,4 @@ export default DS.JSONAPIAdapter.extend({
return this.ajax(url, 'GET', { data: query });
},
- ajax(url, method, hash) {
- hash = hash || {};
- hash.crossDomain = true;
- hash.xhrFields = {withCredentials: true};
- hash.targetServer = "NM";
- return this._super(url, method, hash);
- }
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node.js
index 64f524a..c9f36c3 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node.js
@@ -16,25 +16,18 @@
* limitations under the License.
*/
-import DS from 'ember-data';
+import AbstractAdapter from './abstract';
-export default DS.JSONAPIAdapter.extend({
- headers: {
- Accept: 'application/json'
- },
- host: 'http://localhost:1337/',
- namespace: 'ws/v1/node',
+export default AbstractAdapter.extend({
+
+ address: "localBaseAddress",
+ restNameSpace: "node",
+ serverName: "NM",
urlForFindRecord(id, modelName, snapshot) {
- this.host = this.host + id;
+ this.host = this.get("host") + id;
var url = this._buildURL();
return url;
},
- ajax(url, method, hash) {
- hash = hash || {};
- hash.crossDomain = true;
- hash.xhrFields = {withCredentials: true};
- hash.targetServer = "NM";
- return this._super(url, method, hash);
- }
+
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-queue.js
index ebe7b39..41cd442 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-queue.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-queue.js
@@ -16,23 +16,15 @@
* limitations under the License.
*/
-import DS from 'ember-data';
-import Config from 'yarn-ui/config';
+import AbstractAdapter from './abstract';
+
+export default AbstractAdapter.extend({
+ address: "rmWebAddress",
+ restNameSpace: "cluster",
+ serverName: "RM",
-export default DS.JSONAPIAdapter.extend({
- headers: {
- Accept: 'application/json'
- },
- host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
- namespace: 'ws/v1/cluster', // common const
pathForType(modelName) {
return 'scheduler'; // move to some common place, return path by modelname.
},
- ajax(url, method, hash) {
- hash = hash || {};
- hash.crossDomain = true;
- hash.xhrFields = {withCredentials: true};
- hash.targetServer = "RM";
- return this._super(url, method, hash);
- }
+
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-rm-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-rm-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-rm-node.js
index c6ad6f3..a24c399 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-rm-node.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-rm-node.js
@@ -16,15 +16,13 @@
* limitations under the License.
*/
-import DS from 'ember-data';
-import Config from 'yarn-ui/config';
+import AbstractAdapter from './abstract';
+
+export default AbstractAdapter.extend({
+ address: "rmWebAddress",
+ restNameSpace: "cluster",
+ serverName: "RM",
-export default DS.JSONAPIAdapter.extend({
- headers: {
- Accept: 'application/json'
- },
- host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT,
- namespace: 'ws/v1/cluster',
pathForType(modelName) {
return 'nodes';
},
@@ -35,11 +33,4 @@ export default DS.JSONAPIAdapter.extend({
return url;
},
- ajax(url, method, hash) {
- hash = hash || {};
- hash.crossDomain = true;
- hash.xhrFields = {withCredentials: true};
- hash.targetServer = "RM";
- return this._super(url, method, hash);
- }
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/app.js
index 5617953..8c1025a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/app.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/app.js
@@ -17,7 +17,7 @@
*/
import Ember from 'ember';
-import Resolver from 'ember/resolver';
+import Resolver from 'ember-resolver';
import loadInitializers from 'ember/load-initializers';
import config from './config/environment';
import Sorter from 'yarn-ui/utils/sorter';
@@ -29,7 +29,7 @@ Ember.MODEL_FACTORY_INJECTIONS = true;
App = Ember.Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
- Resolver: Resolver
+ Resolver
});
loadInitializers(App, config.modulePrefix);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/config.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/config.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/config.js
index 224c65a..157d48b 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/config.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/config.js
@@ -19,9 +19,6 @@
/**
* Host and port configurations
*/
+
export default {
- RM_HOST: 'localhost',
- RM_PORT: '8088',
- TS_HOST: 'localhost',
- TS_PORT: '8188',
};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/index.html
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/index.html b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/index.html
index 969ea2f..f727454 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/index.html
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/index.html
@@ -34,6 +34,7 @@
</head>
<body>
{{content-for 'body'}}
+ <script src="config/configs.env" integrity=""></script>
<script src="assets/vendor.js"></script>
<script src="assets/yarn-ui.js"></script>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/env.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/env.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/env.js
new file mode 100644
index 0000000..c613593
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/env.js
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+
+export function initialize( application ) {
+ application.inject('controller', 'env', 'service:env');
+ application.inject('route', 'env', 'service:env');
+ application.inject('adapter', 'env', 'service:env');
+}
+
+export default {
+ name: 'env',
+ initialize
+};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/hosts.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/hosts.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/hosts.js
new file mode 100644
index 0000000..6e3aa96
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/hosts.js
@@ -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.
+ */
+
+export function initialize( application ) {
+ application.inject('controller', 'hosts', 'service:hosts');
+ application.inject('route', 'hosts', 'service:hosts');
+ application.inject('adapter', 'hosts', 'service:hosts');
+}
+
+export default {
+ name: 'hosts',
+ initialize
+};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/services/env.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/services/env.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/services/env.js
new file mode 100644
index 0000000..208499c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/services/env.js
@@ -0,0 +1,59 @@
+/*global more*/
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+import environment from '../config/environment';
+
+var MoreObject = more.Object;
+
+export default Ember.Service.extend({
+ ENV: null,
+
+ init: function () {
+ this.collateConfigs();
+ },
+
+ collateConfigs: function () {
+ var collatedENV = {
+ APP: {}
+ },
+ ENV = window.ENV;
+
+ MoreObject.merge(collatedENV, environment);
+
+ if(ENV) {
+ MoreObject.merge(collatedENV.APP, ENV);
+ }
+
+ this.setComputedENVs(collatedENV);
+
+ this.set("ENV", collatedENV);
+ },
+
+ setComputedENVs: function (env) {
+ var navigator = window.navigator;
+ env.isIE = navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0;
+ console.log('In setComputedENVs', env.isIE);
+ },
+
+ app: Ember.computed("ENV.APP", function () {
+ return this.get("ENV.APP");
+ })
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/services/hosts.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/services/hosts.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/services/hosts.js
new file mode 100644
index 0000000..19863e1
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/services/hosts.js
@@ -0,0 +1,74 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Service.extend({
+
+ env: Ember.inject.service("env"),
+
+ attachProtocolScheme: function (url) {
+ var localProto = this.get("env.app.hosts.protocolScheme");
+
+ if(localProto === "") {
+ localProto = "http:";
+ }
+
+ if(url.match("://")) {
+ url = url.substr(url.indexOf("://") + 3);
+ }
+
+ return localProto + "//" + url;
+ },
+
+ normalizeURL: function (url) {
+ var address;
+
+ // If localBaseAddress is configured, then normalized URL has to
+ // start with this address. For eg: when used with CORS proxy.
+ // In any case, this fn will return with correct proto scheme.
+ address = this.localAddress() + url;
+
+ // Remove trailing slash
+ if(address && address.charAt(address.length - 1) === '/') {
+ address = address.slice(0, -1);
+ }
+ return address;
+ },
+
+ localAddress: function () {
+ var localBaseAddressProto = "";
+
+ if (this.get("env.app.hosts.localBaseAddress").length > 0) {
+ localBaseAddressProto = this.get("env.app.hosts.localBaseAddress") + '/';
+ }
+ return this.attachProtocolScheme(localBaseAddressProto);
+ },
+
+ localBaseAddress: Ember.computed(function () {
+ return this.localAddress();
+ }),
+
+ timelineWebAddress: Ember.computed(function () {
+ return this.normalizeURL(this.get("env.app.hosts.timelineWebAddress"));
+ }),
+
+ rmWebAddress: Ember.computed(function () {
+ return this.normalizeURL(this.get("env.app.hosts.rmWebAddress"));
+ }),
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower.json
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower.json
index de66650..b23dbbc 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower.json
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower.json
@@ -1,18 +1,19 @@
{
"name": "yarn-ui",
"dependencies": {
- "ember": "2.0.1",
- "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.4",
- "ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
- "ember-data": "2.0.0",
- "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.6",
- "ember-qunit": "0.4.9",
- "ember-qunit-notifications": "0.0.7",
- "ember-resolver": "~0.1.18",
- "jquery": "1.11.3",
- "loader.js": "ember-cli/loader.js#3.2.1",
- "qunit": "~1.18.0",
- "bootstrap": "~3.3.2",
+ "ember": "2.2.0",
+ "ember-cli-shims": "0.0.6",
+ "ember-cli-test-loader": "0.2.1",
+ "ember-data": "2.1.0",
+ "ember-load-initializers": "0.1.7",
+ "ember-qunit": "0.4.16",
+ "ember-qunit-notifications": "0.1.0",
+ "jquery": "2.1.4",
+ "loader.js": "3.3.0",
+ "qunit": "1.19.0",
+ "jquery-ui": "1.11.4",
+ "more-js": "0.8.2",
+ "bootstrap": "3.3.6",
"d3": "~3.5.6",
"datatables": "~1.10.8",
"spin.js": "~2.3.2",
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/configs.env
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/configs.env b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/configs.env
new file mode 100644
index 0000000..04577c9
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/configs.env
@@ -0,0 +1,48 @@
+/**
+ * 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.
+ */
+
+ENV = {
+ hosts: {
+ /*
+ * Local URL. This is empty by default. In case when ResourceManager
+ * and Timeline Server (ATS) are running on same node, cross domain
+ * requests has to be supported. In such cases, proxy URL can be configured
+ * here to handle requests (CORS). For eg:"localhost:1337"
+ */
+ //localBaseAddress: "localhost:1337",
+
+ /*
+ * Timeline web interface can be configured below.
+ * By default timeline server is set as localhost:8188, uncomment and change
+ * the following value for pointing to a different address.
+ */
+ //timelineWebAddress: "localhost:8188",
+
+ /*
+ * RM web interface can be configured below.
+ * By default RM web address is set as localhost:8088, uncomment and change
+ * the following value for pointing to a different address.
+ */
+ //rmWebAddress: "localhost:8088",
+
+ /*
+ * Protocol scheme. It can be "http:" or "https:". By default, http is used.
+ */
+ //protocolScheme: "http:"
+ },
+};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/default-config.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/default-config.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/default-config.js
new file mode 100644
index 0000000..92d0721
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/default-config.js
@@ -0,0 +1,32 @@
+/**
+ * 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.
+ */
+
+module.exports = { // Yarn UI App configurations
+ hosts: {
+ localBaseAddress: "localhost:1337",
+ timelineWebAddress: "localhost:8188",
+ rmWebAddress: "localhost:8088",
+ protocolScheme: "http:"
+ },
+ namespaces: {
+ timeline: 'ws/v1/applicationhistory',
+ cluster: 'ws/v1/cluster',
+ metrics: 'ws/v1/cluster/metrics',
+ node: 'ws/v1/node'
+ },
+};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/environment.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/environment.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/environment.js
index 9a14068..118e0ba 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/environment.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/environment.js
@@ -18,6 +18,8 @@
/* jshint node: true */
+const DEFAULT_CONFIG = require('./default-config');
+
module.exports = function(environment) {
var ENV = {
modulePrefix: 'yarn-ui',
@@ -31,9 +33,12 @@ module.exports = function(environment) {
}
},
- APP: {
- // Here you can pass flags/options to your application instance
- // when it is created
+ APP: DEFAULT_CONFIG,
+ contentSecurityPolicy: {
+ 'connect-src': "* 'self'",
+ 'child-src': "'self' 'unsafe-inline'",
+ 'style-src': "'self' 'unsafe-inline'",
+ 'script-src': "'self' 'unsafe-inline'"
}
};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js
index cf5ad83..bce18ce 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js
@@ -17,6 +17,7 @@
*/
/* global require, module */
+var Funnel = require("broccoli-funnel");
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function(defaults) {
@@ -29,6 +30,8 @@ module.exports = function(defaults) {
app.import("bower_components/momentjs/min/moment.min.js");
app.import("bower_components/select2/dist/css/select2.min.css");
app.import("bower_components/select2/dist/js/select2.min.js");
+ app.import('bower_components/jquery-ui/jquery-ui.js');
+ app.import('bower_components/more-js/dist/more.js');
// Use `app.import` to add additional libraries to the generated
// output files.
@@ -42,6 +45,11 @@ module.exports = function(defaults) {
// modules that you would like to import into your application
// please specify an object with the list of modules as keys
// along with the exports of each module as its value.
+ var extraAssets = new Funnel('config', {
+ srcDir: '/',
+ include: ['*.env'],
+ destDir: '/config'
+ });
- return app.toTree();
+ return app.toTree(extraAssets);
};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json
index b52ac1d..40febda 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json
@@ -19,25 +19,28 @@
"author": "",
"license": "Apache",
"devDependencies": {
- "broccoli-asset-rev": "^2.1.2",
- "ember-bootstrap": "0.2.0",
- "ember-cli": "1.13.8",
- "ember-cli-app-version": "0.5.0",
- "ember-cli-babel": "^5.1.3",
+ "broccoli-asset-rev": "2.4.2",
+ "broccoli-funnel": "1.0.1",
+ "ember-bootstrap": "0.5.1",
+ "ember-cli": "1.13.13",
+ "ember-cli-app-version": "1.0.0",
+ "ember-cli-babel": "5.1.6",
"ember-cli-content-security-policy": "0.4.0",
- "ember-cli-dependency-checker": "^1.0.1",
- "ember-cli-htmlbars": "0.7.9",
- "ember-cli-htmlbars-inline-precompile": "^0.2.0",
+ "ember-cli-dependency-checker": "1.2.0",
+ "ember-cli-htmlbars": "1.0.2",
+ "ember-cli-htmlbars-inline-precompile": "0.3.1",
"ember-cli-ic-ajax": "0.2.1",
- "ember-cli-inject-live-reload": "^1.3.1",
- "ember-cli-qunit": "^1.0.0",
- "ember-cli-release": "0.2.3",
- "ember-cli-sri": "^1.0.3",
- "ember-cli-uglify": "^1.2.0",
+ "ember-cli-inject-live-reload": "1.4.0",
+ "ember-cli-jquery-ui": "0.0.20",
+ "ember-cli-qunit": "1.2.1",
+ "ember-cli-release": "0.2.8",
+ "ember-cli-sri": "1.2.1",
+ "ember-cli-uglify": "1.2.0",
"ember-d3": "0.1.0",
- "ember-data": "1.13.8",
- "ember-disable-proxy-controllers": "^1.0.0",
- "ember-export-application-global": "^1.0.3",
+ "ember-data": "2.1.0",
+ "ember-disable-proxy-controllers": "1.0.1",
+ "ember-export-application-global": "1.0.5",
+ "ember-resolver": "2.0.3",
"ember-spin-spinner": "0.2.3",
"select2": "4.0.0"
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/env-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/env-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/env-test.js
new file mode 100644
index 0000000..d6dacfd
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/env-test.js
@@ -0,0 +1,41 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import { initialize } from '../../../initializers/env';
+import { module, test } from 'qunit';
+
+var registry, application;
+
+module('Unit | Initializer | env', {
+ beforeEach: function() {
+ Ember.run(function() {
+ application = Ember.Application.create();
+ registry = application.registry;
+ application.deferReadiness();
+ });
+ }
+});
+
+// Replace this with your real tests.
+test('it works', function(assert) {
+ initialize(registry, application);
+
+ // you would normally confirm the results of the initializer here
+ assert.ok(true);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/hosts-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/hosts-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/hosts-test.js
new file mode 100644
index 0000000..b9a6b27
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/hosts-test.js
@@ -0,0 +1,41 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import { initialize } from '../../../initializers/hosts';
+import { module, test } from 'qunit';
+
+var registry, application;
+
+module('Unit | Initializer | hosts', {
+ beforeEach: function() {
+ Ember.run(function() {
+ application = Ember.Application.create();
+ registry = application.registry;
+ application.deferReadiness();
+ });
+ }
+});
+
+// Replace this with your real tests.
+test('it works', function(assert) {
+ initialize(registry, application);
+
+ // you would normally confirm the results of the initializer here
+ assert.ok(true);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/jquery-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/jquery-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/jquery-test.js
new file mode 100644
index 0000000..c7a9803
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/jquery-test.js
@@ -0,0 +1,41 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import { initialize } from '../../../initializers/jquery';
+import { module, test } from 'qunit';
+
+var registry, application;
+
+module('Unit | Initializer | jquery', {
+ beforeEach: function() {
+ Ember.run(function() {
+ application = Ember.Application.create();
+ registry = application.registry;
+ application.deferReadiness();
+ });
+ }
+});
+
+// Replace this with your real tests.
+test('it works', function(assert) {
+ initialize(registry, application);
+
+ // you would normally confirm the results of the initializer here
+ assert.ok(true);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/services/env-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/services/env-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/services/env-test.js
new file mode 100644
index 0000000..9eb9367
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/services/env-test.js
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('service:env', 'Unit | Service | env', {
+ // Specify the other units that are required for this test.
+ // needs: ['service:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ var service = this.subject();
+ assert.ok(service);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/221edaf4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/services/hosts-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/services/hosts-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/services/hosts-test.js
new file mode 100644
index 0000000..015748a
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/services/hosts-test.js
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('service:hosts', 'Unit | Service | hosts', {
+ // Specify the other units that are required for this test.
+ // needs: ['service:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ var service = this.subject();
+ assert.ok(service);
+});
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[16/50] [abbrv] hadoop git commit: HADOOP-13395. Enhance
TestKMSAudit. Contributed by Xiao Chen.
Posted by wa...@apache.org.
HADOOP-13395. Enhance TestKMSAudit. Contributed by Xiao Chen.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/07054894
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/07054894
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/07054894
Branch: refs/heads/YARN-3368
Commit: 070548943a16370a74277d1b1d10b713e2ca81d0
Parents: 6418edd
Author: Wei-Chiu Chuang <we...@apache.org>
Authored: Mon Aug 8 15:10:26 2016 -0700
Committer: Wei-Chiu Chuang <we...@apache.org>
Committed: Mon Aug 8 15:11:05 2016 -0700
----------------------------------------------------------------------
.../hadoop/crypto/key/kms/server/KMSAudit.java | 6 +++
.../crypto/key/kms/server/TestKMSAudit.java | 53 +++++++++++++++++---
2 files changed, 51 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/07054894/hadoop-common-project/hadoop-kms/src/main/java/org/apache/hadoop/crypto/key/kms/server/KMSAudit.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-kms/src/main/java/org/apache/hadoop/crypto/key/kms/server/KMSAudit.java b/hadoop-common-project/hadoop-kms/src/main/java/org/apache/hadoop/crypto/key/kms/server/KMSAudit.java
index 7ff76e5..6a401e0 100644
--- a/hadoop-common-project/hadoop-kms/src/main/java/org/apache/hadoop/crypto/key/kms/server/KMSAudit.java
+++ b/hadoop-common-project/hadoop-kms/src/main/java/org/apache/hadoop/crypto/key/kms/server/KMSAudit.java
@@ -17,6 +17,7 @@
*/
package org.apache.hadoop.crypto.key.kms.server;
+import com.google.common.annotations.VisibleForTesting;
import org.apache.hadoop.security.UserGroupInformation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -227,4 +228,9 @@ public class KMSAudit {
public void shutdown() {
executor.shutdownNow();
}
+
+ @VisibleForTesting
+ void evictCacheForTesting() {
+ cache.invalidateAll();
+ }
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/07054894/hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/TestKMSAudit.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/TestKMSAudit.java b/hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/TestKMSAudit.java
index 7e1c0d7..53948ee 100644
--- a/hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/TestKMSAudit.java
+++ b/hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/TestKMSAudit.java
@@ -33,7 +33,9 @@ import org.apache.log4j.PropertyConfigurator;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.Timeout;
import org.mockito.Mockito;
public class TestKMSAudit {
@@ -55,6 +57,9 @@ public class TestKMSAudit {
}
}
+ @Rule
+ public final Timeout testTimeout = new Timeout(180000);
+
@Before
public void setUp() throws IOException {
originalOut = System.err;
@@ -67,7 +72,8 @@ public class TestKMSAudit {
PropertyConfigurator.configure(is);
IOUtils.closeStream(is);
- this.kmsAudit = new KMSAudit(1000);
+ this.kmsAudit =
+ new KMSAudit(KMSConfiguration.KMS_AUDIT_AGGREGATION_WINDOW_DEFAULT);
}
@After
@@ -97,9 +103,9 @@ public class TestKMSAudit {
kmsAudit.ok(luser, KMSOp.DECRYPT_EEK, "k1", "testmsg");
kmsAudit.ok(luser, KMSOp.DECRYPT_EEK, "k1", "testmsg");
kmsAudit.ok(luser, KMSOp.DECRYPT_EEK, "k1", "testmsg");
- Thread.sleep(1500);
+ kmsAudit.evictCacheForTesting();
kmsAudit.ok(luser, KMSOp.DECRYPT_EEK, "k1", "testmsg");
- Thread.sleep(1500);
+ kmsAudit.evictCacheForTesting();
String out = getAndResetLogOutput();
System.out.println(out);
Assert.assertTrue(
@@ -118,24 +124,55 @@ public class TestKMSAudit {
UserGroupInformation luser = Mockito.mock(UserGroupInformation.class);
Mockito.when(luser.getShortUserName()).thenReturn("luser");
kmsAudit.unauthorized(luser, KMSOp.GENERATE_EEK, "k2");
- Thread.sleep(1000);
+ kmsAudit.evictCacheForTesting();
kmsAudit.ok(luser, KMSOp.GENERATE_EEK, "k3", "testmsg");
kmsAudit.ok(luser, KMSOp.GENERATE_EEK, "k3", "testmsg");
kmsAudit.ok(luser, KMSOp.GENERATE_EEK, "k3", "testmsg");
kmsAudit.ok(luser, KMSOp.GENERATE_EEK, "k3", "testmsg");
kmsAudit.ok(luser, KMSOp.GENERATE_EEK, "k3", "testmsg");
kmsAudit.unauthorized(luser, KMSOp.GENERATE_EEK, "k3");
+ // wait a bit so the UNAUTHORIZED-triggered cache invalidation happens.
+ Thread.sleep(1000);
kmsAudit.ok(luser, KMSOp.GENERATE_EEK, "k3", "testmsg");
- Thread.sleep(2000);
+ kmsAudit.evictCacheForTesting();
String out = getAndResetLogOutput();
System.out.println(out);
- Assert.assertTrue(
- out.matches(
- "UNAUTHORIZED\\[op=GENERATE_EEK, key=k2, user=luser\\] "
+
+ // The UNAUTHORIZED will trigger cache invalidation, which then triggers
+ // the aggregated OK (accessCount=5). But the order of the UNAUTHORIZED and
+ // the aggregated OK is arbitrary - no correctness concerns, but flaky here.
+ Assert.assertTrue(out.matches(
+ "UNAUTHORIZED\\[op=GENERATE_EEK, key=k2, user=luser\\] "
+ "OK\\[op=GENERATE_EEK, key=k3, user=luser, accessCount=1, interval=[^m]{1,4}ms\\] testmsg"
+ "OK\\[op=GENERATE_EEK, key=k3, user=luser, accessCount=5, interval=[^m]{1,4}ms\\] testmsg"
+ "UNAUTHORIZED\\[op=GENERATE_EEK, key=k3, user=luser\\] "
+ + "OK\\[op=GENERATE_EEK, key=k3, user=luser, accessCount=1, interval=[^m]{1,4}ms\\] testmsg")
+ || out.matches(
+ "UNAUTHORIZED\\[op=GENERATE_EEK, key=k2, user=luser\\] "
+ + "OK\\[op=GENERATE_EEK, key=k3, user=luser, accessCount=1, interval=[^m]{1,4}ms\\] testmsg"
+ + "UNAUTHORIZED\\[op=GENERATE_EEK, key=k3, user=luser\\] "
+ + "OK\\[op=GENERATE_EEK, key=k3, user=luser, accessCount=5, interval=[^m]{1,4}ms\\] testmsg"
+ "OK\\[op=GENERATE_EEK, key=k3, user=luser, accessCount=1, interval=[^m]{1,4}ms\\] testmsg"));
}
+ @Test
+ public void testAuditLogFormat() throws Exception {
+ UserGroupInformation luser = Mockito.mock(UserGroupInformation.class);
+ Mockito.when(luser.getShortUserName()).thenReturn("luser");
+ kmsAudit.ok(luser, KMSOp.GENERATE_EEK, "k4", "testmsg");
+ kmsAudit.ok(luser, KMSOp.GENERATE_EEK, "testmsg");
+ kmsAudit.evictCacheForTesting();
+ kmsAudit.unauthorized(luser, KMSOp.DECRYPT_EEK, "k4");
+ kmsAudit.error(luser, "method", "url", "testmsg");
+ kmsAudit.unauthenticated("remotehost", "method", "url", "testmsg");
+ String out = getAndResetLogOutput();
+ System.out.println(out);
+ Assert.assertTrue(out.matches(
+ "OK\\[op=GENERATE_EEK, key=k4, user=luser, accessCount=1, interval=[^m]{1,4}ms\\] testmsg"
+ + "OK\\[op=GENERATE_EEK, user=luser\\] testmsg"
+ + "OK\\[op=GENERATE_EEK, key=k4, user=luser, accessCount=1, interval=[^m]{1,4}ms\\] testmsg"
+ + "UNAUTHORIZED\\[op=DECRYPT_EEK, key=k4, user=luser\\] "
+ + "ERROR\\[user=luser\\] Method:'method' Exception:'testmsg'"
+ + "UNAUTHENTICATED RemoteHost:remotehost Method:method URL:url ErrorMsg:'testmsg'"));
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[27/50] [abbrv] hadoop git commit: HDFS-10738. Fix
TestRefreshUserMappings.testRefreshSuperUserGroupsConfiguration test failure.
Contributed by Rakesh R.
Posted by wa...@apache.org.
HDFS-10738. Fix TestRefreshUserMappings.testRefreshSuperUserGroupsConfiguration test failure. Contributed by Rakesh R.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/0f701f43
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/0f701f43
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/0f701f43
Branch: refs/heads/YARN-3368
Commit: 0f701f433dd3be233bf53e856864c82349e8274e
Parents: caf800d
Author: Kihwal Lee <ki...@apache.org>
Authored: Tue Aug 9 14:54:11 2016 -0500
Committer: Kihwal Lee <ki...@apache.org>
Committed: Tue Aug 9 14:54:11 2016 -0500
----------------------------------------------------------------------
.../security/TestRefreshUserMappings.java | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/0f701f43/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/security/TestRefreshUserMappings.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/security/TestRefreshUserMappings.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/security/TestRefreshUserMappings.java
index c76033c..ee20a95 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/security/TestRefreshUserMappings.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/security/TestRefreshUserMappings.java
@@ -151,9 +151,13 @@ public class TestRefreshUserMappings {
@Test
public void testRefreshSuperUserGroupsConfiguration() throws Exception {
final String SUPER_USER = "super_user";
- final String [] GROUP_NAMES1 = new String [] {"gr1" , "gr2"};
- final String [] GROUP_NAMES2 = new String [] {"gr3" , "gr4"};
-
+ final List<String> groupNames1 = new ArrayList<>();
+ groupNames1.add("gr1");
+ groupNames1.add("gr2");
+ final List<String> groupNames2 = new ArrayList<>();
+ groupNames2.add("gr3");
+ groupNames2.add("gr4");
+
//keys in conf
String userKeyGroups = DefaultImpersonationProvider.getTestProvider().
getProxySuperuserGroupConfKey(SUPER_USER);
@@ -178,12 +182,12 @@ public class TestRefreshUserMappings {
when(ugi1.getUserName()).thenReturn("userL1");
when(ugi2.getUserName()).thenReturn("userL2");
-
+
// set groups for users
- when(ugi1.getGroupNames()).thenReturn(GROUP_NAMES1);
- when(ugi2.getGroupNames()).thenReturn(GROUP_NAMES2);
-
-
+ when(ugi1.getGroups()).thenReturn(groupNames1);
+ when(ugi2.getGroups()).thenReturn(groupNames2);
+
+
// check before
try {
ProxyUsers.authorize(ugi1, "127.0.0.1");
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[09/50] [abbrv] hadoop git commit: YARN-4910. Fix incomplete log info
in ResourceLocalizationService (Jun Gong via Varun Saxena)
Posted by wa...@apache.org.
YARN-4910. Fix incomplete log info in ResourceLocalizationService (Jun Gong via Varun Saxena)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/37d939a4
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/37d939a4
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/37d939a4
Branch: refs/heads/YARN-3368
Commit: 37d939a453d1052878a2a1aab7588cbac48a824d
Parents: 6529fe9
Author: Varun Saxena <va...@apache.org>
Authored: Mon Aug 8 22:12:53 2016 +0530
Committer: Varun Saxena <va...@apache.org>
Committed: Mon Aug 8 22:12:53 2016 +0530
----------------------------------------------------------------------
.../containermanager/localizer/ResourceLocalizationService.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/37d939a4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ResourceLocalizationService.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ResourceLocalizationService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ResourceLocalizationService.java
index 409cc29..bdbc8e8 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ResourceLocalizationService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ResourceLocalizationService.java
@@ -1221,8 +1221,10 @@ public class ResourceLocalizationService extends CompositeService
tokenOut =
lfs.create(nmPrivateCTokensPath, EnumSet.of(CREATE, OVERWRITE));
LOG.info("Writing credentials to the nmPrivate file "
- + nmPrivateCTokensPath.toString() + ". Credentials list: ");
+ + nmPrivateCTokensPath.toString());
if (LOG.isDebugEnabled()) {
+ LOG.debug("Credentials list in " + nmPrivateCTokensPath.toString()
+ + ": ");
for (Token<? extends TokenIdentifier> tk : credentials
.getAllTokens()) {
LOG.debug(tk + " : " + buildTokenFingerprint(tk));
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[44/50] [abbrv] hadoop git commit: YARN-5019. [YARN-3368] Change urls
in new YARN ui from camel casing to hyphens. (Sunil G via wangda)
Posted by wa...@apache.org.
YARN-5019. [YARN-3368] Change urls in new YARN ui from camel casing to hyphens. (Sunil G via wangda)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/ce843274
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/ce843274
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/ce843274
Branch: refs/heads/YARN-3368
Commit: ce843274d1afad4c40f91831b0bc1cf0b06b2d9b
Parents: 221edaf
Author: Wangda Tan <wa...@apache.org>
Authored: Mon May 9 11:29:59 2016 -0700
Committer: Wangda Tan <wa...@apache.org>
Committed: Tue Aug 9 14:48:09 2016 -0700
----------------------------------------------------------------------
.../main/webapp/app/components/tree-selector.js | 4 +--
.../main/webapp/app/controllers/application.js | 16 +++++-----
.../main/webapp/app/helpers/log-files-comma.js | 2 +-
.../src/main/webapp/app/helpers/node-link.js | 2 +-
.../src/main/webapp/app/helpers/node-menu.js | 12 ++++----
.../main/webapp/app/models/yarn-app-attempt.js | 2 +-
.../src/main/webapp/app/router.js | 32 ++++++++++----------
.../src/main/webapp/app/routes/index.js | 2 +-
.../main/webapp/app/routes/yarn-app-attempt.js | 6 ++--
.../src/main/webapp/app/routes/yarn-app.js | 4 +--
.../src/main/webapp/app/routes/yarn-apps.js | 2 +-
.../webapp/app/routes/yarn-container-log.js | 2 +-
.../src/main/webapp/app/routes/yarn-node-app.js | 2 +-
.../main/webapp/app/routes/yarn-node-apps.js | 2 +-
.../webapp/app/routes/yarn-node-container.js | 2 +-
.../webapp/app/routes/yarn-node-containers.js | 2 +-
.../src/main/webapp/app/routes/yarn-node.js | 4 +--
.../src/main/webapp/app/routes/yarn-nodes.js | 2 +-
.../src/main/webapp/app/routes/yarn-queue.js | 6 ++--
.../main/webapp/app/routes/yarn-queues/index.js | 2 +-
.../app/routes/yarn-queues/queues-selector.js | 2 +-
.../app/templates/components/app-table.hbs | 4 +--
.../webapp/app/templates/yarn-container-log.hbs | 2 +-
.../main/webapp/app/templates/yarn-node-app.hbs | 4 +--
.../webapp/app/templates/yarn-node-apps.hbs | 4 +--
.../app/templates/yarn-node-container.hbs | 2 +-
.../app/templates/yarn-node-containers.hbs | 4 +--
.../src/main/webapp/app/templates/yarn-node.hbs | 2 +-
28 files changed, 66 insertions(+), 66 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
index f7ec020..698c253 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
@@ -126,7 +126,7 @@ export default Ember.Component.extend({
.attr("transform", function(d) { return "translate(" + source.y0 + "," + source.x0 + ")"; })
.on("click", function(d,i){
if (d.queueData.get("name") != this.get("selected")) {
- document.location.href = "yarnQueue/" + d.queueData.get("name");
+ document.location.href = "yarn-queue/" + d.queueData.get("name");
}
}.bind(this));
// .on("click", click);
@@ -176,7 +176,7 @@ export default Ember.Component.extend({
.attr("r", 20)
.attr("href",
function(d) {
- return "yarnQueues/" + d.queueData.get("name");
+ return "yarn-queues/" + d.queueData.get("name");
})
.style("stroke", function(d) {
if (d.queueData.get("name") == this.get("selected")) {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js
index 3c68365..2effb13 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js
@@ -29,25 +29,25 @@ export default Ember.Controller.extend({
outputMainMenu: function(){
var path = this.get('currentPath');
var html = '<li';
- if (path == 'yarnQueue') {
+ if (path == 'yarn-queue') {
html = html + ' class="active"';
}
- html = html + '><a href="yarnQueue/root">Queues<span class="sr-only">' +
+ html = html + '><a href="yarn-queue/root">Queues<span class="sr-only">' +
'(current)</span></a></li><li';
- if (path.lastIndexOf('yarnApp', 0) == 0) {
+ if (path.lastIndexOf('yarn-app', 0) == 0) {
html = html + ' class="active"';
}
- html = html + '><a href="yarnApps">Applications<span class="sr-only">' +
+ html = html + '><a href="yarn-apps">Applications<span class="sr-only">' +
'(current)</span></a></li><li';
- if (path == 'clusterOverview') {
+ if (path == 'cluster-overview') {
html = html + ' class="active"';
}
- html = html + '><a href="clusterOverview">Cluster Overview<span class=' +
+ html = html + '><a href="cluster-overview">Cluster Overview<span class=' +
'"sr-only">(current)</span></a></li><li';
- if (path.lastIndexOf('yarnNode', 0) == 0) {
+ if (path.lastIndexOf('yarn-node', 0) == 0) {
html = html + ' class="active"';
}
- html = html + '><a href="yarnNodes">Nodes<span class="sr-only">' +
+ html = html + '><a href="yarn-nodes">Nodes<span class="sr-only">' +
'(current)</span></a></li>';
return Ember.String.htmlSafe(html);
}.property('currentPath')
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js
index 8c29b34..b6b57ec 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js
@@ -36,7 +36,7 @@ export default Ember.Helper.helper(function(params,hash) {
var html = '<td>';
var logFilesCommaSeparated = "";
for (var i = 0; i < logFilesLen; i++) {
- html = html + '<a href="yarnContainerLog/' + nodeId + '/' +
+ html = html + '<a href="yarn-container-log/' + nodeId + '/' +
nodeAddr + '/' + containerId + '/' + logFiles[i] + '">' + logFiles[i] +
'</a>';
if (i != logFilesLen - 1) {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js
index 99d975b..331f082 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js
@@ -29,7 +29,7 @@ export default Ember.Helper.helper(function(params,hash) {
if (nodeState == "SHUTDOWN" || nodeState == "LOST") {
html = html + nodeHTTPAddress;
} else {
- html = html + '<a href="yarnNode/' + nodeId + "/" + nodeHTTPAddress + '">' +
+ html = html + '<a href="yarn-node/' + nodeId + "/" + nodeHTTPAddress + '">' +
nodeHTTPAddress + '</a>';
}
html = html + '</td>';
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-menu.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-menu.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-menu.js
index 589111f..2538d7d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-menu.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-menu.js
@@ -47,20 +47,20 @@ export default Ember.Helper.helper(function(params,hash) {
'<div class="panel-heading"><h4>Node Manager<br>(' + normalizedNodeId + ')</h4></div>'+
'<div class="panel-body"><ul class="nav nav-pills nav-stacked" id="stacked-menu">' +
'<ul class="nav nav-pills nav-stacked collapse in"><li';
- if (hash.path == 'yarnNode') {
+ if (hash.path == 'yarn-node') {
html = html + ' class="active"';
}
- html = html + '><a href="yarnNode/' + hash.nodeId + '/' + hash.nodeAddr +
+ html = html + '><a href="yarn-node/' + hash.nodeId + '/' + hash.nodeAddr +
'">Node Information</a></li><li';
- if (hash.path == 'yarnNodeApps') {
+ if (hash.path == 'yarn-node-apps') {
html = html + ' class="active"';
}
- html = html + '><a href="yarnNodeApps/' + hash.nodeId + '/' + hash.nodeAddr +
+ html = html + '><a href="yarn-node-apps/' + hash.nodeId + '/' + hash.nodeAddr +
'">List of Applications</a></li><li';
- if (hash.path == 'yarnNodeContainers') {
+ if (hash.path == 'yarn-node-containers') {
html = html + ' class="active"';
}
- html = html + '><a href="yarnNodeContainers/' +hash.nodeId + '/' + hash.nodeAddr +
+ html = html + '><a href="yarn-node-containers/' +hash.nodeId + '/' + hash.nodeAddr +
'">List of Containers</a></li></ul></ul></div>';
return Ember.String.htmlSafe(html);
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js
index b699bb3..8079907 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js
@@ -57,6 +57,6 @@ export default DS.Model.extend({
}.property(),
link: function() {
- return "/yarnAppAttempt/" + this.get("id");
+ return "/yarn-app-attempt/" + this.get("id");
}.property(),
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js
index 67e9d2c..8f7ce5f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js
@@ -24,22 +24,22 @@ var Router = Ember.Router.extend({
});
Router.map(function() {
- this.route('yarnApps');
- this.route('yarnNodes');
- this.route('yarnNode', { path: '/yarnNode/:node_id/:node_addr' });
- this.route('yarnNodeApps', { path: '/yarnNodeApps/:node_id/:node_addr' });
- this.route('yarnNodeApp',
- { path: '/yarnNodeApp/:node_id/:node_addr/:app_id' });
- this.route('yarnNodeContainers',
- { path: '/yarnNodeContainers/:node_id/:node_addr' });
- this.route('yarnNodeContainer',
- { path: '/yarnNodeContainer/:node_id/:node_addr/:container_id' });
- this.route('yarnContainerLog', { path:
- '/yarnContainerLog/:node_id/:node_addr/:container_id/:filename' });
- this.route('yarnQueue', { path: '/yarnQueue/:queue_name' });
- this.route('clusterOverview');
- this.route('yarnApp', { path: '/yarnApp/:app_id' });
- this.route('yarnAppAttempt', { path: '/yarnAppAttempt/:app_attempt_id'});
+ this.route('yarn-apps');
+ this.route('yarn-nodes');
+ this.route('yarn-node', { path: '/yarn-node/:node_id/:node_addr' });
+ this.route('yarn-node-apps', { path: '/yarn-node-apps/:node_id/:node_addr' });
+ this.route('yarn-node-app',
+ { path: '/yarn-node-app/:node_id/:node_addr/:app_id' });
+ this.route('yarn-node-containers',
+ { path: '/yarn-node-containers/:node_id/:node_addr' });
+ this.route('yarn-node-container',
+ { path: '/yarn-node-container/:node_id/:node_addr/:container_id' });
+ this.route('yarn-container-log', { path:
+ '/yarn-container-log/:node_id/:node_addr/:container_id/:filename' });
+ this.route('yarn-queue', { path: '/yarn-queue/:queue_name' });
+ this.route('cluster-overview');
+ this.route('yarn-app', { path: '/yarn-app/:app_id' });
+ this.route('yarn-app-attempt', { path: '/yarn-app-attempt/:app_attempt_id'});
this.route('error');
this.route('notfound', { path: '*:' });
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/index.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/index.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/index.js
index b228ff4..af26670 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/index.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/index.js
@@ -23,7 +23,7 @@ export default Ember.Route.extend({
* Redirect root URL to cluster overview page.
*/
beforeModel: function() {
- this.replaceWith('clusterOverview');
+ this.replaceWith('cluster-overview');
}
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempt.js
index 72a001c..a65118d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempt.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempt.js
@@ -21,15 +21,15 @@ import Ember from 'ember';
export default Ember.Route.extend({
model(param) {
return Ember.RSVP.hash({
- attempt: this.store.findRecord('yarnAppAttempt', param.app_attempt_id),
+ attempt: this.store.findRecord('yarn-app-attempt', param.app_attempt_id),
- rmContainers: this.store.query('yarnContainer',
+ rmContainers: this.store.query('yarn-container',
{
app_attempt_id: param.app_attempt_id,
is_rm: true
}),
- tsContainers: this.store.query('yarnContainer',
+ tsContainers: this.store.query('yarn-container',
{
app_attempt_id: param.app_attempt_id,
is_rm: false
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js
index fcdfad8..f5384b8 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js
@@ -21,8 +21,8 @@ import Ember from 'ember';
export default Ember.Route.extend({
model(param) {
return Ember.RSVP.hash({
- app: this.store.find('yarnApp', param.app_id),
- attempts: this.store.query('yarnAppAttempt', { appId: param.app_id})
+ app: this.store.find('yarn-app', param.app_id),
+ attempts: this.store.query('yarn-app-attempt', { appId: param.app_id})
});
}
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps.js
index 083f62d..ff49403 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps.js
@@ -20,7 +20,7 @@ import Ember from 'ember';
export default Ember.Route.extend({
model() {
- var apps = this.store.findAll('yarnApp');
+ var apps = this.store.findAll('yarn-app');
return apps;
}
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-container-log.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-container-log.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-container-log.js
index c324025..e2c9922 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-container-log.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-container-log.js
@@ -24,7 +24,7 @@ export default Ember.Route.extend({
var id = param.node_addr + Constants.PARAM_SEPARATOR + param.container_id +
Constants.PARAM_SEPARATOR + param.filename;
return Ember.RSVP.hash({
- containerLog: this.store.findRecord('yarnContainerLog', id),
+ containerLog: this.store.findRecord('yarn-container-log', id),
nodeInfo: { id: param.node_id, addr: param.node_addr }
}).then(function(hash) {
// Just return as its success.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-app.js
index 63b1f2a..ed3058a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-app.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-app.js
@@ -21,7 +21,7 @@ import Ember from 'ember';
export default Ember.Route.extend({
model(param) {
return Ember.RSVP.hash({
- nodeApp: this.store.queryRecord('yarnNodeApp',
+ nodeApp: this.store.queryRecord('yarn-node-app',
{ nodeAddr : param.node_addr, appId: param.app_id }),
nodeInfo: { id: param.node_id, addr: param.node_addr }
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-apps.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-apps.js
index ffb5b7b..4377a0d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-apps.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-apps.js
@@ -22,7 +22,7 @@ export default Ember.Route.extend({
model(param) {
// Get all apps running on a specific node. Node is contacted by using node_addr.
return Ember.RSVP.hash({
- apps: this.store.query('yarnNodeApp', { nodeAddr: param.node_addr }),
+ apps: this.store.query('yarn-node-app', { nodeAddr: param.node_addr }),
nodeInfo: { id: param.node_id, addr: param.node_addr }
});
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-container.js
index 2022662..4ee3c66 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-container.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-container.js
@@ -22,7 +22,7 @@ export default Ember.Route.extend({
model(param) {
// Get a specific container running on a specific node.
return Ember.RSVP.hash({
- nodeContainer: this.store.queryRecord('yarnNodeContainer',
+ nodeContainer: this.store.queryRecord('yarn-node-container',
{ nodeHttpAddr: param.node_addr, containerId: param.container_id }),
nodeInfo: { id: param.node_id, addr: param.node_addr }
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-containers.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-containers.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-containers.js
index 9a69729..283296e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-containers.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-containers.js
@@ -21,7 +21,7 @@ export default Ember.Route.extend({
model(param) {
// Get all containers running on specific node.
return Ember.RSVP.hash({
- containers: this.store.query('yarnNodeContainer', { nodeHttpAddr: param.node_addr }),
+ containers: this.store.query('yarn-node-container', { nodeHttpAddr: param.node_addr }),
nodeInfo: { id: param.node_id, addr: param.node_addr }
});
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js
index 7c58b94..6e57388 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js
@@ -22,8 +22,8 @@ export default Ember.Route.extend({
model(param) {
// Fetches data from both NM and RM. RM is queried to get node usage info.
return Ember.RSVP.hash({
- node: this.store.findRecord('yarnNode', param.node_addr),
- rmNode: this.store.findRecord('yarnRmNode', param.node_id)
+ node: this.store.findRecord('yarn-node', param.node_addr),
+ rmNode: this.store.findRecord('yarn-rm-node', param.node_id)
});
}
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes.js
index f33eef8..5c46630 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes.js
@@ -20,6 +20,6 @@ import Ember from 'ember';
export default Ember.Route.extend({
model() {
- return this.store.findAll('yarnRmNode');
+ return this.store.findAll('yarn-rm-node');
}
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queue.js
index 89858bf..06ceafb 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queue.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queue.js
@@ -22,15 +22,15 @@ export default Ember.Route.extend({
model(param) {
return Ember.RSVP.hash({
selected : param.queue_name,
- queues: this.store.findAll('yarnQueue'),
+ queues: this.store.findAll('yarn-queue'),
selectedQueue : undefined,
apps: undefined, // apps of selected queue
});
},
afterModel(model) {
- model.selectedQueue = this.store.peekRecord('yarnQueue', model.selected);
- model.apps = this.store.findAll('yarnApp');
+ model.selectedQueue = this.store.peekRecord('yarn-queue', model.selected);
+ model.apps = this.store.findAll('yarn-app');
model.apps.forEach(function(o) {
console.log(o);
})
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues/index.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues/index.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues/index.js
index 7da6f6d..4ab5716 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues/index.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues/index.js
@@ -18,6 +18,6 @@
export default Ember.Route.extend({
beforeModel() {
- this.transitionTo('yarnQueues.root');
+ this.transitionTo('yarn-queues.root');
}
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues/queues-selector.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues/queues-selector.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues/queues-selector.js
index 3686c83..5d14c6f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues/queues-selector.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues/queues-selector.js
@@ -20,6 +20,6 @@ import Ember from 'ember';
export default Ember.Route.extend({
model() {
- return this.store.findAll('yarnQueue');
+ return this.store.findAll('yarn-queue');
},
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-table.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-table.hbs
index fb0fb6f..6e8badc 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-table.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-table.hbs
@@ -36,7 +36,7 @@
{{#if arr}}
{{#each arr as |app|}}
<tr>
- <td><a href="yarnApp/{{app.id}}">{{app.id}}</a></td>
+ <td><a href="yarn-app/{{app.id}}">{{app.id}}</a></td>
<td>{{app.appName}}</td>
<td>{{app.user}}</td>
<td>{{app.queue}}</td>
@@ -57,7 +57,7 @@
{{/each}}
{{else}}
<tr>
- <td><a href="yarnApp/{{app.id}}">{{app.id}}</a></td>
+ <td><a href="yarn-app/{{app.id}}">{{app.id}}</a></td>
<td>{{app.appName}}</td>
<td>{{app.user}}</td>
<td>{{app.queue}}</td>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-container-log.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-container-log.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-container-log.hbs
index 9cc3b0f..e9c3fed 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-container-log.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-container-log.hbs
@@ -17,7 +17,7 @@
--}}
<div class="col-md-12 container-fluid">
- {{node-menu path="yarnContainerLog" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
+ {{node-menu path="yarn-container-log" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
<div class="col-md-10">
<div class="panel panel-default">
<div class="panel-heading">
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-app.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-app.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-app.hbs
index 4da64b8..dfd6fb5 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-app.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-app.hbs
@@ -18,7 +18,7 @@
<div class="col-md-12 container-fluid">
<div class="row">
- {{node-menu path="yarnNodeApp" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
+ {{node-menu path="yarn-node-app" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
<div class="col-md-10 container-fluid">
<div class="panel panel-default">
<div class="panel-heading"><b>Application Information</b></div>
@@ -48,7 +48,7 @@
<tbody>
{{#each model.nodeApp.containers as |container|}}
<tr>
- <td><a href="yarnNodeContainer/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{container}}">{{container}}</a></td>
+ <td><a href="yarn-node-container/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{container}}">{{container}}</a></td>
</tr>
{{/each}}
</tbody>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-apps.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-apps.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-apps.hbs
index c195397..d897afc 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-apps.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-apps.hbs
@@ -18,7 +18,7 @@
<div class="col-md-12 container-fluid">
<div class="row">
- {{node-menu path="yarnNodeApps" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
+ {{node-menu path="yarn-node-apps" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
<div class="col-md-10 container-fluid">
<table id="node-apps-table" class="display table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
@@ -35,7 +35,7 @@
<tr><td colspan="3" align="center">No apps found on this node</td></tr>
{{else}}
<tr>
- <td><a href="yarnNodeApp/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{app.appId}}">{{app.appId}}</a></td>
+ <td><a href="yarn-node-app/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{app.appId}}">{{app.appId}}</a></td>
<td><span class={{app.appStateStyle}}>{{app.state}}</span></td>
<td>{{app.user}}</td>
</tr>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-container.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-container.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-container.hbs
index fbbb2fc..8ddbae5 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-container.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-container.hbs
@@ -18,7 +18,7 @@
<div class="col-md-12 container-fluid">
<div class="row">
- {{node-menu path="yarnNodeContainer" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
+ {{node-menu path="yarn-node-container" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
<div class="col-md-10 container-fluid">
<div class="panel panel-default">
<div class="panel-heading"><b>Container Information</b></div>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs
index ca80ccd..65a67a8 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs
@@ -18,7 +18,7 @@
<div class="col-md-12 container-fluid">
<div class="row">
- {{node-menu path="yarnNodeContainers" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
+ {{node-menu path="yarn-node-containers" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
<div class="col-md-10 container-fluid">
<table id="node-containers-table" class="display table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
@@ -36,7 +36,7 @@
<tr><td colspan="4" align="center">No containers found on this node</td></tr>
{{else}}
<tr>
- <td><a href="yarnNodeContainer/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{container.containerId}}">{{container.containerId}}</a></td>
+ <td><a href="yarn-node-container/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{container.containerId}}">{{container.containerId}}</a></td>
<td><span class={{container.containerStateStyle}}>{{container.state}}</span></td>
<td>{{container.user}}</td>
<td>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce843274/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs
index a036076..d92a70a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs
@@ -18,7 +18,7 @@
<div class="col-md-12 container-fluid">
<div class="row">
- {{node-menu path="yarnNode" nodeId=model.rmNode.id nodeAddr=model.node.id}}
+ {{node-menu path="yarn-node" nodeId=model.rmNode.id nodeAddr=model.node.id}}
<div class="col-md-10 container-fluid">
<div class="panel panel-default">
<div class="panel-heading">Node Information</div>
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[38/50] [abbrv] hadoop git commit: YARN-4849. [YARN-3368] cleanup
code base, integrate web UI related build to mvn, and fix licenses. (wangda)
Posted by wa...@apache.org.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
new file mode 100644
index 0000000..f7ec020
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
@@ -0,0 +1,275 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+ // Map: <queue-name, queue>
+ map : undefined,
+
+ // Normalized data for d3
+ treeData: undefined,
+
+ // folded queues, folded[<queue-name>] == true means <queue-name> is folded
+ foldedQueues: { },
+
+ // maxDepth
+ maxDepth: 0,
+
+ // num of leaf queue, folded queue is treated as leaf queue
+ numOfLeafQueue: 0,
+
+ // mainSvg
+ mainSvg: undefined,
+
+ // Init data
+ initData: function() {
+ this.map = { };
+ this.treeData = { };
+ this.maxDepth = 0;
+ this.numOfLeafQueue = 0;
+
+ this.get("model")
+ .forEach(function(o) {
+ this.map[o.id] = o;
+ }.bind(this));
+
+ var selected = this.get("selected");
+
+ this.initQueue("root", 1, this.treeData);
+ },
+
+ // get Children array of given queue
+ getChildrenNamesArray: function(q) {
+ var namesArr = [];
+
+ // Folded queue's children is empty
+ if (this.foldedQueues[q.get("name")]) {
+ return namesArr;
+ }
+
+ var names = q.get("children");
+ if (names) {
+ names.forEach(function(name) {
+ namesArr.push(name);
+ });
+ }
+
+ return namesArr;
+ },
+
+ // Init queues
+ initQueue: function(queueName, depth, node) {
+ if ((!queueName) || (!this.map[queueName])) {
+ // Queue is not existed
+ return;
+ }
+
+ if (depth > this.maxDepth) {
+ this.maxDepth = this.maxDepth + 1;
+ }
+
+ var queue = this.map[queueName];
+
+ var names = this.getChildrenNamesArray(queue);
+
+ node.name = queueName;
+ node.parent = queue.get("parent");
+ node.queueData = queue;
+
+ if (names.length > 0) {
+ node.children = [];
+
+ names.forEach(function(name) {
+ var childQueueData = {};
+ node.children.push(childQueueData);
+ this.initQueue(name, depth + 1, childQueueData);
+ }.bind(this));
+ } else {
+ this.numOfLeafQueue = this.numOfLeafQueue + 1;
+ }
+ },
+
+ update: function(source, root, tree, diagonal) {
+ var duration = 300;
+ var i = 0;
+
+ // Compute the new tree layout.
+ var nodes = tree.nodes(root).reverse();
+ var links = tree.links(nodes);
+
+ // Normalize for fixed-depth.
+ nodes.forEach(function(d) { d.y = d.depth * 200; });
+
+ // Update the nodes\u2026
+ var node = this.mainSvg.selectAll("g.node")
+ .data(nodes, function(d) { return d.id || (d.id = ++i); });
+
+ // Enter any new nodes at the parent's previous position.
+ var nodeEnter = node.enter().append("g")
+ .attr("class", "node")
+ .attr("transform", function(d) { return "translate(" + source.y0 + "," + source.x0 + ")"; })
+ .on("click", function(d,i){
+ if (d.queueData.get("name") != this.get("selected")) {
+ document.location.href = "yarnQueue/" + d.queueData.get("name");
+ }
+ }.bind(this));
+ // .on("click", click);
+
+ nodeEnter.append("circle")
+ .attr("r", 1e-6)
+ .style("fill", function(d) {
+ var usedCap = d.queueData.get("usedCapacity");
+ if (usedCap <= 60.0) {
+ return "LimeGreen";
+ } else if (usedCap <= 100.0) {
+ return "DarkOrange";
+ } else {
+ return "LightCoral";
+ }
+ });
+
+ // append percentage
+ nodeEnter.append("text")
+ .attr("x", function(d) { return 0; })
+ .attr("dy", ".35em")
+ .attr("text-anchor", function(d) { return "middle"; })
+ .text(function(d) {
+ var usedCap = d.queueData.get("usedCapacity");
+ if (usedCap >= 100.0) {
+ return usedCap.toFixed(0) + "%";
+ } else {
+ return usedCap.toFixed(1) + "%";
+ }
+ })
+ .style("fill-opacity", 1e-6);
+
+ // append queue name
+ nodeEnter.append("text")
+ .attr("x", function(d) { return 40; })
+ .attr("dy", ".35em")
+ .attr("text-anchor", function(d) { return "start"; })
+ .text(function(d) { return d.name; })
+ .style("fill-opacity", 1e-6);
+
+ // Transition nodes to their new position.
+ var nodeUpdate = node.transition()
+ .duration(duration)
+ .attr("transform", function(d) { return "translate(" + d.y + "," + d.x + ")"; });
+
+ nodeUpdate.select("circle")
+ .attr("r", 20)
+ .attr("href",
+ function(d) {
+ return "yarnQueues/" + d.queueData.get("name");
+ })
+ .style("stroke", function(d) {
+ if (d.queueData.get("name") == this.get("selected")) {
+ return "red";
+ } else {
+ return "gray";
+ }
+ }.bind(this));
+
+ nodeUpdate.selectAll("text")
+ .style("fill-opacity", 1);
+
+ // Transition exiting nodes to the parent's new position.
+ var nodeExit = node.exit().transition()
+ .duration(duration)
+ .attr("transform", function(d) { return "translate(" + source.y + "," + source.x + ")"; })
+ .remove();
+
+ nodeExit.select("circle")
+ .attr("r", 1e-6);
+
+ nodeExit.select("text")
+ .style("fill-opacity", 1e-6);
+
+ // Update the links\u2026
+ var link = this.mainSvg.selectAll("path.link")
+ .data(links, function(d) { return d.target.id; });
+
+ // Enter any new links at the parent's previous position.
+ link.enter().insert("path", "g")
+ .attr("class", "link")
+ .attr("d", function(d) {
+ var o = {x: source.x0, y: source.y0};
+ return diagonal({source: o, target: o});
+ });
+
+ // Transition links to their new position.
+ link.transition()
+ .duration(duration)
+ .attr("d", diagonal);
+
+ // Transition exiting nodes to the parent's new position.
+ link.exit().transition()
+ .duration(duration)
+ .attr("d", function(d) {
+ var o = {x: source.x, y: source.y};
+ return diagonal({source: o, target: o});
+ })
+ .remove();
+
+ // Stash the old positions for transition.
+ nodes.forEach(function(d) {
+ d.x0 = d.x;
+ d.y0 = d.y;
+ });
+ },
+
+ reDraw: function() {
+ this.initData();
+
+ var margin = {top: 20, right: 120, bottom: 20, left: 120};
+ var treeWidth = this.maxDepth * 200;
+ var treeHeight = this.numOfLeafQueue * 80;
+ var width = treeWidth + margin.left + margin.right;
+ var height = treeHeight + margin.top + margin.bottom;
+ var layout = { };
+
+ if (this.mainSvg) {
+ this.mainSvg.remove();
+ }
+
+ this.mainSvg = d3.select("#" + this.get("parentId")).append("svg")
+ .attr("width", width)
+ .attr("height", height)
+ .attr("class", "tree-selector")
+ .append("g")
+ .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
+
+ var tree = d3.layout.tree().size([treeHeight, treeWidth]);
+
+ var diagonal = d3.svg.diagonal()
+ .projection(function(d) { return [d.y, d.x]; });
+
+ var root = this.treeData;
+ root.x0 = height / 2;
+ root.y0 = 0;
+
+ d3.select(self.frameElement).style("height", height);
+
+ this.update(root, root, tree, diagonal);
+ },
+
+ didInsertElement: function() {
+ this.reDraw();
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/config.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/config.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/config.js
new file mode 100644
index 0000000..224c65a
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/config.js
@@ -0,0 +1,27 @@
+/**
+ * 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.
+ */
+
+/**
+ * Host and port configurations
+ */
+export default {
+ RM_HOST: 'localhost',
+ RM_PORT: '8088',
+ TS_HOST: 'localhost',
+ TS_PORT: '8188',
+};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/constants.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/constants.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/constants.js
new file mode 100644
index 0000000..d2937a0
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/constants.js
@@ -0,0 +1,24 @@
+/**
+ * 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.
+ */
+
+/**
+ * Application level global constants go here.
+ */
+export default {
+ PARAM_SEPARATOR: '!',
+};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js
new file mode 100644
index 0000000..3c68365
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js
@@ -0,0 +1,55 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+/**
+ * Base controller for application.
+ */
+export default Ember.Controller.extend({
+ /**
+ * Output main top UI menu which is common across all pages.
+ * Menu item will be made active based on current path.
+ */
+ outputMainMenu: function(){
+ var path = this.get('currentPath');
+ var html = '<li';
+ if (path == 'yarnQueue') {
+ html = html + ' class="active"';
+ }
+ html = html + '><a href="yarnQueue/root">Queues<span class="sr-only">' +
+ '(current)</span></a></li><li';
+ if (path.lastIndexOf('yarnApp', 0) == 0) {
+ html = html + ' class="active"';
+ }
+ html = html + '><a href="yarnApps">Applications<span class="sr-only">' +
+ '(current)</span></a></li><li';
+ if (path == 'clusterOverview') {
+ html = html + ' class="active"';
+ }
+ html = html + '><a href="clusterOverview">Cluster Overview<span class=' +
+ '"sr-only">(current)</span></a></li><li';
+ if (path.lastIndexOf('yarnNode', 0) == 0) {
+ html = html + ' class="active"';
+ }
+ html = html + '><a href="yarnNodes">Nodes<span class="sr-only">' +
+ '(current)</span></a></li>';
+ return Ember.String.htmlSafe(html);
+ }.property('currentPath')
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/cluster-overview.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/cluster-overview.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/cluster-overview.js
new file mode 100644
index 0000000..dc2f6e4
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/cluster-overview.js
@@ -0,0 +1,23 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+ loading: true,
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps.js
new file mode 100644
index 0000000..dc99fd1
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps.js
@@ -0,0 +1,22 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queue.js
new file mode 100644
index 0000000..38cf352
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queue.js
@@ -0,0 +1,24 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+ needReload: true,
+ selectedQueue: undefined,
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/divide.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/divide.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/divide.js
new file mode 100644
index 0000000..fcf64dd
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/divide.js
@@ -0,0 +1,31 @@
+/**
+ * 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.
+ */
+import Ember from 'ember';
+
+/**
+ * Helper assumes values are numeric. num means numerator and
+ * den means denominator.
+ */
+export default Ember.Helper.helper(function(params,hash) {
+ var num = hash.num;
+ var den = hash.den;
+ if (den == 0) {
+ return 0;
+ }
+ return Math.floor(num/den);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js
new file mode 100644
index 0000000..8c29b34
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js
@@ -0,0 +1,48 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+/**
+ * Represent log files as comma separated list.
+ */
+export default Ember.Helper.helper(function(params,hash) {
+ var logFiles = hash.logFiles;
+ if (logFiles == null) {
+ return "";
+ }
+ var logFilesLen = logFiles.length;
+ if (logFilesLen == 0) {
+ return "";
+ }
+ var nodeId = hash.nodeId;
+ var nodeAddr = hash.nodeAddr;
+ var containerId = hash.containerId;
+ var html = '<td>';
+ var logFilesCommaSeparated = "";
+ for (var i = 0; i < logFilesLen; i++) {
+ html = html + '<a href="yarnContainerLog/' + nodeId + '/' +
+ nodeAddr + '/' + containerId + '/' + logFiles[i] + '">' + logFiles[i] +
+ '</a>';
+ if (i != logFilesLen - 1) {
+ html = html + ",";
+ }
+ }
+ html = html + '</td>';
+ return Ember.String.htmlSafe(html);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js
new file mode 100644
index 0000000..99d975b
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js
@@ -0,0 +1,37 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+/**
+ * Generate link to node page if its not SHUTDOWN or LOST.
+ */
+export default Ember.Helper.helper(function(params,hash) {
+ var nodeState = hash.nodeState;
+ var nodeHTTPAddress = hash.nodeHTTPAddress;
+ var nodeId = hash.nodeId;
+ var html = '<td>';
+ if (nodeState == "SHUTDOWN" || nodeState == "LOST") {
+ html = html + nodeHTTPAddress;
+ } else {
+ html = html + '<a href="yarnNode/' + nodeId + "/" + nodeHTTPAddress + '">' +
+ nodeHTTPAddress + '</a>';
+ }
+ html = html + '</td>';
+ return Ember.String.htmlSafe(html);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-menu.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-menu.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-menu.js
new file mode 100644
index 0000000..589111f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-menu.js
@@ -0,0 +1,66 @@
+/**
+ * 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.
+ */
+import Ember from 'ember';
+
+/**
+ * Create left hand side node manager menu with menu item activated based
+ * on page being accessed.
+ */
+export default Ember.Helper.helper(function(params,hash) {
+ // Place a menu within a panel inside col-md-2 container.
+ var nodeIdSplitAtPort = hash.nodeId;
+ var portIndex = nodeIdSplitAtPort.indexOf(':');
+ if (portIndex != -1) {
+ nodeIdSplitAtPort = nodeIdSplitAtPort.substring(0, portIndex) +
+ ':​' + nodeIdSplitAtPort.substring(portIndex + 1);
+ }
+ var normalizedNodeId = '';
+ var splitsAlongDots = nodeIdSplitAtPort.split('.');
+ if (splitsAlongDots) {
+ var len = splitsAlongDots.length;
+ for (var i = 0; i < len; i++) {
+ normalizedNodeId = normalizedNodeId + splitsAlongDots[i];
+ if (i != len - 1) {
+ normalizedNodeId = normalizedNodeId + '.​';
+ }
+ }
+ } else {
+ normalizedNodeId = nodeIdSplitAtPort;
+ }
+
+ var html = '<div class="col-md-2 container-fluid"><div class="panel panel-default">'+
+ '<div class="panel-heading"><h4>Node Manager<br>(' + normalizedNodeId + ')</h4></div>'+
+ '<div class="panel-body"><ul class="nav nav-pills nav-stacked" id="stacked-menu">' +
+ '<ul class="nav nav-pills nav-stacked collapse in"><li';
+ if (hash.path == 'yarnNode') {
+ html = html + ' class="active"';
+ }
+ html = html + '><a href="yarnNode/' + hash.nodeId + '/' + hash.nodeAddr +
+ '">Node Information</a></li><li';
+ if (hash.path == 'yarnNodeApps') {
+ html = html + ' class="active"';
+ }
+ html = html + '><a href="yarnNodeApps/' + hash.nodeId + '/' + hash.nodeAddr +
+ '">List of Applications</a></li><li';
+ if (hash.path == 'yarnNodeContainers') {
+ html = html + ' class="active"';
+ }
+ html = html + '><a href="yarnNodeContainers/' +hash.nodeId + '/' + hash.nodeAddr +
+ '">List of Containers</a></li></ul></ul></div>';
+ return Ember.String.htmlSafe(html);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/index.html
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/index.html b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/index.html
new file mode 100644
index 0000000..969ea2f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/index.html
@@ -0,0 +1,43 @@
+<!--
+* 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.
+-->
+
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <title>YarnUi</title>
+ <meta name="description" content="">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+
+ {{content-for 'head'}}
+
+ <link rel="stylesheet" href="assets/vendor.css">
+ <link rel="stylesheet" href="assets/yarn-ui.css">
+
+ {{content-for 'head-footer'}}
+ </head>
+ <body>
+ {{content-for 'body'}}
+
+ <script src="assets/vendor.js"></script>
+ <script src="assets/yarn-ui.js"></script>
+
+ {{content-for 'body-footer'}}
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-info.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-info.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-info.js
new file mode 100644
index 0000000..332fdf3
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-info.js
@@ -0,0 +1,31 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ startedOn: DS.attr('string'),
+ state: DS.attr('string'),
+ haState: DS.attr('string'),
+ rmStateStoreName: DS.attr('string'),
+ resourceManagerVersion: DS.attr('string'),
+ resourceManagerBuildVersion: DS.attr('string'),
+ hadoopVersion: DS.attr('string'),
+ hadoopBuildVersion: DS.attr('string'),
+ hadoopVersionBuiltOn: DS.attr('string')
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-metric.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-metric.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-metric.js
new file mode 100644
index 0000000..981375a
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-metric.js
@@ -0,0 +1,133 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ appsSubmitted: DS.attr('number'),
+ appsCompleted: DS.attr('number'),
+ appsPending: DS.attr('number'),
+ appsRunning: DS.attr('number'),
+ appsFailed: DS.attr('number'),
+ appsKilled: DS.attr('number'),
+ reservedMB: DS.attr('number'),
+ availableMB: DS.attr('number'),
+ allocatedMB: DS.attr('number'),
+ reservedVirtualCores: DS.attr('number'),
+ availableVirtualCores: DS.attr('number'),
+ allocatedVirtualCores: DS.attr('number'),
+ containersAllocated: DS.attr('number'),
+ containersReserved: DS.attr('number'),
+ containersPending: DS.attr('number'),
+ totalMB: DS.attr('number'),
+ totalVirtualCores: DS.attr('number'),
+ totalNodes: DS.attr('number'),
+ lostNodes: DS.attr('number'),
+ unhealthyNodes: DS.attr('number'),
+ decommissionedNodes: DS.attr('number'),
+ rebootedNodes: DS.attr('number'),
+ activeNodes: DS.attr('number'),
+
+ getFinishedAppsDataForDonutChart: function() {
+ var arr = [];
+ arr.push({
+ label: "Completed",
+ value: this.get("appsCompleted")
+ });
+ arr.push({
+ label: "Killed",
+ value: this.get("appsKilled")
+ });
+ arr.push({
+ label: "Failed",
+ value: this.get("appsFailed")
+ });
+
+ return arr;
+ }.property("appsCompleted", "appsKilled", "appsFailed"),
+
+ getRunningAppsDataForDonutChart: function() {
+ var arr = [];
+
+ arr.push({
+ label: "Pending",
+ value: this.get("appsPending")
+ });
+ arr.push({
+ label: "Running",
+ value: this.get("appsRunning")
+ });
+
+ return arr;
+ }.property("appsPending", "appsRunning"),
+
+ getNodesDataForDonutChart: function() {
+ var arr = [];
+ arr.push({
+ label: "Active",
+ value: this.get("activeNodes")
+ });
+ arr.push({
+ label: "Unhealthy",
+ value: this.get("unhealthyNodes")
+ });
+ arr.push({
+ label: "Decomissioned",
+ value: this.get("decommissionedNodes")
+ });
+ return arr;
+ }.property("activeNodes", "unhealthyNodes", "decommissionedNodes"),
+
+ getMemoryDataForDonutChart: function() {
+ var type = "MB";
+ var arr = [];
+ arr.push({
+ label: "Allocated",
+ value: this.get("allocated" + type)
+ });
+ arr.push({
+ label: "Reserved",
+ value: this.get("reserved" + type)
+ });
+ arr.push({
+ label: "Available",
+ value: this.get("available" + type)
+ });
+
+ return arr;
+ }.property("allocatedMB", "reservedMB", "availableMB"),
+
+ getVCoreDataForDonutChart: function() {
+ var type = "VirtualCores";
+ var arr = [];
+ arr.push({
+ label: "Allocated",
+ value: this.get("allocated" + type)
+ });
+ arr.push({
+ label: "Reserved",
+ value: this.get("reserved" + type)
+ });
+ arr.push({
+ label: "Available",
+ value: this.get("available" + type)
+ });
+
+ return arr;
+ }.property("allocatedVirtualCores", "reservedVirtualCores", "availableVirtualCores"),
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js
new file mode 100644
index 0000000..b699bb3
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js
@@ -0,0 +1,62 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Converter from 'yarn-ui/utils/converter';
+
+export default DS.Model.extend({
+ startTime: DS.attr('string'),
+ finishedTime: DS.attr('string'),
+ containerId: DS.attr('string'),
+ nodeHttpAddress: DS.attr('string'),
+ nodeId: DS.attr('string'),
+ logsLink: DS.attr('string'),
+
+ startTs: function() {
+ return Converter.dateToTimeStamp(this.get("startTime"));
+ }.property("startTime"),
+
+ finishedTs: function() {
+ var ts = Converter.dateToTimeStamp(this.get("finishedTime"));
+ return ts;
+ }.property("finishedTime"),
+
+ shortAppAttemptId: function() {
+ return "attempt_" +
+ parseInt(Converter.containerIdToAttemptId(this.get("containerId")).split("_")[3]);
+ }.property("containerId"),
+
+ elapsedTime: function() {
+ var elapsedMs = this.get("finishedTs") - this.get("startTs");
+ if (elapsedMs <= 0) {
+ elapsedMs = Date.now() - this.get("startTs");
+ }
+
+ return Converter.msToElapsedTime(elapsedMs);
+ }.property(),
+
+ tooltipLabel: function() {
+ return "<p>Id:" + this.get("id") +
+ "</p><p>ElapsedTime:" +
+ String(this.get("elapsedTime")) + "</p>";
+ }.property(),
+
+ link: function() {
+ return "/yarnAppAttempt/" + this.get("id");
+ }.property(),
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js
new file mode 100644
index 0000000..1d506c2
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js
@@ -0,0 +1,83 @@
+/**
+ * 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.
+ */
+
+import Converter from 'yarn-ui/utils/converter';
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ appName: DS.attr('string'),
+ user: DS.attr('string'),
+ queue: DS.attr('string'),
+ state: DS.attr('string'),
+ startTime: DS.attr('string'),
+ elapsedTime: DS.attr('string'),
+ finalStatus: DS.attr('string'),
+ finishedTime: DS.attr('finishedTime'),
+ progress: DS.attr('number'),
+ diagnostics: DS.attr('string'),
+ amContainerLogs: DS.attr('string'),
+ amHostHttpAddress: DS.attr('string'),
+ logAggregationStatus: DS.attr('string'),
+ unmanagedApplication: DS.attr('string'),
+ amNodeLabelExpression: DS.attr('string'),
+ applicationTags: DS.attr('string'),
+ priority: DS.attr('number'),
+ allocatedMB: DS.attr('number'),
+ allocatedVCores: DS.attr('number'),
+ runningContainers: DS.attr('number'),
+ memorySeconds: DS.attr('number'),
+ vcoreSeconds: DS.attr('number'),
+ preemptedResourceMB: DS.attr('number'),
+ preemptedResourceVCores: DS.attr('number'),
+ numNonAMContainerPreempted: DS.attr('number'),
+ numAMContainerPreempted: DS.attr('number'),
+
+ isFailed: function() {
+ return this.get('finalStatus') == "FAILED"
+ }.property("finalStatus"),
+
+ allocatedResource: function() {
+ return Converter.resourceToString(this.get("allocatedMB"), this.get("allocatedVCores"));
+ }.property("allocatedMB", "allocatedVCores"),
+
+ preemptedResource: function() {
+ return Converter.resourceToString(this.get("preemptedResourceMB"), this.get("preemptedResourceVCores"));
+ }.property("preemptedResourceMB", "preemptedResourceVCores"),
+
+ aggregatedResourceUsage: function() {
+ return Converter.resourceToString(this.get("memorySeconds"), this.get("vcoreSeconds")) + " (� Secs)";
+ }.property("memorySeconds", "vcoreSeconds"),
+
+ progressStyle: function() {
+ return "width: " + this.get("progress") + "%";
+ }.property("progress"),
+
+ finalStatusStyle: function() {
+ var style = "default";
+ var finalStatus = this.get("finalStatus");
+ if (finalStatus == "KILLED") {
+ style = "warning";
+ } else if (finalStatus == "FAILED") {
+ style = "danger";
+ } else {
+ style = "success";
+ }
+
+ return "label label-" + style;
+ }.property("finalStatus")
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container-log.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container-log.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container-log.js
new file mode 100644
index 0000000..31cf61e
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container-log.js
@@ -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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ logs: DS.attr('string'),
+ containerID: DS.attr('string'),
+ logFileName: DS.attr('string')
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container.js
new file mode 100644
index 0000000..b745296
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container.js
@@ -0,0 +1,57 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Converter from 'yarn-ui/utils/converter';
+
+export default DS.Model.extend({
+ allocatedMB: DS.attr('number'),
+ allocatedVCores: DS.attr('number'),
+ assignedNodeId: DS.attr('string'),
+ priority: DS.attr('number'),
+ startedTime: DS.attr('number'),
+ finishedTime: DS.attr('number'),
+ logUrl: DS.attr('string'),
+ containerExitStatus: DS.attr('number'),
+ containerState: DS.attr('string'),
+ nodeHttpAddress: DS.attr('string'),
+
+ startTs: function() {
+ return Converter.dateToTimeStamp(this.get("startedTime"));
+ }.property("startedTime"),
+
+ finishedTs: function() {
+ var ts = Converter.dateToTimeStamp(this.get("finishedTime"));
+ return ts;
+ }.property("finishedTime"),
+
+ elapsedTime: function() {
+ var elapsedMs = this.get("finishedTs") - this.get("startTs");
+ if (elapsedMs <= 0) {
+ elapsedMs = Date.now() - this.get("startTs");
+ }
+
+ return Converter.msToElapsedTime(elapsedMs);
+ }.property(),
+
+ tooltipLabel: function() {
+ return "<p>Id:" + this.get("id") +
+ "</p><p>ElapsedTime:" +
+ String(this.get("elapsedTime")) + "</p>";
+ }.property(),
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node-app.js
new file mode 100644
index 0000000..6dc69ae
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node-app.js
@@ -0,0 +1,44 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ appId: DS.attr('string'),
+ state: DS.attr('string'),
+ user: DS.attr('string'),
+ containers: DS.attr('array'),
+ /**
+ * Indicates no rows were retrieved from backend
+ */
+ isDummyApp: function() {
+ return this.get('id') == "dummy";
+ }.property("id"),
+
+ appStateStyle: function() {
+ var style = "default";
+ var appState = this.get("state");
+ if (appState == "RUNNING" || appState == "FINISHING_CONTAINERS_WAIT" ||
+ appState == "APPLICATION_RESOURCES_CLEANINGUP") {
+ style = "primary";
+ } else if (appState == "FINISHED") {
+ style = "success";
+ }
+ return "label label-" + style;
+ }.property("state")
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node-container.js
new file mode 100644
index 0000000..3ba3216
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node-container.js
@@ -0,0 +1,57 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ containerId: DS.attr('string'),
+ state: DS.attr('string'),
+ user: DS.attr('string'),
+ exitCode: DS.attr('string'),
+ diagnostics: DS.attr('string'),
+ totalMemoryNeeded: DS.attr('number'),
+ totalVCoresNeeded: DS.attr('number'),
+ containerLogFiles: DS.attr('array'),
+
+ /**
+ * Indicates that there was no container retrieved from backend.
+ */
+ isDummyContainer: function() {
+ return this.get('id') == "dummy";
+ }.property("id"),
+
+ containerStateStyle: function() {
+ var style = "primary";
+ var containerState = this.get('state');
+ var containerExitCode = this.get('exitCode');
+ if (containerState == "DONE") {
+ if (containerExitCode == "0") {
+ style = "success";
+ } else if (containerExitCode != "N/A") {
+ style = "danger";
+ }
+ }
+ if (containerState == "EXITED_WITH_SUCCESS") {
+ style = "success";
+ }
+ if (containerState == "EXITED_WITH_FAILURE") {
+ style = "danger";
+ }
+ return "label label-" + style;
+ }.property("state", "exitCode")
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node.js
new file mode 100644
index 0000000..4753983
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node.js
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ totalVmemAllocatedContainersMB: DS.attr('number'),
+ totalPmemAllocatedContainersMB: DS.attr('number'),
+ totalVCoresAllocatedContainers: DS.attr('number'),
+ vmemCheckEnabled: DS.attr('boolean'),
+ pmemCheckEnabled: DS.attr('boolean'),
+ nodeHealthy: DS.attr('boolean'),
+ lastNodeUpdateTime: DS.attr('string'),
+ healthReport: DS.attr('string'),
+ nmStartupTime: DS.attr('string'),
+ nodeManagerBuildVersion: DS.attr('string'),
+ hadoopBuildVersion: DS.attr('string'),
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-queue.js
new file mode 100644
index 0000000..7de4ccc
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-queue.js
@@ -0,0 +1,94 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ name: DS.attr('string'),
+ children: DS.attr('array'),
+ parent: DS.attr('string'),
+ capacity: DS.attr('number'),
+ maxCapacity: DS.attr('number'),
+ usedCapacity: DS.attr('number'),
+ absCapacity: DS.attr('number'),
+ absMaxCapacity: DS.attr('number'),
+ absUsedCapacity: DS.attr('number'),
+ state: DS.attr('string'),
+ userLimit: DS.attr('number'),
+ userLimitFactor: DS.attr('number'),
+ preemptionDisabled: DS.attr('number'),
+ numPendingApplications: DS.attr('number'),
+ numActiveApplications: DS.attr('number'),
+ users: DS.hasMany('YarnUser'),
+
+ isLeafQueue: function() {
+ var len = this.get("children.length");
+ if (!len) {
+ return true;
+ }
+ return len <= 0;
+ }.property("children"),
+
+ capacitiesBarChartData: function() {
+ return [
+ {
+ label: "Absolute Capacity",
+ value: this.get("name") == "root" ? 100 : this.get("absCapacity")
+ },
+ {
+ label: "Absolute Used",
+ value: this.get("name") == "root" ? this.get("usedCapacity") : this.get("absUsedCapacity")
+ },
+ {
+ label: "Absolute Max Capacity",
+ value: this.get("name") == "root" ? 100 : this.get("absMaxCapacity")
+ }
+ ]
+ }.property("absCapacity", "absUsedCapacity", "absMaxCapacity"),
+
+ userUsagesDonutChartData: function() {
+ var data = [];
+ if (this.get("users")) {
+ this.get("users").forEach(function(o) {
+ data.push({
+ label: o.get("name"),
+ value: o.get("usedMemoryMB")
+ })
+ });
+ }
+
+ return data;
+ }.property("users"),
+
+ hasUserUsages: function() {
+ return this.get("userUsagesDonutChartData").length > 0;
+ }.property(),
+
+ numOfApplicationsDonutChartData: function() {
+ return [
+ {
+ label: "Pending Apps",
+ value: this.get("numPendingApplications") || 0 // TODO, fix the REST API so root will return #applications as well.
+ },
+ {
+ label: "Active Apps",
+ value: this.get("numActiveApplications") || 0
+ }
+ ]
+ }.property(),
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-rm-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-rm-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-rm-node.js
new file mode 100644
index 0000000..9a1082c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-rm-node.js
@@ -0,0 +1,92 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ rack: DS.attr('string'),
+ state: DS.attr('string'),
+ nodeHostName: DS.attr('string'),
+ nodeHTTPAddress: DS.attr('string'),
+ lastHealthUpdate: DS.attr('string'),
+ healthReport: DS.attr('string'),
+ numContainers: DS.attr('number'),
+ usedMemoryMB: DS.attr('number'),
+ availMemoryMB: DS.attr('number'),
+ usedVirtualCores: DS.attr('number'),
+ availableVirtualCores: DS.attr('number'),
+ version: DS.attr('string'),
+ nodeLabels: DS.attr('array'),
+
+ nodeLabelsAsString: function() {
+ var labels = this.get("nodeLabels");
+ var labelToReturn = "";
+ // Only one label per node supported.
+ if (labels && labels.length > 0) {
+ labelToReturn = labels[0];
+ }
+ return labelToReturn;
+ }.property("nodeLabels"),
+
+ /**
+ * Indicates no rows were retrieved from backend
+ */
+ isDummyNode: function() {
+ return this.get('id') == "dummy";
+ }.property("id"),
+
+ nodeStateStyle: function() {
+ var style = "default";
+ var nodeState = this.get("state");
+ if (nodeState == "REBOOTED") {
+ style = "warning";
+ } else if (nodeState == "UNHEALTHY" || nodeState == "DECOMMISSIONED" ||
+ nodeState == "LOST" || nodeState == "SHUTDOWN") {
+ style = "danger";
+ } else if (nodeState == "RUNNING") {
+ style = "success";
+ }
+ return "label label-" + style;
+ }.property("state"),
+
+ getMemoryDataForDonutChart: function() {
+ var arr = [];
+ arr.push({
+ label: "Used",
+ value: this.get("usedMemoryMB")
+ });
+ arr.push({
+ label: "Available",
+ value: this.get("availMemoryMB")
+ });
+ return arr;
+ }.property("availMemoryMB", "usedMemoryMB"),
+
+ getVCoreDataForDonutChart: function() {
+ var arr = [];
+ arr.push({
+ label: "Used",
+ value: this.get("usedVirtualCores")
+ });
+ arr.push({
+ label: "Available",
+ value: this.get("availableVirtualCores")
+ });
+ return arr;
+ }.property("availableVirtualCores", "usedVirtualCores"),
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-user.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-user.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-user.js
new file mode 100644
index 0000000..7cfd182
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-user.js
@@ -0,0 +1,26 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ name: DS.attr('string'),
+ queueName: DS.attr('string'),
+ usedMemoryMB: DS.attr('number'),
+ usedVCore: DS.attr('number')
+})
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js
new file mode 100644
index 0000000..67e9d2c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js
@@ -0,0 +1,47 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import config from './config/environment';
+
+var Router = Ember.Router.extend({
+ location: config.locationType
+});
+
+Router.map(function() {
+ this.route('yarnApps');
+ this.route('yarnNodes');
+ this.route('yarnNode', { path: '/yarnNode/:node_id/:node_addr' });
+ this.route('yarnNodeApps', { path: '/yarnNodeApps/:node_id/:node_addr' });
+ this.route('yarnNodeApp',
+ { path: '/yarnNodeApp/:node_id/:node_addr/:app_id' });
+ this.route('yarnNodeContainers',
+ { path: '/yarnNodeContainers/:node_id/:node_addr' });
+ this.route('yarnNodeContainer',
+ { path: '/yarnNodeContainer/:node_id/:node_addr/:container_id' });
+ this.route('yarnContainerLog', { path:
+ '/yarnContainerLog/:node_id/:node_addr/:container_id/:filename' });
+ this.route('yarnQueue', { path: '/yarnQueue/:queue_name' });
+ this.route('clusterOverview');
+ this.route('yarnApp', { path: '/yarnApp/:app_id' });
+ this.route('yarnAppAttempt', { path: '/yarnAppAttempt/:app_attempt_id'});
+ this.route('error');
+ this.route('notfound', { path: '*:' });
+});
+
+export default Router;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js
new file mode 100644
index 0000000..b7a5754
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js
@@ -0,0 +1,38 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ actions: {
+ /**
+ * Base error handler for the application.
+ * If specific routes do not handle the error, it will bubble up to
+ * this handler. Here we redirect to either 404 page or a generic
+ * error handler page.
+ */
+ error: function (error) {
+ if (error && error.errors[0] &&
+ error.errors[0].status == 404) {
+ this.intermediateTransitionTo('/notfound');
+ } else {
+ this.intermediateTransitionTo('/error');
+ }
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/cluster-overview.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/cluster-overview.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/cluster-overview.js
new file mode 100644
index 0000000..4b4e554
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/cluster-overview.js
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model() {
+ return this.store.findAll('ClusterMetric');
+ },
+
+ afterModel() {
+ this.controllerFor("ClusterOverview").set("loading", false);
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/index.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/index.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/index.js
new file mode 100644
index 0000000..b228ff4
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/index.js
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ /**
+ * Redirect root URL to cluster overview page.
+ */
+ beforeModel: function() {
+ this.replaceWith('clusterOverview');
+ }
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempt.js
new file mode 100644
index 0000000..72a001c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempt.js
@@ -0,0 +1,39 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ return Ember.RSVP.hash({
+ attempt: this.store.findRecord('yarnAppAttempt', param.app_attempt_id),
+
+ rmContainers: this.store.query('yarnContainer',
+ {
+ app_attempt_id: param.app_attempt_id,
+ is_rm: true
+ }),
+
+ tsContainers: this.store.query('yarnContainer',
+ {
+ app_attempt_id: param.app_attempt_id,
+ is_rm: false
+ }),
+ });
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js
new file mode 100644
index 0000000..fcdfad8
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js
@@ -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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ return Ember.RSVP.hash({
+ app: this.store.find('yarnApp', param.app_id),
+ attempts: this.store.query('yarnAppAttempt', { appId: param.app_id})
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps.js
new file mode 100644
index 0000000..083f62d
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps.js
@@ -0,0 +1,26 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model() {
+ var apps = this.store.findAll('yarnApp');
+ return apps;
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-container-log.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-container-log.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-container-log.js
new file mode 100644
index 0000000..c324025
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-container-log.js
@@ -0,0 +1,55 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import Constants from 'yarn-ui/constants';
+
+export default Ember.Route.extend({
+ model(param) {
+ var id = param.node_addr + Constants.PARAM_SEPARATOR + param.container_id +
+ Constants.PARAM_SEPARATOR + param.filename;
+ return Ember.RSVP.hash({
+ containerLog: this.store.findRecord('yarnContainerLog', id),
+ nodeInfo: { id: param.node_id, addr: param.node_addr }
+ }).then(function(hash) {
+ // Just return as its success.
+ return hash;
+ }, function(reason) {
+ if (reason.errors && reason.errors[0]) {
+ // This means HTTP error response was sent by adapter.
+ return reason;
+ } else {
+ // Assume empty response received from server.
+ return { nodeInfo: { id: param.node_id, addr: param.node_addr },
+ containerLog: { logs: "", containerID: param.container_id,
+ logFileName: param.filename}};
+ }
+ });
+ },
+
+ afterModel(model) {
+ // Handle errors and redirect if promise is rejected.
+ if (model.errors && model.errors[0]) {
+ if (model.errors[0].status == 404) {
+ this.replaceWith('/notfound');
+ } else {
+ this.replaceWith('/error');
+ }
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-app.js
new file mode 100644
index 0000000..63b1f2a
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-app.js
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ return Ember.RSVP.hash({
+ nodeApp: this.store.queryRecord('yarnNodeApp',
+ { nodeAddr : param.node_addr, appId: param.app_id }),
+ nodeInfo: { id: param.node_id, addr: param.node_addr }
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-apps.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-apps.js
new file mode 100644
index 0000000..ffb5b7b
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-apps.js
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ // Get all apps running on a specific node. Node is contacted by using node_addr.
+ return Ember.RSVP.hash({
+ apps: this.store.query('yarnNodeApp', { nodeAddr: param.node_addr }),
+ nodeInfo: { id: param.node_id, addr: param.node_addr }
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-container.js
new file mode 100644
index 0000000..2022662
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-container.js
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ // Get a specific container running on a specific node.
+ return Ember.RSVP.hash({
+ nodeContainer: this.store.queryRecord('yarnNodeContainer',
+ { nodeHttpAddr: param.node_addr, containerId: param.container_id }),
+ nodeInfo: { id: param.node_id, addr: param.node_addr }
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-containers.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-containers.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-containers.js
new file mode 100644
index 0000000..9a69729
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-containers.js
@@ -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.
+ */
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ // Get all containers running on specific node.
+ return Ember.RSVP.hash({
+ containers: this.store.query('yarnNodeContainer', { nodeHttpAddr: param.node_addr }),
+ nodeInfo: { id: param.node_id, addr: param.node_addr }
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js
new file mode 100644
index 0000000..7c58b94
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ // Fetches data from both NM and RM. RM is queried to get node usage info.
+ return Ember.RSVP.hash({
+ node: this.store.findRecord('yarnNode', param.node_addr),
+ rmNode: this.store.findRecord('yarnRmNode', param.node_id)
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes.js
new file mode 100644
index 0000000..f33eef8
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes.js
@@ -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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model() {
+ return this.store.findAll('yarnRmNode');
+ }
+});
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[12/50] [abbrv] hadoop git commit: HADOOP-13403.
AzureNativeFileSystem rename/delete performance improvements. Contributed by
Subramanyam Pattipaka.
Posted by wa...@apache.org.
HADOOP-13403. AzureNativeFileSystem rename/delete performance improvements. Contributed by Subramanyam Pattipaka.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/2ed58c40
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/2ed58c40
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/2ed58c40
Branch: refs/heads/YARN-3368
Commit: 2ed58c40e5dcbf5c5303c00e85096085b1055f85
Parents: 8c06384
Author: Chris Nauroth <cn...@apache.org>
Authored: Mon Aug 8 12:28:40 2016 -0700
Committer: Chris Nauroth <cn...@apache.org>
Committed: Mon Aug 8 12:28:40 2016 -0700
----------------------------------------------------------------------
.../AzureFileSystemThreadPoolExecutor.java | 346 +++++++++
.../fs/azure/AzureFileSystemThreadTask.java | 29 +
.../fs/azure/AzureNativeFileSystemStore.java | 53 +-
.../hadoop/fs/azure/NativeAzureFileSystem.java | 235 +++---
.../hadoop-azure/src/site/markdown/index.md | 19 +
.../TestFileSystemOperationsWithThreads.java | 720 +++++++++++++++++++
.../src/test/resources/log4j.properties | 4 +-
7 files changed, 1307 insertions(+), 99 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2ed58c40/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureFileSystemThreadPoolExecutor.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureFileSystemThreadPoolExecutor.java b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureFileSystemThreadPoolExecutor.java
new file mode 100644
index 0000000..a9be8c5
--- /dev/null
+++ b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureFileSystemThreadPoolExecutor.java
@@ -0,0 +1,346 @@
+/**
+ * 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.hadoop.fs.azure;
+
+import java.io.IOException;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.hadoop.util.Time;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.VisibleForTesting;
+
+class AzureFileSystemThreadPoolExecutor {
+
+ public static final Logger LOG = LoggerFactory.getLogger(AzureFileSystemThreadPoolExecutor.class);
+
+ /*
+ * Number of threads to keep in the pool.
+ */
+ private int threadCount;
+
+ /*
+ * Prefix to be used for naming threads.
+ */
+ private String threadNamePrefix;
+
+ /*
+ * File system operation like delete/rename. Used for logging purpose.
+ */
+ private String operation;
+
+ /*
+ * Source blob key used for file operation. Used for logging purpose.
+ */
+ private String key;
+
+ /*
+ * Configuration name for recommendations. Used for logging purpose.
+ */
+ private String config;
+
+ /**
+ * Creates a new AzureFileSystemThreadPoolExecutor object.
+ *
+ * @param threadCount
+ * Number of threads to be used after reading user configuration.
+ * @param threadNamePrefix
+ * Prefix to be used to name threads for the file operation.
+ * @param operation
+ * File system operation like delete/rename. Used for logging purpose.
+ * @param key
+ * Source blob key used for file operation. Used for logging purpose.
+ * @param config
+ * Configuration name for recommendations. Used for logging purpose.
+ */
+ public AzureFileSystemThreadPoolExecutor(int threadCount, String threadNamePrefix,
+ String operation, String key, String config) {
+ this.threadCount = threadCount;
+ this.threadNamePrefix = threadNamePrefix;
+ this.operation = operation;
+ this.key = key;
+ this.config = config;
+ }
+
+ /**
+ * Gets a new thread pool
+ * @param threadCount
+ * Number of threads to keep in the pool.
+ * @param threadNamePrefix
+ * Prefix to be used for naming threads.
+ *
+ * @return
+ * Returns a new thread pool.
+ */
+ @VisibleForTesting
+ ThreadPoolExecutor getThreadPool(int threadCount) throws Exception {
+ return new ThreadPoolExecutor(threadCount, threadCount, 2, TimeUnit.SECONDS,
+ new LinkedBlockingQueue<Runnable>(), new AzureFileSystemThreadFactory(this.threadNamePrefix));
+ }
+
+ /**
+ * Execute the file operation parallel using threads. All threads works on a
+ * single working set of files stored in input 'contents'. The synchronization
+ * between multiple threads is achieved through retrieving atomic index value
+ * from the array. Once thread gets the index, it retrieves the file and initiates
+ * the file operation. The advantage with this method is that file operations
+ * doesn't get serialized due to any thread. Also, the input copy is not changed
+ * such that caller can reuse the list for other purposes.
+ *
+ * This implementation also considers that failure of operation on single file
+ * is considered as overall operation failure. All threads bail out their execution
+ * as soon as they detect any single thread either got exception or operation is failed.
+ *
+ * @param contents
+ * List of blobs on which operation to be done.
+ * @param threadOperation
+ * The actual operation to be executed by each thread on a file.
+ *
+ * @param operationStatus
+ * Returns true if the operation is success, false if operation is failed.
+ * @throws IOException
+ *
+ */
+ boolean executeParallel(FileMetadata[] contents, AzureFileSystemThreadTask threadOperation) throws IOException {
+
+ boolean operationStatus = false;
+ boolean threadsEnabled = false;
+ int threadCount = this.threadCount;
+ ThreadPoolExecutor ioThreadPool = null;
+
+ // Start time for file operation
+ long start = Time.monotonicNow();
+
+ // If number of files are less then reduce threads to file count.
+ threadCount = Math.min(contents.length, threadCount);
+
+ if (threadCount > 1) {
+ try {
+ ioThreadPool = getThreadPool(threadCount);
+ threadsEnabled = true;
+ } catch(Exception e) {
+ // The possibility of this scenario is very remote. Added this code as safety net.
+ LOG.warn("Failed to create thread pool with threads {} for operation {} on blob {}."
+ + " Use config {} to set less number of threads. Setting config value to <= 1 will disable threads.",
+ threadCount, operation, key, config);
+ }
+ } else {
+ LOG.warn("Disabling threads for {} operation as thread count {} is <= 1", operation, threadCount);
+ }
+
+ if (threadsEnabled) {
+ LOG.debug("Using thread pool for {} operation with threads {}", operation, threadCount);
+ boolean started = false;
+ AzureFileSystemThreadRunnable runnable = new AzureFileSystemThreadRunnable(contents, threadOperation, operation);
+
+ // Don't start any new requests if there is an exception from any one thread.
+ for (int i = 0; i < threadCount && runnable.lastException == null && runnable.operationStatus; i++)
+ {
+ try {
+ ioThreadPool.execute(runnable);
+ started = true;
+ } catch (RejectedExecutionException ex) {
+ // If threads can't be scheduled then report error and move ahead with next thread.
+ // Don't fail operation due to this issue.
+ LOG.error("Rejected execution of thread for {} operation on blob {}."
+ + " Continuing with existing threads. Use config {} to set less number of threads"
+ + " to avoid this error", operation, key, config);
+ }
+ }
+
+ // Stop accepting any new execute requests.
+ ioThreadPool.shutdown();
+
+ try {
+ // Wait for threads to terminate. Keep time out as large value
+ ioThreadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
+ } catch(InterruptedException intrEx) {
+ // If current thread got interrupted then shutdown all threads now.
+ ioThreadPool.shutdownNow();
+
+ // Restore the interrupted status
+ Thread.currentThread().interrupt();
+ LOG.error("Threads got interrupted {} blob operation for {} "
+ , operation, key);
+ }
+
+ int threadsNotUsed = threadCount - runnable.threadsUsed.get();
+ if (threadsNotUsed > 0) {
+ LOG.warn("{} threads not used for {} operation on blob {}", threadsNotUsed, operation, key);
+ }
+
+ if (!started) {
+ // No threads started. Fall back to serial mode.
+ threadsEnabled = false;
+ LOG.info("Not able to schedule threads to {} blob {}. Fall back to {} blob serially."
+ , operation, key, operation);
+ } else {
+ IOException lastException = runnable.lastException;
+
+ // There are no exceptions from threads and no operation failures. Consider this scenario
+ // as failure only if file operations are not done on all files.
+ if (lastException == null && runnable.operationStatus && runnable.filesProcessed.get() < contents.length) {
+ LOG.error("{} failed as operation on subfolders and files failed.", operation);
+ lastException = new IOException(operation + " failed as operation on subfolders and files failed.");
+ }
+
+ if (lastException != null) {
+ // Threads started and executed. One or more threads seems to have hit exception.
+ // Raise the same exception.
+ throw lastException;
+ }
+
+ operationStatus = runnable.operationStatus;
+ }
+ }
+
+ if (!threadsEnabled) {
+ // No threads. Serialize the operation. Clear any last exceptions.
+ LOG.debug("Serializing the {} operation", operation);
+ for (int i = 0; i < contents.length; i++) {
+ if (!threadOperation.execute(contents[i])) {
+ LOG.warn("Failed to {} file {}", operation, contents[i]);
+ return false;
+ }
+ }
+
+ // Operation is success
+ operationStatus = true;
+ }
+
+ // Find the duration of time taken for file operation
+ long end = Time.monotonicNow();
+ LOG.info("Time taken for {} operation is: {} ms with threads: {}", operation, (end - start), threadCount);
+
+ return operationStatus;
+ }
+
+ /**
+ * A ThreadFactory for Azure File operation threads with meaningful names helpful
+ * for debugging purposes.
+ */
+ static class AzureFileSystemThreadFactory implements ThreadFactory {
+
+ private String threadIdPrefix = "AzureFileSystemThread";
+
+ /**
+ * Atomic integer to provide thread id for thread names.
+ */
+ private AtomicInteger threadSequenceNumber = new AtomicInteger(0);
+
+ public AzureFileSystemThreadFactory(String prefix) {
+ threadIdPrefix = prefix;
+ }
+
+ @Override
+ public Thread newThread(Runnable r) {
+ Thread t = new Thread(r);
+
+ // Use current thread name as part in naming thread such that use of
+ // same file system object will have unique names.
+ t.setName(String.format("%s-%s-%d", threadIdPrefix, Thread.currentThread().getName(),
+ threadSequenceNumber.getAndIncrement()));
+ return t;
+ }
+
+ }
+
+ static class AzureFileSystemThreadRunnable implements Runnable {
+
+ // Tracks if any thread has raised exception.
+ private volatile IOException lastException = null;
+
+ // Tracks if any thread has failed execution.
+ private volatile boolean operationStatus = true;
+
+ // Atomic tracker to retrieve index of next file to be processed
+ private AtomicInteger fileIndex = new AtomicInteger(0);
+
+ // Atomic tracker to count number of files successfully processed
+ private AtomicInteger filesProcessed = new AtomicInteger(0);
+
+ // Atomic tracker to retrieve number of threads used to do at least one file operation.
+ private AtomicInteger threadsUsed = new AtomicInteger(0);
+
+ // Type of file system operation
+ private String operation = "Unknown";
+
+ // List of files to be processed.
+ private final FileMetadata[] files;
+
+ // Thread task which encapsulates the file system operation work on a file.
+ private AzureFileSystemThreadTask task;
+
+ public AzureFileSystemThreadRunnable(final FileMetadata[] files,
+ AzureFileSystemThreadTask task, String operation) {
+ this.operation = operation;
+ this.files = files;
+ this.task = task;
+ }
+
+ @Override
+ public void run() {
+ long start = Time.monotonicNow();
+ int currentIndex;
+ int processedFilesCount = 0;
+
+ while ((currentIndex = fileIndex.getAndIncrement()) < files.length) {
+ processedFilesCount++;
+ FileMetadata file = files[currentIndex];
+
+ try {
+ // Execute the file operation.
+ if (!task.execute(file)) {
+ LOG.error("{} operation failed for file {}",
+ this.operation, file.getKey());
+ operationStatus = false;
+ } else {
+ filesProcessed.getAndIncrement();
+ }
+ } catch (Exception e) {
+ LOG.error("Encountered Exception for {} operation for file {}",
+ this.operation, file.getKey());
+ lastException = new IOException("Encountered Exception for "
+ + this.operation + " operation for file " + file.getKey(), e);
+ }
+
+ // If any thread has seen exception or operation failed then we
+ // don't have to process further.
+ if (lastException != null || !operationStatus) {
+ LOG.warn("Terminating execution of {} operation now as some other thread"
+ + " already got exception or operation failed", this.operation, file.getKey());
+ break;
+ }
+ }
+
+ long end = Time.monotonicNow();
+ LOG.debug("Time taken to process {} files count for {} operation: {} ms",
+ processedFilesCount, this.operation, (end - start));
+ if (processedFilesCount > 0) {
+ threadsUsed.getAndIncrement();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2ed58c40/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureFileSystemThreadTask.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureFileSystemThreadTask.java b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureFileSystemThreadTask.java
new file mode 100644
index 0000000..f518090
--- /dev/null
+++ b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureFileSystemThreadTask.java
@@ -0,0 +1,29 @@
+/**
+ * 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.hadoop.fs.azure;
+
+import java.io.IOException;
+
+/**
+ * Interface for executing the file operation by a thread.
+ */
+public interface AzureFileSystemThreadTask {
+ // Execute the operation on the file.
+ boolean execute(FileMetadata file) throws IOException;
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2ed58c40/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureNativeFileSystemStore.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureNativeFileSystemStore.java b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureNativeFileSystemStore.java
index e261c4d..2615174 100644
--- a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureNativeFileSystemStore.java
+++ b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureNativeFileSystemStore.java
@@ -182,6 +182,12 @@ public class AzureNativeFileSystemStore implements NativeFileSystemStore {
"fs.azure.atomic.rename.dir";
/**
+ * Configuration key to enable flat listing of blobs. This config is useful
+ * only if listing depth is AZURE_UNBOUNDED_DEPTH.
+ */
+ public static final String KEY_ENABLE_FLAT_LISTING = "fs.azure.flatlist.enable";
+
+ /**
* The set of directories where we should apply atomic folder rename
* synchronized with createNonRecursive.
*/
@@ -224,6 +230,11 @@ public class AzureNativeFileSystemStore implements NativeFileSystemStore {
private static final int STORAGE_CONNECTION_TIMEOUT_DEFAULT = 90;
+ /**
+ * Enable flat listing of blobs as default option. This is useful only if
+ * listing depth is AZURE_UNBOUNDED_DEPTH.
+ */
+ public static final boolean DEFAULT_ENABLE_FLAT_LISTING = false;
/**
* MEMBER VARIABLES
@@ -1614,15 +1625,17 @@ public class AzureNativeFileSystemStore implements NativeFileSystemStore {
* @param includeMetadata
* if set, the listed items will have their metadata populated
* already.
- *
+ * @param useFlatBlobListing
+ * if set the list is flat, otherwise it is hierarchical.
+ *
* @returns blobItems : iterable collection of blob items.
* @throws URISyntaxException
*
*/
- private Iterable<ListBlobItem> listRootBlobs(boolean includeMetadata)
- throws StorageException, URISyntaxException {
+ private Iterable<ListBlobItem> listRootBlobs(boolean includeMetadata,
+ boolean useFlatBlobListing) throws StorageException, URISyntaxException {
return rootDirectory.listBlobs(
- null, false,
+ null, useFlatBlobListing,
includeMetadata ?
EnumSet.of(BlobListingDetails.METADATA) :
EnumSet.noneOf(BlobListingDetails.class),
@@ -1642,16 +1655,18 @@ public class AzureNativeFileSystemStore implements NativeFileSystemStore {
* @param includeMetadata
* if set, the listed items will have their metadata populated
* already.
+ * @param useFlatBlobListing
+ * if set the list is flat, otherwise it is hierarchical.
*
* @returns blobItems : iterable collection of blob items.
* @throws URISyntaxException
*
*/
- private Iterable<ListBlobItem> listRootBlobs(String aPrefix,
- boolean includeMetadata) throws StorageException, URISyntaxException {
+ private Iterable<ListBlobItem> listRootBlobs(String aPrefix, boolean includeMetadata,
+ boolean useFlatBlobListing) throws StorageException, URISyntaxException {
Iterable<ListBlobItem> list = rootDirectory.listBlobs(aPrefix,
- false,
+ useFlatBlobListing,
includeMetadata ?
EnumSet.of(BlobListingDetails.METADATA) :
EnumSet.noneOf(BlobListingDetails.class),
@@ -2049,11 +2064,19 @@ public class AzureNativeFileSystemStore implements NativeFileSystemStore {
prefix += PATH_DELIMITER;
}
+ // Enable flat listing option only if depth is unbounded and config
+ // KEY_ENABLE_FLAT_LISTING is enabled.
+ boolean enableFlatListing = false;
+ if (maxListingDepth < 0 && sessionConfiguration.getBoolean(
+ KEY_ENABLE_FLAT_LISTING, DEFAULT_ENABLE_FLAT_LISTING)) {
+ enableFlatListing = true;
+ }
+
Iterable<ListBlobItem> objects;
if (prefix.equals("/")) {
- objects = listRootBlobs(true);
+ objects = listRootBlobs(true, enableFlatListing);
} else {
- objects = listRootBlobs(prefix, true);
+ objects = listRootBlobs(prefix, true, enableFlatListing);
}
ArrayList<FileMetadata> fileMetadata = new ArrayList<FileMetadata>();
@@ -2121,10 +2144,12 @@ public class AzureNativeFileSystemStore implements NativeFileSystemStore {
fileMetadata.add(directoryMetadata);
}
- // Currently at a depth of one, decrement the listing depth for
- // sub-directories.
- buildUpList(directory, fileMetadata, maxListingCount,
- maxListingDepth - 1);
+ if (!enableFlatListing) {
+ // Currently at a depth of one, decrement the listing depth for
+ // sub-directories.
+ buildUpList(directory, fileMetadata, maxListingCount,
+ maxListingDepth - 1);
+ }
}
}
// Note: Original code indicated that this may be a hack.
@@ -2632,7 +2657,7 @@ public class AzureNativeFileSystemStore implements NativeFileSystemStore {
}
// Get all blob items with the given prefix from the container and delete
// them.
- Iterable<ListBlobItem> objects = listRootBlobs(prefix, false);
+ Iterable<ListBlobItem> objects = listRootBlobs(prefix, false, false);
for (ListBlobItem blobItem : objects) {
((CloudBlob) blobItem).delete(DeleteSnapshotsOption.NONE, null, null,
getInstrumentedContext());
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2ed58c40/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/NativeAzureFileSystem.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/NativeAzureFileSystem.java b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/NativeAzureFileSystem.java
index a832143..fb0d31f 100644
--- a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/NativeAzureFileSystem.java
+++ b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/NativeAzureFileSystem.java
@@ -59,23 +59,21 @@ import org.apache.hadoop.fs.azure.metrics.AzureFileSystemInstrumentation;
import org.apache.hadoop.fs.azure.metrics.AzureFileSystemMetricsSystem;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.fs.permission.PermissionStatus;
-import org.apache.hadoop.fs.azure.AzureException;
+import org.apache.hadoop.io.IOUtils;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.util.Progressable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.hadoop.util.Time;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.annotations.VisibleForTesting;
import com.microsoft.azure.storage.StorageException;
-
-import org.apache.hadoop.io.IOUtils;
-
/**
* A {@link FileSystem} for reading and writing files stored on <a
* href="http://store.azure.com/">Windows Azure</a>. This implementation is
@@ -90,6 +88,7 @@ public class NativeAzureFileSystem extends FileSystem {
* A description of a folder rename operation, including the source and
* destination keys, and descriptions of the files in the source folder.
*/
+
public static class FolderRenamePending {
private SelfRenewingLease folderLease;
private String srcKey;
@@ -112,6 +111,7 @@ public class NativeAzureFileSystem extends FileSystem {
ArrayList<FileMetadata> fileMetadataList = new ArrayList<FileMetadata>();
// List all the files in the folder.
+ long start = Time.monotonicNow();
String priorLastKey = null;
do {
PartialListing listing = fs.getStoreInterface().listAll(srcKey, AZURE_LIST_ALL,
@@ -122,6 +122,9 @@ public class NativeAzureFileSystem extends FileSystem {
priorLastKey = listing.getPriorLastKey();
} while (priorLastKey != null);
fileMetadata = fileMetadataList.toArray(new FileMetadata[fileMetadataList.size()]);
+ long end = Time.monotonicNow();
+ LOG.debug("Time taken to list {} blobs for rename operation is: {} ms", fileMetadata.length, (end - start));
+
this.committed = true;
}
@@ -419,23 +422,18 @@ public class NativeAzureFileSystem extends FileSystem {
*/
public void execute() throws IOException {
- for (FileMetadata file : this.getFiles()) {
-
- // Rename all materialized entries under the folder to point to the
- // final destination.
- if (file.getBlobMaterialization() == BlobMaterialization.Explicit) {
- String srcName = file.getKey();
- String suffix = srcName.substring((this.getSrcKey()).length());
- String dstName = this.getDstKey() + suffix;
-
- // Rename gets exclusive access (via a lease) for files
- // designated for atomic rename.
- // The main use case is for HBase write-ahead log (WAL) and data
- // folder processing correctness. See the rename code for details.
- boolean acquireLease = fs.getStoreInterface().isAtomicRenameKey(srcName);
- fs.getStoreInterface().rename(srcName, dstName, acquireLease, null);
+ AzureFileSystemThreadTask task = new AzureFileSystemThreadTask() {
+ @Override
+ public boolean execute(FileMetadata file) throws IOException{
+ renameFile(file);
+ return true;
}
- }
+ };
+
+ AzureFileSystemThreadPoolExecutor executor = this.fs.getThreadPoolExecutor(this.fs.renameThreadCount,
+ "AzureBlobRenameThread", "Rename", getSrcKey(), AZURE_RENAME_THREADS);
+
+ executor.executeParallel(this.getFiles(), task);
// Rename the source folder 0-byte root file itself.
FileMetadata srcMetadata2 = this.getSourceMetadata();
@@ -454,6 +452,25 @@ public class NativeAzureFileSystem extends FileSystem {
fs.updateParentFolderLastModifiedTime(dstKey);
}
+ // Rename a single file
+ @VisibleForTesting
+ void renameFile(FileMetadata file) throws IOException{
+ // Rename all materialized entries under the folder to point to the
+ // final destination.
+ if (file.getBlobMaterialization() == BlobMaterialization.Explicit) {
+ String srcName = file.getKey();
+ String suffix = srcName.substring((this.getSrcKey()).length());
+ String dstName = this.getDstKey() + suffix;
+
+ // Rename gets exclusive access (via a lease) for files
+ // designated for atomic rename.
+ // The main use case is for HBase write-ahead log (WAL) and data
+ // folder processing correctness. See the rename code for details.
+ boolean acquireLease = this.fs.getStoreInterface().isAtomicRenameKey(srcName);
+ this.fs.getStoreInterface().rename(srcName, dstName, acquireLease, null);
+ }
+ }
+
/** Clean up after execution of rename.
* @throws IOException */
public void cleanup() throws IOException {
@@ -662,6 +679,36 @@ public class NativeAzureFileSystem extends FileSystem {
*/
public static final String APPEND_SUPPORT_ENABLE_PROPERTY_NAME = "fs.azure.enable.append.support";
+ /**
+ * The configuration property to set number of threads to be used for rename operation.
+ */
+ public static final String AZURE_RENAME_THREADS = "fs.azure.rename.threads";
+
+ /**
+ * The default number of threads to be used for rename operation.
+ */
+ public static final int DEFAULT_AZURE_RENAME_THREADS = 0;
+
+ /**
+ * The configuration property to set number of threads to be used for delete operation.
+ */
+ public static final String AZURE_DELETE_THREADS = "fs.azure.delete.threads";
+
+ /**
+ * The default number of threads to be used for delete operation.
+ */
+ public static final int DEFAULT_AZURE_DELETE_THREADS = 0;
+
+ /**
+ * The number of threads to be used for delete operation after reading user configuration.
+ */
+ private int deleteThreadCount = 0;
+
+ /**
+ * The number of threads to be used for rename operation after reading user configuration.
+ */
+ private int renameThreadCount = 0;
+
private class NativeAzureFsInputStream extends FSInputStream {
private InputStream in;
private final String key;
@@ -1172,6 +1219,9 @@ public class NativeAzureFileSystem extends FileSystem {
LOG.debug(" blockSize = {}",
conf.getLong(AZURE_BLOCK_SIZE_PROPERTY_NAME, MAX_AZURE_BLOCK_SIZE));
+ // Initialize thread counts from user configuration
+ deleteThreadCount = conf.getInt(AZURE_DELETE_THREADS, DEFAULT_AZURE_DELETE_THREADS);
+ renameThreadCount = conf.getInt(AZURE_RENAME_THREADS, DEFAULT_AZURE_RENAME_THREADS);
}
private NativeFileSystemStore createDefaultStore(Configuration conf) {
@@ -1779,77 +1829,65 @@ public class NativeAzureFileSystem extends FileSystem {
// List all the blobs in the current folder.
String priorLastKey = null;
- PartialListing listing = null;
- try {
- listing = store.listAll(key, AZURE_LIST_ALL, 1,
- priorLastKey);
- } catch(IOException e) {
-
- Throwable innerException = NativeAzureFileSystemHelper.checkForAzureStorageException(e);
-
- if (innerException instanceof StorageException
- && NativeAzureFileSystemHelper.isFileNotFoundException((StorageException) innerException)) {
- return false;
- }
-
- throw e;
- }
-
- if (listing == null) {
- return false;
- }
- FileMetadata[] contents = listing.getFiles();
- if (!recursive && contents.length > 0) {
- // The folder is non-empty and recursive delete was not specified.
- // Throw an exception indicating that a non-recursive delete was
- // specified for a non-empty folder.
- throw new IOException("Non-recursive delete of non-empty directory "
- + f.toString());
- }
-
- // Delete all the files in the folder.
- for (FileMetadata p : contents) {
- // Tag on the directory name found as the suffix of the suffix of the
- // parent directory to get the new absolute path.
- String suffix = p.getKey().substring(
- p.getKey().lastIndexOf(PATH_DELIMITER));
- if (!p.isDir()) {
- try {
- store.delete(key + suffix);
- instrumentation.fileDeleted();
- } catch(IOException e) {
-
- Throwable innerException = NativeAzureFileSystemHelper.checkForAzureStorageException(e);
-
- if (innerException instanceof StorageException
- && NativeAzureFileSystemHelper.isFileNotFoundException((StorageException) innerException)) {
- return false;
- }
+ // Start time for list operation
+ long start = Time.monotonicNow();
+ ArrayList<FileMetadata> fileMetadataList = new ArrayList<FileMetadata>();
- throw e;
+ // List all the files in the folder with AZURE_UNBOUNDED_DEPTH depth.
+ do {
+ try {
+ PartialListing listing = store.listAll(key, AZURE_LIST_ALL,
+ AZURE_UNBOUNDED_DEPTH, priorLastKey);
+ for(FileMetadata file : listing.getFiles()) {
+ fileMetadataList.add(file);
}
- } else {
- // Recursively delete contents of the sub-folders. Notice this also
- // deletes the blob for the directory.
- if (!delete(new Path(f.toString() + suffix), true)) {
+ priorLastKey = listing.getPriorLastKey();
+ } catch (IOException e) {
+ Throwable innerException = NativeAzureFileSystemHelper.checkForAzureStorageException(e);
+
+ if (innerException instanceof StorageException
+ && NativeAzureFileSystemHelper.isFileNotFoundException((StorageException) innerException)) {
return false;
}
+
+ throw e;
}
- }
+ } while (priorLastKey != null);
- try {
- store.delete(key);
- } catch(IOException e) {
+ long end = Time.monotonicNow();
+ LOG.debug("Time taken to list {} blobs for delete operation: {} ms", fileMetadataList.size(), (end - start));
- Throwable innerException = NativeAzureFileSystemHelper.checkForAzureStorageException(e);
+ final FileMetadata[] contents = fileMetadataList.toArray(new FileMetadata[fileMetadataList.size()]);
- if (innerException instanceof StorageException
- && NativeAzureFileSystemHelper.isFileNotFoundException((StorageException) innerException)) {
- return false;
+ if (!recursive && contents.length > 0) {
+ // The folder is non-empty and recursive delete was not specified.
+ // Throw an exception indicating that a non-recursive delete was
+ // specified for a non-empty folder.
+ throw new IOException("Non-recursive delete of non-empty directory "
+ + f.toString());
+ }
+
+ // Delete all files / folders in current directory stored as list in 'contents'.
+ AzureFileSystemThreadTask task = new AzureFileSystemThreadTask() {
+ @Override
+ public boolean execute(FileMetadata file) throws IOException{
+ return deleteFile(file.getKey(), file.isDir());
}
+ };
- throw e;
+ AzureFileSystemThreadPoolExecutor executor = getThreadPoolExecutor(this.deleteThreadCount,
+ "AzureBlobDeleteThread", "Delete", key, AZURE_DELETE_THREADS);
+
+ if (!executor.executeParallel(contents, task)) {
+ LOG.error("Failed to delete files / subfolders in blob {}", key);
+ return false;
+ }
+
+ // Delete the current directory
+ if (!deleteFile(metaFile.getKey(), metaFile.isDir())) {
+ LOG.error("Failed delete directory {}", f.toString());
+ return false;
}
// Update parent directory last modified time
@@ -1859,7 +1897,6 @@ public class NativeAzureFileSystem extends FileSystem {
updateParentFolderLastModifiedTime(key);
}
}
- instrumentation.directoryDeleted();
}
// File or directory was successfully deleted.
@@ -1867,6 +1904,35 @@ public class NativeAzureFileSystem extends FileSystem {
return true;
}
+ public AzureFileSystemThreadPoolExecutor getThreadPoolExecutor(int threadCount,
+ String threadNamePrefix, String operation, String key, String config) {
+ return new AzureFileSystemThreadPoolExecutor(threadCount, threadNamePrefix, operation, key, config);
+ }
+
+ // Delete single file / directory from key.
+ @VisibleForTesting
+ boolean deleteFile(String key, boolean isDir) throws IOException {
+ try {
+ store.delete(key);
+ if (isDir) {
+ instrumentation.directoryDeleted();
+ } else {
+ instrumentation.fileDeleted();
+ }
+ } catch(IOException e) {
+ Throwable innerException = NativeAzureFileSystemHelper.checkForAzureStorageException(e);
+
+ if (innerException instanceof StorageException
+ && NativeAzureFileSystemHelper.isFileNotFoundException((StorageException) innerException)) {
+ return false;
+ }
+
+ throw e;
+ }
+
+ return true;
+ }
+
@Override
public FileStatus getFileStatus(Path f) throws FileNotFoundException, IOException {
@@ -2517,7 +2583,8 @@ public class NativeAzureFileSystem extends FileSystem {
* @param dstKey Destination folder name.
* @throws IOException
*/
- private FolderRenamePending prepareAtomicFolderRename(
+ @VisibleForTesting
+ FolderRenamePending prepareAtomicFolderRename(
String srcKey, String dstKey) throws IOException {
if (store.isAtomicRenameKey(srcKey)) {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2ed58c40/hadoop-tools/hadoop-azure/src/site/markdown/index.md
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-azure/src/site/markdown/index.md b/hadoop-tools/hadoop-azure/src/site/markdown/index.md
index 43c551c..5d71795 100644
--- a/hadoop-tools/hadoop-azure/src/site/markdown/index.md
+++ b/hadoop-tools/hadoop-azure/src/site/markdown/index.md
@@ -24,6 +24,7 @@
* [Atomic Folder Rename](#Atomic_Folder_Rename)
* [Accessing wasb URLs](#Accessing_wasb_URLs)
* [Append API Support and Configuration](#Append_API_Support_and_Configuration)
+ * [Multithread Support](#Multithread_Support)
* [Testing the hadoop-azure Module](#Testing_the_hadoop-azure_Module)
## <a name="Introduction" />Introduction
@@ -266,6 +267,24 @@ It becomes a responsibility of the application either to ensure single-threaded
file path, or rely on some external locking mechanism of its own. Failure to do so will result in
unexpected behavior.
+### <a name="Multithread_Support" />Multithread Support
+
+Rename and Delete blob operations on directories with large number of files and sub directories currently is very slow as these operations are done one blob at a time serially. These files and sub folders can be deleted or renamed parallel. Following configurations can be used to enable threads to do parallel processing
+
+To enable 10 threads for Delete operation. Set configuration value to 0 or 1 to disable threads. The default behavior is threads disabled.
+
+ <property>
+ <name>fs.azure.delete.threads</name>
+ <value>10</value>
+ </property>
+
+To enable 20 threads for Rename operation. Set configuration value to 0 or 1 to disable threads. The default behavior is threads disabled.
+
+ <property>
+ <name>fs.azure.rename.threads</name>
+ <value>20</value>
+ </property>
+
## <a name="Testing_the_hadoop-azure_Module" />Testing the hadoop-azure Module
The hadoop-azure module includes a full suite of unit tests. Most of the tests
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2ed58c40/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/TestFileSystemOperationsWithThreads.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/TestFileSystemOperationsWithThreads.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/TestFileSystemOperationsWithThreads.java
new file mode 100644
index 0000000..64316f6
--- /dev/null
+++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/TestFileSystemOperationsWithThreads.java
@@ -0,0 +1,720 @@
+/**
+ * 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.hadoop.fs.azure;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.commons.logging.impl.Log4JLogger;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.azure.NativeAzureFileSystem.FolderRenamePending;
+import org.apache.hadoop.test.GenericTestUtils.LogCapturer;
+import org.apache.log4j.Logger;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.mockito.Mockito;
+
+/**
+ * Tests the Native Azure file system (WASB) using parallel threads for rename and delete operations.
+ */
+public class TestFileSystemOperationsWithThreads extends AbstractWasbTestBase {
+
+ private final int renameThreads = 10;
+ private final int deleteThreads = 20;
+ private int iterations = 1;
+ private LogCapturer logs = null;
+
+ @Rule
+ public ExpectedException exception = ExpectedException.none();
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ Configuration conf = fs.getConf();
+
+ // By default enable parallel threads for rename and delete operations.
+ // Also enable flat listing of blobs for these operations.
+ conf.setInt(NativeAzureFileSystem.AZURE_RENAME_THREADS, renameThreads);
+ conf.setInt(NativeAzureFileSystem.AZURE_DELETE_THREADS, deleteThreads);
+ conf.setBoolean(AzureNativeFileSystemStore.KEY_ENABLE_FLAT_LISTING, true);
+
+ URI uri = fs.getUri();
+ fs.initialize(uri, conf);
+
+ // Capture logs
+ logs = LogCapturer.captureLogs(new Log4JLogger(Logger
+ .getRootLogger()));
+ }
+
+ /*
+ * Helper method to create sub directory and different types of files
+ * for multiple iterations.
+ */
+ private void createFolder(FileSystem fs, String root) throws Exception {
+ fs.mkdirs(new Path(root));
+ for (int i = 0; i < this.iterations; i++) {
+ fs.mkdirs(new Path(root + "/" + i));
+ fs.createNewFile(new Path(root + "/" + i + "/fileToRename"));
+ fs.createNewFile(new Path(root + "/" + i + "/file/to/rename"));
+ fs.createNewFile(new Path(root + "/" + i + "/file+to%rename"));
+ fs.createNewFile(new Path(root + "/fileToRename" + i));
+ }
+ }
+
+ /*
+ * Helper method to do rename operation and validate all files in source folder
+ * doesn't exists and similar files exists in new folder.
+ */
+ private void validateRenameFolder(FileSystem fs, String source, String dest) throws Exception {
+ // Create source folder with files.
+ createFolder(fs, source);
+ Path sourceFolder = new Path(source);
+ Path destFolder = new Path(dest);
+
+ // rename operation
+ assertTrue(fs.rename(sourceFolder, destFolder));
+ assertTrue(fs.exists(destFolder));
+
+ for (int i = 0; i < this.iterations; i++) {
+ // Check destination folder and files exists.
+ assertTrue(fs.exists(new Path(dest + "/" + i)));
+ assertTrue(fs.exists(new Path(dest + "/" + i + "/fileToRename")));
+ assertTrue(fs.exists(new Path(dest + "/" + i + "/file/to/rename")));
+ assertTrue(fs.exists(new Path(dest + "/" + i + "/file+to%rename")));
+ assertTrue(fs.exists(new Path(dest + "/fileToRename" + i)));
+
+ // Check source folder and files doesn't exists.
+ assertFalse(fs.exists(new Path(source + "/" + i)));
+ assertFalse(fs.exists(new Path(source + "/" + i + "/fileToRename")));
+ assertFalse(fs.exists(new Path(source + "/" + i + "/file/to/rename")));
+ assertFalse(fs.exists(new Path(source + "/" + i + "/file+to%rename")));
+ assertFalse(fs.exists(new Path(source + "/fileToRename" + i)));
+ }
+ }
+
+ /*
+ * Test case for rename operation with multiple threads and flat listing enabled.
+ */
+ @Test
+ public void testRenameSmallFolderWithThreads() throws Exception {
+
+ validateRenameFolder(fs, "root", "rootnew");
+
+ // With single iteration, we would have created 7 blobs.
+ int expectedThreadsCreated = Math.min(7, renameThreads);
+
+ // Validate from logs that threads are created.
+ String content = logs.getOutput();
+ assertTrue(content.contains("ms with threads: " + expectedThreadsCreated));
+
+ // Validate thread executions
+ for (int i = 0; i < expectedThreadsCreated; i++) {
+ assertTrue(content.contains("AzureBlobRenameThread-" + Thread.currentThread().getName() + "-" + i));
+ }
+
+ // Also ensure that we haven't spawned extra threads.
+ if (expectedThreadsCreated < renameThreads) {
+ for (int i = expectedThreadsCreated; i < renameThreads; i++) {
+ assertFalse(content.contains("AzureBlobRenameThread-" + Thread.currentThread().getName() + "-" + i));
+ }
+ }
+ }
+
+ /*
+ * Test case for rename operation with multiple threads and flat listing enabled.
+ */
+ @Test
+ public void testRenameLargeFolderWithThreads() throws Exception {
+
+ // Populate source folder with large number of files and directories.
+ this.iterations = 10;
+ validateRenameFolder(fs, "root", "rootnew");
+
+ // Validate from logs that threads are created.
+ String content = logs.getOutput();
+ assertTrue(content.contains("ms with threads: " + renameThreads));
+
+ // Validate thread executions
+ for (int i = 0; i < renameThreads; i++) {
+ assertTrue(content.contains("AzureBlobRenameThread-" + Thread.currentThread().getName() + "-" + i));
+ }
+ }
+
+ /*
+ * Test case for rename operation with threads disabled and flat listing enabled.
+ */
+ @Test
+ public void testRenameLargeFolderDisableThreads() throws Exception {
+ Configuration conf = fs.getConf();
+
+ // Number of threads set to 0 or 1 disables threads.
+ conf.setInt(NativeAzureFileSystem.AZURE_RENAME_THREADS, 0);
+ URI uri = fs.getUri();
+ fs.initialize(uri, conf);
+
+ // Populate source folder with large number of files and directories.
+ this.iterations = 10;
+ validateRenameFolder(fs, "root", "rootnew");
+
+ // Validate from logs that threads are disabled.
+ String content = logs.getOutput();
+ assertTrue(content.contains("Disabling threads for Rename operation as thread count 0"));
+
+ // Validate no thread executions
+ for (int i = 0; i < renameThreads; i++) {
+ assertFalse(content.contains("AzureBlobRenameThread-" + Thread.currentThread().getName() + "-" + i));
+ }
+ }
+
+ /*
+ * Test case for rename operation with threads and flat listing disabled.
+ */
+ @Test
+ public void testRenameSmallFolderDisableThreadsDisableFlatListing() throws Exception {
+ Configuration conf = fs.getConf();
+ conf = fs.getConf();
+
+ // Number of threads set to 0 or 1 disables threads.
+ conf.setInt(NativeAzureFileSystem.AZURE_RENAME_THREADS, 1);
+ conf.setBoolean(AzureNativeFileSystemStore.KEY_ENABLE_FLAT_LISTING, false);
+ URI uri = fs.getUri();
+ fs.initialize(uri, conf);
+
+ validateRenameFolder(fs, "root", "rootnew");
+
+ // Validate from logs that threads are disabled.
+ String content = logs.getOutput();
+ assertTrue(content.contains("Disabling threads for Rename operation as thread count 1"));
+
+ // Validate no thread executions
+ for (int i = 0; i < renameThreads; i++) {
+ assertFalse(content.contains("AzureBlobRenameThread-" + Thread.currentThread().getName() + "-" + i));
+ }
+ }
+
+ /*
+ * Helper method to do delete operation and validate all files in source folder
+ * doesn't exists after delete operation.
+ */
+ private void validateDeleteFolder(FileSystem fs, String source) throws Exception {
+ // Create folder with files.
+ createFolder(fs, "root");
+ Path sourceFolder = new Path(source);
+
+ // Delete operation
+ assertTrue(fs.delete(sourceFolder, true));
+ assertFalse(fs.exists(sourceFolder));
+
+ for (int i = 0; i < this.iterations; i++) {
+ // check that source folder and files doesn't exists
+ assertFalse(fs.exists(new Path(source + "/" + i)));
+ assertFalse(fs.exists(new Path(source + "/" + i + "/fileToRename")));
+ assertFalse(fs.exists(new Path(source + "/" + i + "/file/to/rename")));
+ assertFalse(fs.exists(new Path(source + "/" + i + "/file+to%rename")));
+ assertFalse(fs.exists(new Path(source + "/fileToRename" + i)));
+ }
+ }
+
+ /*
+ * Test case for delete operation with multiple threads and flat listing enabled.
+ */
+ @Test
+ public void testDeleteSmallFolderWithThreads() throws Exception {
+
+ validateDeleteFolder(fs, "root");
+
+ // With single iteration, we would have created 7 blobs.
+ int expectedThreadsCreated = Math.min(7, deleteThreads);
+
+ // Validate from logs that threads are enabled.
+ String content = logs.getOutput();
+ assertTrue(content.contains("ms with threads: " + expectedThreadsCreated));
+
+ // Validate thread executions
+ for (int i = 0; i < expectedThreadsCreated; i++) {
+ assertTrue(content.contains("AzureBlobDeleteThread-" + Thread.currentThread().getName() + "-" + i));
+ }
+
+ // Also ensure that we haven't spawned extra threads.
+ if (expectedThreadsCreated < deleteThreads) {
+ for (int i = expectedThreadsCreated; i < deleteThreads; i++) {
+ assertFalse(content.contains("AzureBlobDeleteThread-" + Thread.currentThread().getName() + "-" + i));
+ }
+ }
+ }
+
+ /*
+ * Test case for delete operation with multiple threads and flat listing enabled.
+ */
+ @Test
+ public void testDeleteLargeFolderWithThreads() throws Exception {
+ // Populate source folder with large number of files and directories.
+ this.iterations = 10;
+ validateDeleteFolder(fs, "root");
+
+ // Validate from logs that threads are enabled.
+ String content = logs.getOutput();
+ assertTrue(content.contains("ms with threads: " + deleteThreads));
+
+ // Validate thread executions
+ for (int i = 0; i < deleteThreads; i++) {
+ assertTrue(content.contains("AzureBlobDeleteThread-" + Thread.currentThread().getName() + "-" + i));
+ }
+ }
+
+ /*
+ * Test case for delete operation with threads disabled and flat listing enabled.
+ */
+ @Test
+ public void testDeleteLargeFolderDisableThreads() throws Exception {
+ Configuration conf = fs.getConf();
+ conf.setInt(NativeAzureFileSystem.AZURE_DELETE_THREADS, 0);
+ URI uri = fs.getUri();
+ fs.initialize(uri, conf);
+
+ // Populate source folder with large number of files and directories.
+ this.iterations = 10;
+ validateDeleteFolder(fs, "root");
+
+ // Validate from logs that threads are disabled.
+ String content = logs.getOutput();
+ assertTrue(content.contains("Disabling threads for Delete operation as thread count 0"));
+
+ // Validate no thread executions
+ for (int i = 0; i < deleteThreads; i++) {
+ assertFalse(content.contains("AzureBlobDeleteThread-" + Thread.currentThread().getName() + "-" + i));
+ }
+ }
+
+ /*
+ * Test case for rename operation with threads and flat listing disabled.
+ */
+ @Test
+ public void testDeleteSmallFolderDisableThreadsDisableFlatListing() throws Exception {
+ Configuration conf = fs.getConf();
+
+ // Number of threads set to 0 or 1 disables threads.
+ conf.setInt(NativeAzureFileSystem.AZURE_DELETE_THREADS, 1);
+ conf.setBoolean(AzureNativeFileSystemStore.KEY_ENABLE_FLAT_LISTING, false);
+ URI uri = fs.getUri();
+ fs.initialize(uri, conf);
+
+ validateDeleteFolder(fs, "root");
+
+ // Validate from logs that threads are disabled.
+ String content = logs.getOutput();
+ assertTrue(content.contains("Disabling threads for Delete operation as thread count 1"));
+
+ // Validate no thread executions
+ for (int i = 0; i < deleteThreads; i++) {
+ assertFalse(content.contains("AzureBlobDeleteThread-" + Thread.currentThread().getName() + "-" + i));
+ }
+ }
+
+ /*
+ * Test case for delete operation with multiple threads and flat listing enabled.
+ */
+ @Test
+ public void testDeleteThreadPoolExceptionFailure() throws Exception {
+
+ // Spy azure file system object and raise exception for new thread pool
+ NativeAzureFileSystem mockFs = Mockito.spy((NativeAzureFileSystem) fs);
+
+ String path = mockFs.pathToKey(mockFs.makeAbsolute(new Path("root")));
+
+ AzureFileSystemThreadPoolExecutor mockThreadPoolExecutor = Mockito.spy(
+ mockFs.getThreadPoolExecutor(deleteThreads, "AzureBlobDeleteThread", "Delete",
+ path, NativeAzureFileSystem.AZURE_DELETE_THREADS));
+ Mockito.when(mockThreadPoolExecutor.getThreadPool(7)).thenThrow(new Exception());
+
+ // With single iteration, we would have created 7 blobs resulting 7 threads.
+ Mockito.when(mockFs.getThreadPoolExecutor(deleteThreads, "AzureBlobDeleteThread", "Delete",
+ path, NativeAzureFileSystem.AZURE_DELETE_THREADS)).thenReturn(mockThreadPoolExecutor);
+
+ validateDeleteFolder(mockFs, "root");
+
+ // Validate from logs that threads are disabled.
+ String content = logs.getOutput();
+ assertTrue(content.contains("Failed to create thread pool with threads"));
+ assertTrue(content.contains("Serializing the Delete operation"));
+ }
+
+ /*
+ * Test case for delete operation with multiple threads and flat listing enabled.
+ */
+ @Test
+ public void testDeleteThreadPoolExecuteFailure() throws Exception {
+
+ // Mock thread pool executor to throw exception for all requests.
+ ThreadPoolExecutor mockThreadExecutor = Mockito.mock(ThreadPoolExecutor.class);
+ Mockito.doThrow(new RejectedExecutionException()).when(mockThreadExecutor).execute(Mockito.any(Runnable.class));
+
+ // Spy azure file system object and return mocked thread pool
+ NativeAzureFileSystem mockFs = Mockito.spy((NativeAzureFileSystem) fs);
+
+ String path = mockFs.pathToKey(mockFs.makeAbsolute(new Path("root")));
+
+ AzureFileSystemThreadPoolExecutor mockThreadPoolExecutor = Mockito.spy(
+ mockFs.getThreadPoolExecutor(deleteThreads, "AzureBlobDeleteThread", "Delete",
+ path, NativeAzureFileSystem.AZURE_DELETE_THREADS));
+ Mockito.when(mockThreadPoolExecutor.getThreadPool(7)).thenReturn(mockThreadExecutor);
+
+ // With single iteration, we would have created 7 blobs resulting 7 threads.
+ Mockito.when(mockFs.getThreadPoolExecutor(deleteThreads, "AzureBlobDeleteThread", "Delete",
+ path, NativeAzureFileSystem.AZURE_DELETE_THREADS)).thenReturn(mockThreadPoolExecutor);
+
+ validateDeleteFolder(mockFs, "root");
+
+ // Validate from logs that threads are disabled.
+ String content = logs.getOutput();
+ assertTrue(content.contains("Rejected execution of thread for Delete operation on blob"));
+ assertTrue(content.contains("Serializing the Delete operation"));
+ }
+
+ /*
+ * Test case for delete operation with multiple threads and flat listing enabled.
+ */
+ @Test
+ public void testDeleteThreadPoolExecuteSingleThreadFailure() throws Exception {
+
+ // Spy azure file system object and return mocked thread pool
+ NativeAzureFileSystem mockFs = Mockito.spy((NativeAzureFileSystem) fs);
+
+ // Spy a thread pool executor and link it to azure file system object.
+ String path = mockFs.pathToKey(mockFs.makeAbsolute(new Path("root")));
+ AzureFileSystemThreadPoolExecutor mockThreadPoolExecutor = Mockito.spy(
+ mockFs.getThreadPoolExecutor(deleteThreads, "AzureBlobDeleteThread", "Delete",
+ path, NativeAzureFileSystem.AZURE_DELETE_THREADS));
+
+ // With single iteration, we would have created 7 blobs resulting 7 threads.
+ Mockito.when(mockFs.getThreadPoolExecutor(deleteThreads, "AzureBlobDeleteThread", "Delete",
+ path, NativeAzureFileSystem.AZURE_DELETE_THREADS)).thenReturn(mockThreadPoolExecutor);
+
+ // Create a thread executor and link it to mocked thread pool executor object.
+ ThreadPoolExecutor mockThreadExecutor = Mockito.spy(mockThreadPoolExecutor.getThreadPool(7));
+ Mockito.when(mockThreadPoolExecutor.getThreadPool(7)).thenReturn(mockThreadExecutor);
+
+ // Mock thread executor to throw exception for all requests.
+ Mockito.doCallRealMethod().doThrow(new RejectedExecutionException()).when(mockThreadExecutor).execute(Mockito.any(Runnable.class));
+
+ validateDeleteFolder(mockFs, "root");
+
+ // Validate from logs that threads are enabled and unused threads.
+ String content = logs.getOutput();
+ assertTrue(content.contains("Using thread pool for Delete operation with threads 7"));
+ assertTrue(content.contains("6 threads not used for Delete operation on blob"));
+ }
+
+ /*
+ * Test case for delete operation with multiple threads and flat listing enabled.
+ */
+ @Test
+ public void testDeleteThreadPoolTerminationFailure() throws Exception {
+
+ // Spy azure file system object and return mocked thread pool
+ NativeAzureFileSystem mockFs = Mockito.spy((NativeAzureFileSystem) fs);
+
+ // Spy a thread pool executor and link it to azure file system object.
+ String path = mockFs.pathToKey(mockFs.makeAbsolute(new Path("root")));
+ AzureFileSystemThreadPoolExecutor mockThreadPoolExecutor = Mockito.spy(
+ ((NativeAzureFileSystem) fs).getThreadPoolExecutor(deleteThreads, "AzureBlobDeleteThread", "Delete",
+ path, NativeAzureFileSystem.AZURE_DELETE_THREADS));
+
+ // Create a thread executor and link it to mocked thread pool executor object.
+ // Mock thread executor to throw exception for terminating threads.
+ ThreadPoolExecutor mockThreadExecutor = Mockito.mock(ThreadPoolExecutor.class);
+ Mockito.doNothing().when(mockThreadExecutor).execute(Mockito.any(Runnable.class));
+ Mockito.when(mockThreadExecutor.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS)).thenThrow(new InterruptedException());
+
+ Mockito.when(mockThreadPoolExecutor.getThreadPool(7)).thenReturn(mockThreadExecutor);
+
+ // With single iteration, we would have created 7 blobs resulting 7 threads.
+ Mockito.when(mockFs.getThreadPoolExecutor(deleteThreads, "AzureBlobDeleteThread", "Delete",
+ path, NativeAzureFileSystem.AZURE_DELETE_THREADS)).thenReturn(mockThreadPoolExecutor);
+
+ createFolder(mockFs, "root");
+ Path sourceFolder = new Path("root");
+ boolean exception = false;
+ try {
+ mockFs.delete(sourceFolder, true);
+ } catch (IOException e){
+ exception = true;
+ }
+
+ assertTrue(exception);
+ assertTrue(mockFs.exists(sourceFolder));
+
+ // Validate from logs that threads are enabled and delete operation is failed.
+ String content = logs.getOutput();
+ assertTrue(content.contains("Using thread pool for Delete operation with threads"));
+ assertTrue(content.contains("Threads got interrupted Delete blob operation"));
+ assertTrue(content.contains("Delete failed as operation on subfolders and files failed."));
+ }
+
+ /*
+ * Test case for delete operation with multiple threads and flat listing enabled.
+ */
+ @Test
+ public void testDeleteSingleDeleteFailure() throws Exception {
+
+ // Spy azure file system object and return false for deleting one file
+ LOG.info("testDeleteSingleDeleteFailure");
+ NativeAzureFileSystem mockFs = Mockito.spy((NativeAzureFileSystem) fs);
+ String path = mockFs.pathToKey(mockFs.makeAbsolute(new Path("root/0")));
+ Mockito.when(mockFs.deleteFile(path, true)).thenReturn(false);
+
+ createFolder(mockFs, "root");
+ Path sourceFolder = new Path("root");
+ assertFalse(mockFs.delete(sourceFolder, true));
+ assertTrue(mockFs.exists(sourceFolder));
+
+ // Validate from logs that threads are enabled and delete operation failed.
+ String content = logs.getOutput();
+ assertTrue(content.contains("Using thread pool for Delete operation with threads"));
+ assertTrue(content.contains("Delete operation failed for file " + path));
+ assertTrue(content.contains("Terminating execution of Delete operation now as some other thread already got exception or operation failed"));
+ assertTrue(content.contains("Failed to delete files / subfolders in blob"));
+ }
+
+ /*
+ * Test case for delete operation with multiple threads and flat listing enabled.
+ */
+ @Test
+ public void testDeleteSingleDeleteException() throws Exception {
+
+ // Spy azure file system object and raise exception for deleting one file
+ NativeAzureFileSystem mockFs = Mockito.spy((NativeAzureFileSystem) fs);
+ String path = mockFs.pathToKey(mockFs.makeAbsolute(new Path("root/0")));
+ Mockito.doThrow(new IOException()).when(mockFs).deleteFile(path, true);
+
+ createFolder(mockFs, "root");
+ Path sourceFolder = new Path("root");
+
+ boolean exception = false;
+ try {
+ mockFs.delete(sourceFolder, true);
+ } catch (IOException e){
+ exception = true;
+ }
+
+ assertTrue(exception);
+ assertTrue(mockFs.exists(sourceFolder));
+
+ // Validate from logs that threads are enabled and delete operation failed.
+ String content = logs.getOutput();
+ assertTrue(content.contains("Using thread pool for Delete operation with threads"));
+ assertTrue(content.contains("Encountered Exception for Delete operation for file " + path));
+ assertTrue(content.contains("Terminating execution of Delete operation now as some other thread already got exception or operation failed"));
+ }
+
+ /*
+ * Test case for rename operation with multiple threads and flat listing enabled.
+ */
+ @Test
+ public void testRenameThreadPoolExceptionFailure() throws Exception {
+
+ // Spy azure file system object and raise exception for new thread pool
+ NativeAzureFileSystem mockFs = Mockito.spy((NativeAzureFileSystem) fs);
+
+ String path = mockFs.pathToKey(mockFs.makeAbsolute(new Path("root")));
+ AzureFileSystemThreadPoolExecutor mockThreadPoolExecutor = Mockito.spy(
+ ((NativeAzureFileSystem) fs).getThreadPoolExecutor(renameThreads, "AzureBlobRenameThread", "Rename",
+ path, NativeAzureFileSystem.AZURE_RENAME_THREADS));
+ Mockito.when(mockThreadPoolExecutor.getThreadPool(7)).thenThrow(new Exception());
+
+ // With single iteration, we would have created 7 blobs resulting 7 threads.
+ Mockito.doReturn(mockThreadPoolExecutor).when(mockFs).getThreadPoolExecutor(renameThreads, "AzureBlobRenameThread", "Rename",
+ path, NativeAzureFileSystem.AZURE_RENAME_THREADS);
+
+ validateRenameFolder(mockFs, "root", "rootnew");
+
+ // Validate from logs that threads are disabled.
+ String content = logs.getOutput();
+ assertTrue(content.contains("Failed to create thread pool with threads"));
+ assertTrue(content.contains("Serializing the Rename operation"));
+ }
+
+ /*
+ * Test case for rename operation with multiple threads and flat listing enabled.
+ */
+ @Test
+ public void testRenameThreadPoolExecuteFailure() throws Exception {
+
+ // Mock thread pool executor to throw exception for all requests.
+ ThreadPoolExecutor mockThreadExecutor = Mockito.mock(ThreadPoolExecutor.class);
+ Mockito.doThrow(new RejectedExecutionException()).when(mockThreadExecutor).execute(Mockito.any(Runnable.class));
+
+ // Spy azure file system object and return mocked thread pool
+ NativeAzureFileSystem mockFs = Mockito.spy((NativeAzureFileSystem) fs);
+
+ String path = mockFs.pathToKey(mockFs.makeAbsolute(new Path("root")));
+ AzureFileSystemThreadPoolExecutor mockThreadPoolExecutor = Mockito.spy(
+ mockFs.getThreadPoolExecutor(renameThreads, "AzureBlobRenameThread", "Rename",
+ path, NativeAzureFileSystem.AZURE_RENAME_THREADS));
+ Mockito.when(mockThreadPoolExecutor.getThreadPool(7)).thenReturn(mockThreadExecutor);
+
+ // With single iteration, we would have created 7 blobs resulting 7 threads.
+ Mockito.when(mockFs.getThreadPoolExecutor(renameThreads, "AzureBlobRenameThread", "Rename",
+ path, NativeAzureFileSystem.AZURE_RENAME_THREADS)).thenReturn(mockThreadPoolExecutor);
+
+ validateRenameFolder(mockFs, "root", "rootnew");
+
+ // Validate from logs that threads are disabled.
+ String content = logs.getOutput();
+ assertTrue(content.contains("Rejected execution of thread for Rename operation on blob"));
+ assertTrue(content.contains("Serializing the Rename operation"));
+ }
+
+ /*
+ * Test case for rename operation with multiple threads and flat listing enabled.
+ */
+ @Test
+ public void testRenameThreadPoolExecuteSingleThreadFailure() throws Exception {
+
+ // Spy azure file system object and return mocked thread pool
+ NativeAzureFileSystem mockFs = Mockito.spy((NativeAzureFileSystem) fs);
+
+ // Spy a thread pool executor and link it to azure file system object.
+ String path = mockFs.pathToKey(mockFs.makeAbsolute(new Path("root")));
+ AzureFileSystemThreadPoolExecutor mockThreadPoolExecutor = Mockito.spy(
+ mockFs.getThreadPoolExecutor(renameThreads, "AzureBlobRenameThread", "Rename",
+ path, NativeAzureFileSystem.AZURE_RENAME_THREADS));
+
+ // With single iteration, we would have created 7 blobs resulting 7 threads.
+ Mockito.when(mockFs.getThreadPoolExecutor(renameThreads, "AzureBlobRenameThread", "Rename",
+ path, NativeAzureFileSystem.AZURE_RENAME_THREADS)).thenReturn(mockThreadPoolExecutor);
+
+ // Create a thread executor and link it to mocked thread pool executor object.
+ ThreadPoolExecutor mockThreadExecutor = Mockito.spy(mockThreadPoolExecutor.getThreadPool(7));
+ Mockito.when(mockThreadPoolExecutor.getThreadPool(7)).thenReturn(mockThreadExecutor);
+
+ // Mock thread executor to throw exception for all requests.
+ Mockito.doCallRealMethod().doThrow(new RejectedExecutionException()).when(mockThreadExecutor).execute(Mockito.any(Runnable.class));
+
+ validateRenameFolder(mockFs, "root", "rootnew");
+
+ // Validate from logs that threads are enabled and unused threads exists.
+ String content = logs.getOutput();
+ assertTrue(content.contains("Using thread pool for Rename operation with threads 7"));
+ assertTrue(content.contains("6 threads not used for Rename operation on blob"));
+ }
+
+ /*
+ * Test case for rename operation with multiple threads and flat listing enabled.
+ */
+ @Test
+ public void testRenameThreadPoolTerminationFailure() throws Exception {
+
+ // Spy azure file system object and return mocked thread pool
+ NativeAzureFileSystem mockFs = Mockito.spy((NativeAzureFileSystem) fs);
+
+ // Spy a thread pool executor and link it to azure file system object.
+ String path = mockFs.pathToKey(mockFs.makeAbsolute(new Path("root")));
+ AzureFileSystemThreadPoolExecutor mockThreadPoolExecutor = Mockito.spy(
+ mockFs.getThreadPoolExecutor(renameThreads, "AzureBlobRenameThread", "Rename",
+ path, NativeAzureFileSystem.AZURE_RENAME_THREADS));
+
+ // With single iteration, we would have created 7 blobs resulting 7 threads.
+ Mockito.when(mockFs.getThreadPoolExecutor(renameThreads, "AzureBlobRenameThread", "Rename",
+ path, NativeAzureFileSystem.AZURE_RENAME_THREADS)).thenReturn(mockThreadPoolExecutor);
+
+ // Mock thread executor to throw exception for all requests.
+ ThreadPoolExecutor mockThreadExecutor = Mockito.mock(ThreadPoolExecutor.class);
+ Mockito.doNothing().when(mockThreadExecutor).execute(Mockito.any(Runnable.class));
+ Mockito.when(mockThreadExecutor.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS)).thenThrow(new InterruptedException());
+ Mockito.when(mockThreadPoolExecutor.getThreadPool(7)).thenReturn(mockThreadExecutor);
+
+
+ createFolder(mockFs, "root");
+ Path sourceFolder = new Path("root");
+ Path destFolder = new Path("rootnew");
+ boolean exception = false;
+ try {
+ mockFs.rename(sourceFolder, destFolder);
+ } catch (IOException e){
+ exception = true;
+ }
+
+ assertTrue(exception);
+ assertTrue(mockFs.exists(sourceFolder));
+
+ // Validate from logs that threads are enabled and rename operation is failed.
+ String content = logs.getOutput();
+ assertTrue(content.contains("Using thread pool for Rename operation with threads"));
+ assertTrue(content.contains("Threads got interrupted Rename blob operation"));
+ assertTrue(content.contains("Rename failed as operation on subfolders and files failed."));
+ }
+
+ /*
+ * Test case for rename operation with multiple threads and flat listing enabled.
+ */
+ @Test
+ public void testRenameSingleRenameException() throws Exception {
+
+ // Spy azure file system object and raise exception for deleting one file
+ Path sourceFolder = new Path("root");
+ Path destFolder = new Path("rootnew");
+
+ // Spy azure file system object and populate rename pending spy object.
+ NativeAzureFileSystem mockFs = Mockito.spy((NativeAzureFileSystem) fs);
+
+ // Populate data now only such that rename pending spy object would see this data.
+ createFolder(mockFs, "root");
+
+ String srcKey = mockFs.pathToKey(mockFs.makeAbsolute(sourceFolder));
+ String dstKey = mockFs.pathToKey(mockFs.makeAbsolute(destFolder));
+
+ FolderRenamePending mockRenameFs = Mockito.spy(mockFs.prepareAtomicFolderRename(srcKey, dstKey));
+ Mockito.when(mockFs.prepareAtomicFolderRename(srcKey, dstKey)).thenReturn(mockRenameFs);
+ String path = mockFs.pathToKey(mockFs.makeAbsolute(new Path("root/0")));
+ Mockito.doThrow(new IOException()).when(mockRenameFs).renameFile(Mockito.any(FileMetadata.class));
+
+ boolean exception = false;
+ try {
+ mockFs.rename(sourceFolder, destFolder);
+ } catch (IOException e){
+ exception = true;
+ }
+
+ assertTrue(exception);
+ assertTrue(mockFs.exists(sourceFolder));
+
+ // Validate from logs that threads are enabled and delete operation failed.
+ String content = logs.getOutput();
+ assertTrue(content.contains("Using thread pool for Rename operation with threads"));
+ assertTrue(content.contains("Encountered Exception for Rename operation for file " + path));
+ assertTrue(content.contains("Terminating execution of Rename operation now as some other thread already got exception or operation failed"));
+ }
+
+ @Override
+ protected AzureBlobStorageTestAccount createTestAccount() throws Exception {
+ return AzureBlobStorageTestAccount.create();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2ed58c40/hadoop-tools/hadoop-azure/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-azure/src/test/resources/log4j.properties b/hadoop-tools/hadoop-azure/src/test/resources/log4j.properties
index bb5cbe5..73ee3f9 100644
--- a/hadoop-tools/hadoop-azure/src/test/resources/log4j.properties
+++ b/hadoop-tools/hadoop-azure/src/test/resources/log4j.properties
@@ -20,4 +20,6 @@ log4j.rootLogger=INFO,stdout
log4j.threshold=ALL
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p [%t]: %c{2} (%F:%M(%L)) - %m%n
+
+log4j.logger.org.apache.hadoop.fs.azure.AzureFileSystemThreadPoolExecutor=DEBUG
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[50/50] [abbrv] hadoop git commit: YARN-4515. [YARN-3368] Support
hosting web UI framework inside YARN RM. (Sunil G via wangda) YARN-5000.
[YARN-3368] App attempt page is not loading when timeline server is not
started (Sunil G via wangda) YARN-5038. [YA
Posted by wa...@apache.org.
YARN-4515. [YARN-3368] Support hosting web UI framework inside YARN RM. (Sunil G via wangda)
YARN-5000. [YARN-3368] App attempt page is not loading when timeline server is not started (Sunil G via wangda)
YARN-5038. [YARN-3368] Application and Container pages shows wrong values when RM is stopped. (Sunil G via wangda)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/2a32d5d7
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/2a32d5d7
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/2a32d5d7
Branch: refs/heads/YARN-3368
Commit: 2a32d5d776f00557748ae185e6ab3f9bbf6f0ea4
Parents: ce84327
Author: Wangda Tan <wa...@apache.org>
Authored: Tue May 17 22:28:24 2016 -0700
Committer: Wangda Tan <wa...@apache.org>
Committed: Tue Aug 9 14:51:19 2016 -0700
----------------------------------------------------------------------
LICENSE.txt | 2 +
.../resources/assemblies/hadoop-yarn-dist.xml | 7 ++
.../hadoop/yarn/conf/YarnConfiguration.java | 23 ++++++
.../src/main/resources/yarn-default.xml | 26 +++++++
.../server/resourcemanager/ResourceManager.java | 76 +++++++++++++++++---
.../hadoop-yarn/hadoop-yarn-ui/pom.xml | 4 +-
.../webapp/app/adapters/yarn-app-attempt.js | 4 +-
.../webapp/app/adapters/yarn-container-log.js | 2 +-
.../main/webapp/app/adapters/yarn-node-app.js | 10 ++-
.../webapp/app/adapters/yarn-node-container.js | 10 ++-
.../src/main/webapp/app/adapters/yarn-node.js | 5 +-
.../main/webapp/app/components/timeline-view.js | 17 +++--
.../main/webapp/app/components/tree-selector.js | 4 +-
.../main/webapp/app/helpers/log-files-comma.js | 2 +-
.../src/main/webapp/app/helpers/node-link.js | 2 +-
.../src/main/webapp/app/helpers/node-menu.js | 6 +-
.../src/main/webapp/app/helpers/node-name.js | 46 ++++++++++++
.../main/webapp/app/models/yarn-app-attempt.js | 72 ++++++++++++++++++-
.../src/main/webapp/app/models/yarn-app.js | 14 ++++
.../main/webapp/app/models/yarn-container.js | 7 ++
.../main/webapp/app/routes/yarn-app-attempt.js | 6 +-
.../webapp/app/serializers/yarn-app-attempt.js | 5 +-
.../src/main/webapp/app/serializers/yarn-app.js | 11 ++-
.../webapp/app/serializers/yarn-container.js | 3 +-
.../webapp/app/serializers/yarn-node-app.js | 5 +-
.../app/serializers/yarn-node-container.js | 5 +-
.../main/webapp/app/serializers/yarn-rm-node.js | 5 +-
.../main/webapp/app/templates/application.hbs | 21 +++++-
.../templates/components/app-attempt-table.hbs | 22 +++++-
.../app/templates/components/app-table.hbs | 8 +--
.../templates/components/container-table.hbs | 4 +-
.../templates/components/node-menu-panel.hbs | 44 ++++++++++++
.../app/templates/components/timeline-view.hbs | 2 +-
.../src/main/webapp/app/templates/error.hbs | 2 +-
.../webapp/app/templates/yarn-app-attempt.hbs | 4 ++
.../src/main/webapp/app/templates/yarn-app.hbs | 2 +-
.../src/main/webapp/app/templates/yarn-apps.hbs | 9 ++-
.../main/webapp/app/templates/yarn-node-app.hbs | 4 +-
.../webapp/app/templates/yarn-node-apps.hbs | 12 ++--
.../app/templates/yarn-node-container.hbs | 2 +-
.../app/templates/yarn-node-containers.hbs | 12 ++--
.../src/main/webapp/app/templates/yarn-node.hbs | 2 +-
.../main/webapp/app/templates/yarn-nodes.hbs | 10 ++-
.../main/webapp/app/templates/yarn-queue.hbs | 8 ++-
.../src/main/webapp/config/environment.js | 2 +-
.../hadoop-yarn-ui/src/main/webapp/package.json | 2 +
.../webapp/tests/unit/helpers/node-name-test.js | 28 ++++++++
47 files changed, 486 insertions(+), 93 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/LICENSE.txt
----------------------------------------------------------------------
diff --git a/LICENSE.txt b/LICENSE.txt
index 45b6cdf..5efbd14 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1882,6 +1882,7 @@ The Apache Hadoop YARN Web UI component bundles the following files under the MI
- datatables v1.10.8 (https://datatables.net/)
- moment v2.10.6 (http://momentjs.com/) - Copyright (c) 2011-2015 Tim Wood, Iskren Chernev, Moment.js contributors
- em-helpers v0.5.8 (https://github.com/sreenaths/em-helpers)
+ - ember-array-contains-helper v1.0.2 (https://github.com/bmeurant/ember-array-contains-helper)
- ember-cli-app-version v0.5.8 (https://github.com/EmberSherpa/ember-cli-app-version) - Authored by Taras Mankovski <ta...@gmail.com>
- ember-cli-babel v5.1.6 (https://github.com/babel/ember-cli-babel) - Authored by Stefan Penner <st...@gmail.com>
- ember-cli-content-security-policy v0.4.0 (https://github.com/rwjblue/ember-cli-content-security-policy)
@@ -1895,6 +1896,7 @@ The Apache Hadoop YARN Web UI component bundles the following files under the MI
- ember-cli-sri v1.2.1 (https://github.com/jonathanKingston/ember-cli-sri) - Authored by Jonathan Kingston
- ember-cli-uglify v1.2.0 (github.com/ember-cli/ember-cli-uglify) - Authored by Robert Jackson <me...@rwjblue.com>
- ember-d3 v0.1.0 (https://github.com/brzpegasus/ember-d3) - Authored by Estelle DeBlois
+ - ember-truth-helpers v1.2.0 (https://github.com/jmurphyau/ember-truth-helpers)
- select2 v4.0.0 (https://select2.github.io/)
All rights reserved.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml
----------------------------------------------------------------------
diff --git a/hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml b/hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml
index 219ed81..c3f459c 100644
--- a/hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml
+++ b/hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml
@@ -192,6 +192,13 @@
<directory>${project.build.directory}/site</directory>
<outputDirectory>/share/doc/hadoop/${hadoop.component}</outputDirectory>
</fileSet>
+ <fileSet>
+ <directory>hadoop-yarn/hadoop-yarn-ui/target/hadoop-yarn-ui-${project.version}</directory>
+ <outputDirectory>/share/hadoop/${hadoop.component}/webapps/rm</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </fileSet>
</fileSets>
<moduleSets>
<moduleSet>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
index d1f410b..c8f35cd 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
@@ -262,7 +262,30 @@ public class YarnConfiguration extends Configuration {
public static final int DEFAULT_RM_WEBAPP_HTTPS_PORT = 8090;
public static final String DEFAULT_RM_WEBAPP_HTTPS_ADDRESS = "0.0.0.0:"
+ DEFAULT_RM_WEBAPP_HTTPS_PORT;
+
+ /**
+ * Enable YARN WebApp V2.
+ */
+ public static final String RM_WEBAPP_UI2_ENABLE = RM_PREFIX
+ + "webapp.ui2.enable";
+ public static final boolean DEFAULT_RM_WEBAPP_UI2_ENABLE = false;
+
+ /** The address of the RM web ui2 application. */
+ public static final String RM_WEBAPP_UI2_ADDRESS = RM_PREFIX
+ + "webapp.ui2.address";
+
+ public static final int DEFAULT_RM_WEBAPP_UI2_PORT = 8288;
+ public static final String DEFAULT_RM_WEBAPP_UI2_ADDRESS = "0.0.0.0:" +
+ DEFAULT_RM_WEBAPP_UI2_PORT;
+ /** The https address of the RM web ui2 application.*/
+ public static final String RM_WEBAPP_UI2_HTTPS_ADDRESS =
+ RM_PREFIX + "webapp.ui2.https.address";
+
+ public static final int DEFAULT_RM_WEBAPP_UI2_HTTPS_PORT = 8290;
+ public static final String DEFAULT_RM_WEBAPP_UI2_HTTPS_ADDRESS = "0.0.0.0:"
+ + DEFAULT_RM_WEBAPP_UI2_HTTPS_PORT;
+
public static final String RM_RESOURCE_TRACKER_ADDRESS =
RM_PREFIX + "resource-tracker.address";
public static final int DEFAULT_RM_RESOURCE_TRACKER_PORT = 8031;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml
index 7305283..862d03b 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml
@@ -180,6 +180,32 @@
</property>
<property>
+ <description>To enable RM web ui2 application.</description>
+ <name>yarn.resourcemanager.webapp.ui2.enable</name>
+ <value>false</value>
+ </property>
+
+ <property>
+ <description>
+ The http address of the RM web ui2 application.
+ If only a host is provided as the value,
+ the webapp will be served on a random port.
+ </description>
+ <name>yarn.resourcemanager.webapp.ui2.address</name>
+ <value>${yarn.resourcemanager.hostname}:8288</value>
+ </property>
+
+ <property>
+ <description>
+ The https address of the RM web ui2 application.
+ If only a host is provided as the value,
+ the webapp will be served on a random port.
+ </description>
+ <name>yarn.resourcemanager.webapp.ui2.https.address</name>
+ <value>${yarn.resourcemanager.hostname}:8290</value>
+ </property>
+
+ <property>
<name>yarn.resourcemanager.resource-tracker.address</name>
<value>${yarn.resourcemanager.hostname}:8031</value>
</property>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java
index bf72fc1..296455f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java
@@ -18,16 +18,6 @@
package org.apache.hadoop.yarn.server.resourcemanager;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintStream;
-import java.net.InetSocketAddress;
-import java.nio.charset.Charset;
-import java.security.PrivilegedExceptionAction;
-import java.security.SecureRandom;
-import java.util.ArrayList;
-import java.util.List;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.curator.framework.AuthInfo;
@@ -38,10 +28,12 @@ import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ha.HAServiceProtocol;
import org.apache.hadoop.ha.HAServiceProtocol.HAServiceState;
+import org.apache.hadoop.http.HttpServer2;
import org.apache.hadoop.http.lib.StaticUserWebFilter;
import org.apache.hadoop.metrics2.MetricsSystem;
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
import org.apache.hadoop.metrics2.source.JvmMetrics;
+import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.security.AuthenticationFilterInitializer;
import org.apache.hadoop.security.Groups;
import org.apache.hadoop.security.HttpCrossOriginFilterInitializer;
@@ -123,6 +115,16 @@ import org.apache.hadoop.yarn.webapp.util.WebAppUtils;
import org.apache.zookeeper.server.auth.DigestAuthenticationProvider;
import com.google.common.annotations.VisibleForTesting;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.net.InetSocketAddress;
+import java.net.URI;
+import java.nio.charset.Charset;
+import java.security.PrivilegedExceptionAction;
+import java.security.SecureRandom;
+import java.util.ArrayList;
+import java.util.List;
/**
* The ResourceManager is the main class that is a set of components.
@@ -904,7 +906,49 @@ public class ResourceManager extends CompositeService implements Recoverable {
}
}
}
-
+
+ /**
+ * Return a HttpServer.Builder that the journalnode / namenode / secondary
+ * namenode can use to initialize their HTTP / HTTPS server.
+ *
+ */
+ public static HttpServer2.Builder httpServerTemplateForRM(Configuration conf,
+ final InetSocketAddress httpAddr, final InetSocketAddress httpsAddr,
+ String name) throws IOException {
+ HttpServer2.Builder builder = new HttpServer2.Builder().setName(name)
+ .setConf(conf).setSecurityEnabled(false);
+
+ if (httpAddr.getPort() == 0) {
+ builder.setFindPort(true);
+ }
+
+ URI uri = URI.create("http://" + NetUtils.getHostPortString(httpAddr));
+ builder.addEndpoint(uri);
+ LOG.info("Starting Web-server for " + name + " at: " + uri);
+
+ return builder;
+ }
+
+ protected void startWebAppV2() throws IOException {
+ Configuration config = getConfig();
+ final InetSocketAddress httpAddr = config.getSocketAddr(
+ YarnConfiguration.RM_WEBAPP_UI2_ADDRESS,
+ YarnConfiguration.DEFAULT_RM_WEBAPP_UI2_ADDRESS,
+ YarnConfiguration.DEFAULT_RM_WEBAPP_UI2_PORT);
+ final InetSocketAddress httpsAddr = config.getSocketAddr(
+ YarnConfiguration.RM_WEBAPP_UI2_HTTPS_ADDRESS,
+ YarnConfiguration.DEFAULT_RM_WEBAPP_UI2_HTTPS_ADDRESS,
+ YarnConfiguration.DEFAULT_RM_WEBAPP_UI2_HTTPS_PORT);
+
+ HttpServer2.Builder builder = httpServerTemplateForRM(config, httpAddr,
+ httpsAddr, "rm");
+
+ HttpServer2 infoServer = builder.build();
+ infoServer.start();
+
+ LOG.info("Web server init done");
+ }
+
protected void startWepApp() {
// Use the customized yarn filter instead of the standard kerberos filter to
@@ -1123,6 +1167,16 @@ public class ResourceManager extends CompositeService implements Recoverable {
transitionToActive();
}
+ if (getConfig().getBoolean(YarnConfiguration.RM_WEBAPP_UI2_ENABLE,
+ YarnConfiguration.DEFAULT_RM_WEBAPP_UI2_ENABLE)) {
+ try {
+ startWebAppV2();
+ LOG.info("Yarn WebApp UI 2 is started");
+ } catch (Exception e) {
+ LOG.error("Failed to start Yarn web app v2:" + e.getMessage());
+ }
+ }
+
startWepApp();
if (getConfig().getBoolean(YarnConfiguration.IS_MINI_YARN_CLUSTER,
false)) {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml
index 66bf54a..6d46fda 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml
@@ -20,12 +20,12 @@
<parent>
<artifactId>hadoop-yarn</artifactId>
<groupId>org.apache.hadoop</groupId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.0-alpha1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-yarn-ui</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.0-alpha1-SNAPSHOT</version>
<name>Apache Hadoop YARN UI</name>
<packaging>${packaging.type}</packaging>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app-attempt.js
index d10ba45..78f5e02 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app-attempt.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app-attempt.js
@@ -31,10 +31,8 @@ export default AbstractAdapter.extend({
urlForFindRecord(id, modelName, snapshot) {
var url = this._buildURL();
- var url = url + '/apps/' +
+ return url + '/apps/' +
Converter.attemptIdToAppId(id) + "/appattempts/" + id;
- console.log('app-attempt url:',url);
- return url;
}
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container-log.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container-log.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container-log.js
index 39c3c87..9f2d5d7 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container-log.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container-log.js
@@ -42,7 +42,7 @@ export default DS.RESTAdapter.extend({
var nodeHttpAddr = splits[0];
var containerId = splits[1];
var filename = splits[2];
- this.host = this.host + nodeHttpAddr;
+ this.host = this.get('host') + nodeHttpAddr;
var url = this._buildURL();
url = url + "/containerlogs/" + containerId + "/" + filename;
return url;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-app.js
index fd6c021..eaddfcb 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-app.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-app.js
@@ -25,14 +25,20 @@ export default AbstractAdapter.extend({
serverName: "NM",
urlForQuery(query) {
- this.host = this.get("host") + query.nodeAddr;
+ var extension = this.get("host").split('/').pop();
+ if (extension != query.nodeAddr) {
+ this.host = this.get("host") + query.nodeAddr;
+ }
var url = this._buildURL();
url = url + "/apps";
return url;
},
urlForQueryRecord: function (query) {
- this.host = this.get("host") + query.nodeAddr;
+ var extension = this.get("host").split('/').pop();
+ if (extension != query.nodeAddr) {
+ this.host = this.get("host") + query.nodeAddr;
+ }
var url = this._buildURL();
url = url + "/apps/" + query.appId;
return url;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-container.js
index caf1e3f..56c4bcd 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-container.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-container.js
@@ -25,14 +25,20 @@ export default AbstractAdapter.extend({
serverName: "NM",
urlForQuery(query) {
- this.host = this.get("host") + query.nodeHttpAddr;
+ var extension = this.get("host").split('/').pop();
+ if (extension != query.nodeHttpAddr) {
+ this.host = this.get("host") + query.nodeHttpAddr;
+ }
var url = this._buildURL();
url = url + "/containers";
return url;
},
urlForQueryRecord(query) {
- this.host = this.get("host") + query.nodeHttpAddr;
+ var extension = this.get("host").split('/').pop();
+ if (extension != query.nodeHttpAddr) {
+ this.host = this.get("host") + query.nodeHttpAddr;
+ }
var url = this._buildURL();
url = url + "/containers/" + query.containerId;
return url;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node.js
index c9f36c3..7a0fc4a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node.js
@@ -25,7 +25,10 @@ export default AbstractAdapter.extend({
serverName: "NM",
urlForFindRecord(id, modelName, snapshot) {
- this.host = this.get("host") + id;
+ var extension = this.get("host").split('/').pop();
+ if (extension != id) {
+ this.host = this.get("host") + id;
+ }
var url = this._buildURL();
return url;
},
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js
index b92f4bf..8a2b3de 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js
@@ -225,18 +225,27 @@ export default Ember.Component.extend({
didInsertElement: function() {
// init tooltip
this.initTooltip();
+ this.modelArr = [];
// init model
if (this.get("rmModel")) {
this.get("rmModel").forEach(function(o) {
- this.modelArr.push(o);
+ if(!this.modelArr.contains(o)) {
+ this.modelArr.push(o);
+ }
}.bind(this));
}
if (this.get("tsModel")) {
- this.get("tsModel").forEach(function(o) {
- this.modelArr.push(o);
- }.bind(this));
+ this.get("tsModel").forEach(function(o) {
+ if(!this.modelArr.contains(o)) {
+ this.modelArr.push(o);
+ }
+ }.bind(this));
+ }
+
+ if(this.modelArr.length == 0) {
+ return;
}
this.modelArr.sort(function(a, b) {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
index 698c253..1af98ab 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
@@ -126,7 +126,7 @@ export default Ember.Component.extend({
.attr("transform", function(d) { return "translate(" + source.y0 + "," + source.x0 + ")"; })
.on("click", function(d,i){
if (d.queueData.get("name") != this.get("selected")) {
- document.location.href = "yarn-queue/" + d.queueData.get("name");
+ document.location.href = "#/yarn-queue/" + d.queueData.get("name");
}
}.bind(this));
// .on("click", click);
@@ -176,7 +176,7 @@ export default Ember.Component.extend({
.attr("r", 20)
.attr("href",
function(d) {
- return "yarn-queues/" + d.queueData.get("name");
+ return "#/yarn-queues/" + d.queueData.get("name");
})
.style("stroke", function(d) {
if (d.queueData.get("name") == this.get("selected")) {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js
index b6b57ec..192e1ed 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js
@@ -36,7 +36,7 @@ export default Ember.Helper.helper(function(params,hash) {
var html = '<td>';
var logFilesCommaSeparated = "";
for (var i = 0; i < logFilesLen; i++) {
- html = html + '<a href="yarn-container-log/' + nodeId + '/' +
+ html = html + '<a href="#/yarn-container-log/' + nodeId + '/' +
nodeAddr + '/' + containerId + '/' + logFiles[i] + '">' + logFiles[i] +
'</a>';
if (i != logFilesLen - 1) {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js
index 331f082..e524f08 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js
@@ -29,7 +29,7 @@ export default Ember.Helper.helper(function(params,hash) {
if (nodeState == "SHUTDOWN" || nodeState == "LOST") {
html = html + nodeHTTPAddress;
} else {
- html = html + '<a href="yarn-node/' + nodeId + "/" + nodeHTTPAddress + '">' +
+ html = html + '<a href="#/yarn-node/' + nodeId + "/" + nodeHTTPAddress + '">' +
nodeHTTPAddress + '</a>';
}
html = html + '</td>';
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-menu.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-menu.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-menu.js
index 2538d7d..d4a73a4 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-menu.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-menu.js
@@ -50,17 +50,17 @@ export default Ember.Helper.helper(function(params,hash) {
if (hash.path == 'yarn-node') {
html = html + ' class="active"';
}
- html = html + '><a href="yarn-node/' + hash.nodeId + '/' + hash.nodeAddr +
+ html = html + '><a href="#/yarn-node/' + hash.nodeId + '/' + hash.nodeAddr +
'">Node Information</a></li><li';
if (hash.path == 'yarn-node-apps') {
html = html + ' class="active"';
}
- html = html + '><a href="yarn-node-apps/' + hash.nodeId + '/' + hash.nodeAddr +
+ html = html + '><a href="#/yarn-node-apps/' + hash.nodeId + '/' + hash.nodeAddr +
'">List of Applications</a></li><li';
if (hash.path == 'yarn-node-containers') {
html = html + ' class="active"';
}
- html = html + '><a href="yarn-node-containers/' +hash.nodeId + '/' + hash.nodeAddr +
+ html = html + '><a href="#/yarn-node-containers/' +hash.nodeId + '/' + hash.nodeAddr +
'">List of Containers</a></li></ul></ul></div>';
return Ember.String.htmlSafe(html);
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-name.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-name.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-name.js
new file mode 100644
index 0000000..56ce373
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-name.js
@@ -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.
+ */
+
+import Ember from 'ember';
+
+export function nodeName(params/*, hash*/) {
+ // Place a menu within a panel inside col-md-2 container.
+ console.log('nodes-uid', params[0]);
+ var nodeIdSplitAtPort = params[0];
+ var portIndex = nodeIdSplitAtPort.indexOf(':');
+ if (portIndex != -1) {
+ nodeIdSplitAtPort = nodeIdSplitAtPort.substring(0, portIndex) +
+ ':​' + nodeIdSplitAtPort.substring(portIndex + 1);
+ }
+ var normalizedNodeId = '';
+ var splitsAlongDots = nodeIdSplitAtPort.split('.');
+ if (splitsAlongDots) {
+ var len = splitsAlongDots.length;
+ for (var i = 0; i < len; i++) {
+ normalizedNodeId = normalizedNodeId + splitsAlongDots[i];
+ if (i != len - 1) {
+ normalizedNodeId = normalizedNodeId + '.​';
+ }
+ }
+ } else {
+ normalizedNodeId = nodeIdSplitAtPort;
+ }
+ return Ember.String.htmlSafe(normalizedNodeId);
+}
+
+export default Ember.Helper.helper(nodeName);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js
index 8079907..b913a33 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js
@@ -21,14 +21,29 @@ import Converter from 'yarn-ui/utils/converter';
export default DS.Model.extend({
startTime: DS.attr('string'),
+ startedTime: DS.attr('string'),
finishedTime: DS.attr('string'),
containerId: DS.attr('string'),
+ amContainerId: DS.attr('string'),
nodeHttpAddress: DS.attr('string'),
nodeId: DS.attr('string'),
+ hosts: DS.attr('string'),
logsLink: DS.attr('string'),
+ state: DS.attr('string'),
+
+ attemptStartedTime: function() {
+ var startTime = this.get("startTime");
+ // If startTime variable is not present, get from startedTime
+ if (startTime == undefined ||
+ startTime == "Invalid date") {
+ startTime = this.get("startedTime");
+ }
+
+ return startTime;
+ }.property("startedTime"),
startTs: function() {
- return Converter.dateToTimeStamp(this.get("startTime"));
+ return Converter.dateToTimeStamp(this.get('attemptStartedTime'));
}.property("startTime"),
finishedTs: function() {
@@ -36,11 +51,57 @@ export default DS.Model.extend({
return ts;
}.property("finishedTime"),
+ validatedFinishedTs: function() {
+ if (this.get("finishedTs") < this.get("startTs")) {
+ return "";
+ }
+ return this.get("finishedTime");
+ }.property("finishedTime"),
+
shortAppAttemptId: function() {
+ if (!this.get("containerId")) {
+ return this.get("id");
+ }
return "attempt_" +
parseInt(Converter.containerIdToAttemptId(this.get("containerId")).split("_")[3]);
}.property("containerId"),
+ appMasterContainerId: function() {
+ var id = this.get("containerId");
+ // If containerId variable is not present, get from amContainerId
+ if (id == undefined) {
+ id = this.get("amContainerId");
+ }
+ return id;
+ }.property("amContainerId"),
+
+ IsAmNodeUrl: function() {
+ var url = this.get("nodeHttpAddress");
+ // If nodeHttpAddress variable is not present, hardcode it.
+ if (url == undefined) {
+ url = "Not Available";
+ }
+ return url != "Not Available";
+ }.property("nodeHttpAddress"),
+
+ amNodeId : function() {
+ var id = this.get("nodeId");
+ // If nodeId variable is not present, get from host
+ if (id == undefined) {
+ id = this.get("hosts");
+ }
+ return id;
+ }.property("nodeId"),
+
+ IsLinkAvailable: function() {
+ var url = this.get("logsLink");
+ // If logsLink variable is not present, hardcode its.
+ if (url == undefined) {
+ url = "Not Available";
+ }
+ return url != "Not Available";
+ }.property("logsLink"),
+
elapsedTime: function() {
var elapsedMs = this.get("finishedTs") - this.get("startTs");
if (elapsedMs <= 0) {
@@ -59,4 +120,13 @@ export default DS.Model.extend({
link: function() {
return "/yarn-app-attempt/" + this.get("id");
}.property(),
+
+ linkname: function() {
+ return "yarn-app-attempt";
+ }.property(),
+
+ attemptState: function() {
+ return this.get("state");
+ }.property(),
+
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js
index 1d506c2..a96c17c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js
@@ -51,6 +51,13 @@ export default DS.Model.extend({
return this.get('finalStatus') == "FAILED"
}.property("finalStatus"),
+ validatedFinishedTs: function() {
+ if (this.get("finishedTime") < this.get("startTime")) {
+ return "";
+ }
+ return this.get("finishedTime");
+ }.property("finishedTime"),
+
allocatedResource: function() {
return Converter.resourceToString(this.get("allocatedMB"), this.get("allocatedVCores"));
}.property("allocatedMB", "allocatedVCores"),
@@ -67,6 +74,13 @@ export default DS.Model.extend({
return "width: " + this.get("progress") + "%";
}.property("progress"),
+ runningContainersNumber: function() {
+ if(this.get("runningContainers") < 0) {
+ return 0;
+ }
+ return this.get("runningContainers");
+ }.property("progress"),
+
finalStatusStyle: function() {
var style = "default";
var finalStatus = this.get("finalStatus");
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container.js
index b745296..bd9cea7 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container.js
@@ -40,6 +40,13 @@ export default DS.Model.extend({
return ts;
}.property("finishedTime"),
+ validatedFinishedTs: function() {
+ if (this.get("finishedTs") < this.get("startTs")) {
+ return "";
+ }
+ return this.get("finishedTime");
+ }.property("finishedTime"),
+
elapsedTime: function() {
var elapsedMs = this.get("finishedTs") - this.get("startTs");
if (elapsedMs <= 0) {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempt.js
index a65118d..a8f27f5 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempt.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempt.js
@@ -33,7 +33,11 @@ export default Ember.Route.extend({
{
app_attempt_id: param.app_attempt_id,
is_rm: false
- }),
+ }).catch (function() {
+ // Promise rejected, fulfill with some default value to
+ // use as the route's model and continue on with the transition
+ return [];
+ })
});
}
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app-attempt.js
index 291589c..4c542c4 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app-attempt.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app-attempt.js
@@ -32,11 +32,14 @@ export default DS.JSONAPISerializer.extend({
type: primaryModelClass.modelName, // yarn-app
attributes: {
startTime: Converter.timeStampToDate(payload.startTime),
+ startedTime: Converter.timeStampToDate(payload.startedTime),
finishedTime: Converter.timeStampToDate(payload.finishedTime),
containerId: payload.containerId,
+ amContainerId: payload.amContainerId,
nodeHttpAddress: payload.nodeHttpAddress,
nodeId: payload.nodeId,
- state: payload.nodeId,
+ hosts: payload.host,
+ state: payload.appAttemptState,
logsLink: payload.logsLink
}
};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js
index 234ad24..ba8c1f4 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js
@@ -75,10 +75,15 @@ export default DS.JSONAPISerializer.extend({
// payload has apps : { app: [ {},{},{} ] }
// need some error handling for ex apps or app may not be defined.
- normalizedArrayResponse.data = payload.apps.app.map(singleApp => {
- return this.internalNormalizeSingleResponse(store, primaryModelClass,
+ if(payload.apps) {
+ normalizedArrayResponse.data = payload.apps.app.map(singleApp => {
+ return this.internalNormalizeSingleResponse(store, primaryModelClass,
singleApp, singleApp.id, requestType);
- }, this);
+ }, this);
+ } else {
+ normalizedArrayResponse.data = [];
+ }
+
return normalizedArrayResponse;
}
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-container.js
index 6f0386f..e051396 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-container.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-container.js
@@ -64,9 +64,10 @@ export default DS.JSONAPISerializer.extend({
singleContainer, singleContainer.id, requestType);
}, this);
return normalizedArrayResponse;
+ } else {
+ normalizedArrayResponse.data = [];
}
- normalizedArrayResponse.data = [];
return normalizedArrayResponse;
}
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-app.js
index 8b1f152..5945813 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-app.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-app.js
@@ -76,10 +76,7 @@ export default DS.JSONAPISerializer.extend({
} else {
// No container reported inside containers.
// Response of the form { "apps": null }
- normalizedArrayResponse.data = Ember.makeArray({
- id: "dummy",
- type: primaryModelClass.modelName,
- attributes: {}});
+ normalizedArrayResponse.data = [];
}
return normalizedArrayResponse;
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-container.js
index 528f2fe..a104f1e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-container.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-container.js
@@ -64,10 +64,7 @@ export default DS.JSONAPISerializer.extend({
} else {
// No container reported inside containers.
// Response of the form { "containers": null }
- normalizedArrayResponse.data = Ember.makeArray({
- id: "dummy",
- type: primaryModelClass.modelName,
- attributes: {}});
+ normalizedArrayResponse.data = [];
}
return normalizedArrayResponse;
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-rm-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-rm-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-rm-node.js
index 6cb9320..6feab36 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-rm-node.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-rm-node.js
@@ -67,10 +67,7 @@ export default DS.JSONAPISerializer.extend({
singleNode, singleNode.id);
}, this);
} else {
- normalizedArrayResponse.data = Ember.makeArray({
- id: "dummy",
- type: primaryModelClass.modelName,
- attributes: {}});
+ normalizedArrayResponse.data = [];
}
return normalizedArrayResponse;
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs
index 88702c4..b45ec6b 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs
@@ -32,7 +32,26 @@
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
- {{outputMainMenu}}
+ {{#link-to 'yarn-queue' 'root' tagName="li"}}
+ {{#link-to 'yarn-queue' 'root'}}Queues
+ <span class="sr-only">(current)</span>
+ {{/link-to}}
+ {{/link-to}}
+ {{#link-to 'yarn-apps' tagName="li"}}
+ {{#link-to 'yarn-apps'}}Applications
+ <span class="sr-only">(current)</span>
+ {{/link-to}}
+ {{/link-to}}
+ {{#link-to 'cluster-overview' tagName="li"}}
+ {{#link-to 'cluster-overview'}}Cluster Overview
+ <span class="sr-only">(current)</span>
+ {{/link-to}}
+ {{/link-to}}
+ {{#link-to 'yarn-nodes' tagName="li"}}
+ {{#link-to 'yarn-nodes'}}Nodes
+ <span class="sr-only">(current)</span>
+ {{/link-to}}
+ {{/link-to}}
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-attempt-table.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-attempt-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-attempt-table.hbs
index 722f780..2b16f86 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-attempt-table.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-attempt-table.hbs
@@ -24,23 +24,39 @@
</tr>
<tr>
<td>Start Time</td>
- <td>{{attempt.startTime}}</td>
+ <td>{{attempt.attemptStartedTime}}</td>
</tr>
<tr>
<td>AM Container Id</td>
- <td>{{attempt.containerId}}</td>
+ <td>{{attempt.appMasterContainerId}}</td>
</tr>
+ {{#if attempt.IsAmNodeUrl}}
<tr>
<td>AM Node Web UI</td>
<td><a href={{attempt.nodeHttpAddress}}>{{attempt.nodeHttpAddress}}</a></td>
</tr>
+ {{/if}}
<tr>
<td>AM Node Id</td>
- <td>{{attempt.nodeId}}</td>
+ <td>{{attempt.amNodeId}}</td>
</tr>
+ {{#if attempt.IsLinkAvailable}}
<tr>
<td>Log</td>
<td><a href={{attempt.logsLink}}>link</a></td>
</tr>
+ {{/if}}
+ {{#if attempt.attemptState}}
+ <tr>
+ <td>Attempt State</td>
+ <td>{{attempt.attemptState}}</td>
+ </tr>
+ {{/if}}
+ {{#if attempt.elapsedTime}}
+ <tr>
+ <td>Elapsed Time</td>
+ <td>{{attempt.elapsedTime}}</td>
+ </tr>
+ {{/if}}
</tbody>
</table>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-table.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-table.hbs
index 6e8badc..0788d9c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-table.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-table.hbs
@@ -36,7 +36,7 @@
{{#if arr}}
{{#each arr as |app|}}
<tr>
- <td><a href="yarn-app/{{app.id}}">{{app.id}}</a></td>
+ <td><a href="#/yarn-app/{{app.id}}">{{app.id}}</a></td>
<td>{{app.appName}}</td>
<td>{{app.user}}</td>
<td>{{app.queue}}</td>
@@ -44,7 +44,7 @@
<td><span class={{app.finalStatusStyle}}>{{app.finalStatus}}</span></td>
<td>{{app.startTime}}</td>
<td>{{app.elapsedTime}}</td>
- <td>{{app.finishedTime}}</td>
+ <td>{{app.validatedFinishedTs}}</td>
<td>{{app.priority}}</td>
<td>
<div class="progress" style="margin-bottom: 0;">
@@ -57,7 +57,7 @@
{{/each}}
{{else}}
<tr>
- <td><a href="yarn-app/{{app.id}}">{{app.id}}</a></td>
+ <td><a href="#/yarn-app/{{app.id}}">{{app.id}}</a></td>
<td>{{app.appName}}</td>
<td>{{app.user}}</td>
<td>{{app.queue}}</td>
@@ -65,7 +65,7 @@
<td><span class={{app.finalStatusStyle}}>{{app.finalStatus}}</span></td>
<td>{{app.startTime}}</td>
<td>{{app.elapsedTime}}</td>
- <td>{{app.finishedTime}}</td>
+ <td>{{app.validatedFinishedTs}}</td>
<td>{{app.priority}}</td>
<td>
<div class="progress" style="margin-bottom: 0;">
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/container-table.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/container-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/container-table.hbs
index dcc31da..0736a69 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/container-table.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/container-table.hbs
@@ -24,7 +24,7 @@
</tr>
<tr>
<td>Finished Time</td>
- <td>{{container.finishedTime}}</td>
+ <td>{{container.validatedFinishedTs}}</td>
</tr>
<tr>
<td>Elapsed Time</td>
@@ -48,7 +48,7 @@
</tr>
<tr>
<td>NodeManager UI</td>
- <td>{{container.nodeHttpAddress}}</td>
+ <td><a href={{container.nodeHttpAddress}}>{{container.nodeHttpAddress}}</a></td>
</tr>
</tbody>
</table>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/node-menu-panel.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/node-menu-panel.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/node-menu-panel.hbs
new file mode 100644
index 0000000..1e07e89
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/node-menu-panel.hbs
@@ -0,0 +1,44 @@
+{{!
+ * 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.
+}}
+
+<div class="col-md-2 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4>Node Manager<br>({{node-name nodeId}})</h4>
+ </div>
+ <div class="panel-body">
+ <ul class="nav nav-pills nav-stacked" id="stacked-menu">
+ <ul class="nav nav-pills nav-stacked collapse in">
+ {{#link-to 'yarn-node' tagName="li"}}
+ {{#link-to 'yarn-node' nodeId nodeAddr}}Node Information
+ {{/link-to}}
+ {{/link-to}}
+ {{#link-to 'yarn-node-apps' tagName="li"}}
+ {{#link-to 'yarn-node-apps' nodeId nodeAddr}}List of Applications
+ {{/link-to}}
+ {{/link-to}}
+ {{#link-to 'yarn-node-containers' tagName="li"}}
+ {{#link-to 'yarn-node-containers' nodeId nodeAddr}}List of Containers
+ {{/link-to}}
+ {{/link-to}}
+ </ul>
+ </ul>
+ </div>
+ </div>
+ </div>
+{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/timeline-view.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/timeline-view.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/timeline-view.hbs
index 2eb3441..6f529ba 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/timeline-view.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/timeline-view.hbs
@@ -34,7 +34,7 @@
<div class="panel panel-default">
<div class="panel-heading">
{{#if selected.link}}
- <a href={{selected.link}}>{{selected.id}}</a>
+ {{#link-to selected.linkname selected.id}}{{selected.id}}{{/link-to}}
{{else}}
{{selected.id}}
{{/if}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/error.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/error.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/error.hbs
index c546bf7..2e2a6e5 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/error.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/error.hbs
@@ -16,4 +16,4 @@
limitations under the License.
--}}
-<h3 align = "center">Sorry, Error Occured.</h3>
+<h3 align = "center">Sorry, Error Occurred.</h3>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempt.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempt.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempt.hbs
index a0343b5..b01eceb 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempt.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempt.hbs
@@ -18,12 +18,16 @@
<div class="container-fluid">
<div class="row">
+ {{#if model.attempt}}
{{app-attempt-table attempt=model.attempt}}
+ {{/if}}
</div>
<!-- containers table -->
<div class="row">
+ {{#if (or model.rmContainers model.tsContainers)}}
{{timeline-view parent-id="containers-timeline-div" my-id="timeline-view" height="400" rmModel=model.rmContainers tsModel=model.tsContainers label="shortAppAttemptId" attemptModel=false}}
+ {{/if}}
</div>
</div>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs
index d306e64..2bc20f2 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs
@@ -61,7 +61,7 @@
</tr>
<tr>
<td>Running Containers</td>
- <td>{{model.app.runningContainers}}</td>
+ <td>{{model.app.runningContainersNumber}}</td>
</tr>
<tr>
<td>Preempted Resource</td>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps.hbs
index 98b9107..0fc6edf 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps.hbs
@@ -15,7 +15,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
}}
-
-{{app-table table-id="apps-table" arr=model}}
-{{simple-table table-id="apps-table" bFilter=true colsOrder="0,desc" colTypes="natural elapsed-time" colTargets="0 7"}}
+{{#if model}}
+ {{app-table table-id="apps-table" arr=model}}
+ {{simple-table table-id="apps-table" bFilter=true colsOrder="0,desc" colTypes="natural elapsed-time" colTargets="0 7"}}
+{{else}}
+ <h4 align = "center">Could not find any applications from this cluster</h4>
+{{/if}}
{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-app.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-app.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-app.hbs
index dfd6fb5..1551957 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-app.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-app.hbs
@@ -18,7 +18,7 @@
<div class="col-md-12 container-fluid">
<div class="row">
- {{node-menu path="yarn-node-app" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
+ {{node-menu-panel path="yarn-node-app" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
<div class="col-md-10 container-fluid">
<div class="panel panel-default">
<div class="panel-heading"><b>Application Information</b></div>
@@ -48,7 +48,7 @@
<tbody>
{{#each model.nodeApp.containers as |container|}}
<tr>
- <td><a href="yarn-node-container/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{container}}">{{container}}</a></td>
+ <td><a href="#/yarn-node-container/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{container}}">{{container}}</a></td>
</tr>
{{/each}}
</tbody>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-apps.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-apps.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-apps.hbs
index d897afc..42de7eb 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-apps.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-apps.hbs
@@ -18,7 +18,8 @@
<div class="col-md-12 container-fluid">
<div class="row">
- {{node-menu path="yarn-node-apps" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
+ {{node-menu-panel path="yarn-node-apps" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
+ {{#if model.apps}}
<div class="col-md-10 container-fluid">
<table id="node-apps-table" class="display table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
@@ -31,21 +32,20 @@
<tbody>
{{#if model.apps}}
{{#each model.apps as |app|}}
- {{#if app.isDummyApp}}
- <tr><td colspan="3" align="center">No apps found on this node</td></tr>
- {{else}}
<tr>
- <td><a href="yarn-node-app/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{app.appId}}">{{app.appId}}</a></td>
+ <td><a href="#/yarn-node-app/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{app.appId}}">{{app.appId}}</a></td>
<td><span class={{app.appStateStyle}}>{{app.state}}</span></td>
<td>{{app.user}}</td>
</tr>
- {{/if}}
{{/each}}
{{/if}}
</tbody>
</table>
{{simple-table table-id="node-apps-table" bFilter=true colsOrder="0,desc" colTypes="natural" colTargets="0"}}
</div>
+ {{else}}
+ <h4 align = "center">No apps found on this node</h4>
+ {{/if}}
</div>
</div>
{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-container.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-container.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-container.hbs
index 8ddbae5..4104eec 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-container.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-container.hbs
@@ -18,7 +18,7 @@
<div class="col-md-12 container-fluid">
<div class="row">
- {{node-menu path="yarn-node-container" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
+ {{node-menu-panel path="yarn-node-container" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
<div class="col-md-10 container-fluid">
<div class="panel panel-default">
<div class="panel-heading"><b>Container Information</b></div>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs
index 65a67a8..3ebcc6f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs
@@ -18,7 +18,8 @@
<div class="col-md-12 container-fluid">
<div class="row">
- {{node-menu path="yarn-node-containers" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
+ {{node-menu-panel path="yarn-node-containers" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
+ {{#if model.containers}}
<div class="col-md-10 container-fluid">
<table id="node-containers-table" class="display table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
@@ -32,11 +33,8 @@
<tbody>
{{#if model.containers}}
{{#each model.containers as |container|}}
- {{#if container.isDummyContainer}}
- <tr><td colspan="4" align="center">No containers found on this node</td></tr>
- {{else}}
<tr>
- <td><a href="yarn-node-container/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{container.containerId}}">{{container.containerId}}</a></td>
+ <td><a href="#/yarn-node-container/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{container.containerId}}">{{container.containerId}}</a></td>
<td><span class={{container.containerStateStyle}}>{{container.state}}</span></td>
<td>{{container.user}}</td>
<td>
@@ -46,13 +44,15 @@
logFiles=container.containerLogFiles}}
</td>
</tr>
- {{/if}}
{{/each}}
{{/if}}
</tbody>
</table>
{{simple-table table-id="node-containers-table" bFilter=true colsOrder="0,desc" colTypes="natural" colTargets="0"}}
</div>
+ {{else}}
+ <h4 align = "center">No containers found on this node</h4>
+ {{/if}}
</div>
</div>
{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs
index d92a70a..d6f30ec 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs
@@ -18,7 +18,7 @@
<div class="col-md-12 container-fluid">
<div class="row">
- {{node-menu path="yarn-node" nodeId=model.rmNode.id nodeAddr=model.node.id}}
+ {{node-menu-panel path="yarn-node" nodeId=model.rmNode.id nodeAddr=model.node.id}}
<div class="col-md-10 container-fluid">
<div class="panel panel-default">
<div class="panel-heading">Node Information</div>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs
index bf2a098..3c78498 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs
@@ -16,6 +16,7 @@
limitations under the License.
--}}
+{{#if model}}
<table id="nodes-table" class="display table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
@@ -35,11 +36,7 @@
</tr>
</thead>
<tbody>
- {{#if model}}
{{#each model as |node|}}
- {{#if node.isDummyNode}}
- <tr><td colspan="13" align="center">No nodes found on this cluster</td></tr>
- {{else}}
<tr>
<td>{{node.nodeLabelsAsString}}</td>
<td>{{node.rack}}</td>
@@ -55,11 +52,12 @@
<td>{{node.availableVirtualCores}}</td>
<td>{{node.version}}</td>
</tr>
- {{/if}}
{{/each}}
- {{/if}}
</tbody>
</table>
{{simple-table table-id="nodes-table" bFilter=true}}
+{{else}}
+ <h4 align = "center">No nodes found on this cluster</h4>
+{{/if}}
{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue.hbs
index 51a4fb4..8ce4ffa 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue.hbs
@@ -58,8 +58,12 @@
<div class="row">
<div class="col-md-12 container-fluid">
- {{app-table table-id="apps-table" arr=model.apps}}
- {{simple-table table-id="apps-table" bFilter=true colTypes="elapsed-time" colTargets="7"}}
+ {{#if model.apps}}
+ {{app-table table-id="apps-table" arr=model.apps}}
+ {{simple-table table-id="apps-table" bFilter=true colTypes="elapsed-time" colTargets="7"}}
+ {{else}}
+ <h4 align = "center">Could not find any applications from this cluster</h4>
+ {{/if}}
</div>
</div>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/environment.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/environment.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/environment.js
index 118e0ba..3c478be 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/environment.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/environment.js
@@ -25,7 +25,7 @@ module.exports = function(environment) {
modulePrefix: 'yarn-ui',
environment: environment,
baseURL: '/',
- locationType: 'auto',
+ locationType: 'hash',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json
index 40febda..417eb98 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json
@@ -22,6 +22,7 @@
"broccoli-asset-rev": "2.4.2",
"broccoli-funnel": "1.0.1",
"ember-bootstrap": "0.5.1",
+ "ember-array-contains-helper": "1.0.2",
"ember-cli": "1.13.13",
"ember-cli-app-version": "1.0.0",
"ember-cli-babel": "5.1.6",
@@ -42,6 +43,7 @@
"ember-export-application-global": "1.0.5",
"ember-resolver": "2.0.3",
"ember-spin-spinner": "0.2.3",
+ "ember-truth-helpers": "1.2.0",
"select2": "4.0.0"
}
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a32d5d7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/helpers/node-name-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/helpers/node-name-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/helpers/node-name-test.js
new file mode 100644
index 0000000..8ff5eb6
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/helpers/node-name-test.js
@@ -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.
+ */
+
+import { nodeName } from '../../../helpers/node-name';
+import { module, test } from 'qunit';
+
+module('Unit | Helper | node name');
+
+// Replace this with your real tests.
+test('it works', function(assert) {
+ let result = nodeName(42);
+ assert.ok(result);
+});
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[49/50] [abbrv] hadoop git commit: YARN-5161. [YARN-3368] Add Apache
Hadoop logo in YarnUI home page. (Kai Sasaki via Sunil G)
Posted by wa...@apache.org.
YARN-5161. [YARN-3368] Add Apache Hadoop logo in YarnUI home page. (Kai Sasaki via Sunil G)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/b2e82196
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/b2e82196
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/b2e82196
Branch: refs/heads/YARN-3368
Commit: b2e82196506e4cad891dd92817270cd1e58614a7
Parents: a3d70aa
Author: Sunil <su...@apache.org>
Authored: Mon Jul 11 14:31:25 2016 +0530
Committer: Wangda Tan <wa...@apache.org>
Committed: Tue Aug 9 14:51:19 2016 -0700
----------------------------------------------------------------------
.../src/main/webapp/app/styles/app.css | 11 +++++++++++
.../src/main/webapp/app/templates/application.hbs | 12 +++++++-----
.../webapp/public/assets/images/hadoop_logo.png | Bin 0 -> 26495 bytes
3 files changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b2e82196/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.css
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.css b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.css
index bcb6aab..e2d09dc 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.css
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.css
@@ -157,3 +157,14 @@ table.dataTable thead .sorting_desc_disabled {
stroke: #ccc;
stroke-width: 2px;
}
+
+.hadoop-brand-image {
+ margin-top: -10px;
+ width: auto;
+ height: 45px;
+}
+
+li a.navigation-link.ember-view {
+ color: #2196f3;
+ font-weight: bold;
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b2e82196/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs
index b45ec6b..03b2c4a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs
@@ -20,35 +20,37 @@
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
+ <a class="navbar-brand" href="#">
+ <img class="hadoop-brand-image" alt="Apache Hadoop" src="assets/images/hadoop_logo.png" />
+ </a>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
- <a class="navbar-brand" href="#">Apache Hadoop YARN</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
{{#link-to 'yarn-queue' 'root' tagName="li"}}
- {{#link-to 'yarn-queue' 'root'}}Queues
+ {{#link-to 'yarn-queue' 'root' class="navigation-link"}}Queues
<span class="sr-only">(current)</span>
{{/link-to}}
{{/link-to}}
{{#link-to 'yarn-apps' tagName="li"}}
- {{#link-to 'yarn-apps'}}Applications
+ {{#link-to 'yarn-apps' class="navigation-link"}}Applications
<span class="sr-only">(current)</span>
{{/link-to}}
{{/link-to}}
{{#link-to 'cluster-overview' tagName="li"}}
- {{#link-to 'cluster-overview'}}Cluster Overview
+ {{#link-to 'cluster-overview' class="navigation-link"}}Cluster Overview
<span class="sr-only">(current)</span>
{{/link-to}}
{{/link-to}}
{{#link-to 'yarn-nodes' tagName="li"}}
- {{#link-to 'yarn-nodes'}}Nodes
+ {{#link-to 'yarn-nodes' class="navigation-link"}}Nodes
<span class="sr-only">(current)</span>
{{/link-to}}
{{/link-to}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b2e82196/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/hadoop_logo.png
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/hadoop_logo.png b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/hadoop_logo.png
new file mode 100644
index 0000000..275d39e
Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/hadoop_logo.png differ
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[24/50] [abbrv] hadoop git commit: YARN-5474. Typo mistake in
AMRMClient#getRegisteredTimeineClient API. Contributed by Naganarasimha G R.
Posted by wa...@apache.org.
YARN-5474. Typo mistake in AMRMClient#getRegisteredTimeineClient API. Contributed by Naganarasimha G R.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/3cd386bd
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/3cd386bd
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/3cd386bd
Branch: refs/heads/YARN-3368
Commit: 3cd386bd97c05f2bc5d95014f9cf34d0dc4588ee
Parents: b10c936
Author: Rohith Sharma K S <ro...@apache.org>
Authored: Tue Aug 9 22:28:20 2016 +0530
Committer: Rohith Sharma K S <ro...@apache.org>
Committed: Tue Aug 9 22:28:54 2016 +0530
----------------------------------------------------------------------
.../main/java/org/apache/hadoop/yarn/client/api/AMRMClient.java | 2 +-
.../org/apache/hadoop/yarn/client/api/async/AMRMClientAsync.java | 4 ++--
.../hadoop/yarn/client/api/async/impl/AMRMClientAsyncImpl.java | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3cd386bd/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/AMRMClient.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/AMRMClient.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/AMRMClient.java
index 7acaf11..79d587a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/AMRMClient.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/AMRMClient.java
@@ -473,7 +473,7 @@ public abstract class AMRMClient<T extends AMRMClient.ContainerRequest> extends
* Get registered timeline client.
* @return the registered timeline client
*/
- public TimelineClient getRegisteredTimeineClient() {
+ public TimelineClient getRegisteredTimelineClient() {
return this.timelineClient;
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3cd386bd/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/async/AMRMClientAsync.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/async/AMRMClientAsync.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/async/AMRMClientAsync.java
index 28d20c8..d06fadc 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/async/AMRMClientAsync.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/async/AMRMClientAsync.java
@@ -306,8 +306,8 @@ extends AbstractService {
* Get registered timeline client.
* @return the registered timeline client
*/
- public TimelineClient getRegisteredTimeineClient() {
- return client.getRegisteredTimeineClient();
+ public TimelineClient getRegisteredTimelineClient() {
+ return client.getRegisteredTimelineClient();
}
/**
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3cd386bd/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/async/impl/AMRMClientAsyncImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/async/impl/AMRMClientAsyncImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/async/impl/AMRMClientAsyncImpl.java
index 8af0c78..242df65 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/async/impl/AMRMClientAsyncImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/async/impl/AMRMClientAsyncImpl.java
@@ -329,7 +329,7 @@ extends AMRMClientAsync<T> {
}
String collectorAddress = response.getCollectorAddr();
- TimelineClient timelineClient = client.getRegisteredTimeineClient();
+ TimelineClient timelineClient = client.getRegisteredTimelineClient();
if (timelineClient != null && collectorAddress != null
&& !collectorAddress.isEmpty()) {
if (collectorAddr == null
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[36/50] [abbrv] hadoop git commit: YARN-4849. [YARN-3368] cleanup
code base, integrate web UI related build to mvn, and fix licenses. (wangda)
Posted by wa...@apache.org.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs
new file mode 100644
index 0000000..ca80ccd
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-containers.hbs
@@ -0,0 +1,58 @@
+{{!--
+ 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.
+--}}
+
+<div class="col-md-12 container-fluid">
+ <div class="row">
+ {{node-menu path="yarnNodeContainers" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
+ <div class="col-md-10 container-fluid">
+ <table id="node-containers-table" class="display table table-striped table-bordered" cellspacing="0" width="100%">
+ <thead>
+ <tr>
+ <th>Container ID</th>
+ <th>Container State</th>
+ <th>User</th>
+ <th>Logs</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#if model.containers}}
+ {{#each model.containers as |container|}}
+ {{#if container.isDummyContainer}}
+ <tr><td colspan="4" align="center">No containers found on this node</td></tr>
+ {{else}}
+ <tr>
+ <td><a href="yarnNodeContainer/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{container.containerId}}">{{container.containerId}}</a></td>
+ <td><span class={{container.containerStateStyle}}>{{container.state}}</span></td>
+ <td>{{container.user}}</td>
+ <td>
+ {{log-files-comma nodeId=model.nodeInfo.id
+ nodeAddr=model.nodeInfo.addr
+ containerId=container.containerId
+ logFiles=container.containerLogFiles}}
+ </td>
+ </tr>
+ {{/if}}
+ {{/each}}
+ {{/if}}
+ </tbody>
+ </table>
+ {{simple-table table-id="node-containers-table" bFilter=true colsOrder="0,desc" colTypes="natural" colTargets="0"}}
+ </div>
+ </div>
+</div>
+{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs
new file mode 100644
index 0000000..a036076
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs
@@ -0,0 +1,94 @@
+{{!--
+ 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.
+--}}
+
+<div class="col-md-12 container-fluid">
+ <div class="row">
+ {{node-menu path="yarnNode" nodeId=model.rmNode.id nodeAddr=model.node.id}}
+ <div class="col-md-10 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">Node Information</div>
+ <table class="table">
+ <tbody>
+ <tr>
+ <td>Total Vmem allocated for Containers</td>
+ <td>{{divide num=model.node.totalVmemAllocatedContainersMB den=1024}} GB</td>
+ </tr>
+ <tr>
+ <td>Vmem enforcement enabled</td>
+ <td>{{model.node.vmemCheckEnabled}}</td>
+ </tr>
+ <tr>
+ <td>Total Pmem allocated for Containers</td>
+ <td>{{divide num=model.node.totalPmemAllocatedContainersMB den=1024}} GB</td>
+ </tr>
+ <tr>
+ <td>Pmem enforcement enabled</td>
+ <td>{{model.node.pmemCheckEnabled}}</td>
+ </tr>
+ <tr>
+ <td>Total VCores allocated for Containers</td>
+ <td>{{model.node.totalVCoresAllocatedContainers}}</td>
+ </tr>
+ <tr>
+ <td>Node Healthy Status</td>
+ <td>{{model.node.nodeHealthy}}</td>
+ </tr>
+ <tr>
+ <td>Last Node Health Report Time</td>
+ <td>{{model.node.lastNodeUpdateTime}}</td>
+ </tr>
+ <tr>
+ <td>Node Health Report</td>
+ <td>{{model.node.healthReport}}</td>
+ </tr>
+ <tr>
+ <td>Node Manager Start Time</td>
+ <td>{{model.node.nmStartupTime}}</td>
+ </tr>
+ <tr>
+ <td>Node Manager Version</td>
+ <td>{{model.node.nodeManagerBuildVersion}}</td>
+ </tr>
+ <tr>
+ <td>Hadoop Version</td>
+ <td>{{model.node.hadoopBuildVersion}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div class="col-lg-4 container-fluid" id="mem-donut-chart">
+ {{donut-chart data=model.rmNode.getMemoryDataForDonutChart
+ title="Resource - Memory (in MB)"
+ showLabels=true
+ parentId="mem-donut-chart"
+ ratio=0.55
+ maxHeight=350}}
+ </div>
+
+ <div class="col-lg-4 container-fluid" id="vcore-donut-chart">
+ {{donut-chart data=model.rmNode.getVCoreDataForDonutChart
+ title="Resource - VCores"
+ showLabels=true
+ parentId="vcore-donut-chart"
+ ratio=0.55
+ maxHeight=350}}
+ </div>
+ </div>
+ </div>
+</div>
+{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs
new file mode 100644
index 0000000..bf2a098
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs
@@ -0,0 +1,65 @@
+{{!--
+ 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.
+--}}
+
+<table id="nodes-table" class="display table table-striped table-bordered" cellspacing="0" width="100%">
+ <thead>
+ <tr>
+ <th>Node Labels</th>
+ <th>Rack</th>
+ <th>Node State</th>
+ <th>Node Address</th>
+ <th>Node HTTP Address</th>
+ <th>Last Health Update</th>
+ <th>Health-Report</th>
+ <th>Containers</th>
+ <th>Mem Used</th>
+ <th>Mem Avail</th>
+ <th>VCores Used</th>
+ <th>VCores Avail</th>
+ <th>Version</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#if model}}
+ {{#each model as |node|}}
+ {{#if node.isDummyNode}}
+ <tr><td colspan="13" align="center">No nodes found on this cluster</td></tr>
+ {{else}}
+ <tr>
+ <td>{{node.nodeLabelsAsString}}</td>
+ <td>{{node.rack}}</td>
+ <td><span class={{node.nodeStateStyle}}>{{node.state}}</span></td>
+ <td>{{node.id}}</td>
+ {{node-link nodeId=node.id nodeHTTPAddress=node.nodeHTTPAddress nodeState=node.state}}
+ <td>{{node.lastHealthUpdate}}</td>
+ <td>{{node.healthReport}}</td>
+ <td>{{node.numContainers}}</td>
+ <td>{{divide num=node.usedMemoryMB den=1024}} GB</td>
+ <td>{{divide num=node.availMemoryMB den=1024}} GB</td>
+ <td>{{node.usedVirtualCores}}</td>
+ <td>{{node.availableVirtualCores}}</td>
+ <td>{{node.version}}</td>
+ </tr>
+ {{/if}}
+ {{/each}}
+ {{/if}}
+ </tbody>
+</table>
+
+{{simple-table table-id="nodes-table" bFilter=true}}
+{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue.hbs
new file mode 100644
index 0000000..51a4fb4
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue.hbs
@@ -0,0 +1,66 @@
+{{!
+ * 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.
+}}
+
+<div class="container-fluid">
+ {{queue-navigator model=model.queues selected=model.selected}}
+</div>
+
+<div class="row">
+ <div class="col-lg-3 container-fluid">
+ {{queue-configuration-table queue=model.selectedQueue}}
+ </div>
+
+ <div class="col-lg-3 container-fluid" id="capacity-bar-chart">
+ {{bar-chart data=model.selectedQueue.capacitiesBarChartData
+ title="Queue Capacities"
+ parentId="capacity-bar-chart"
+ textWidth=150
+ ratio=0.5
+ maxHeight=350}}
+ </div>
+
+{{#if model.selectedQueue.hasUserUsages}}
+ <div class="col-lg-3 container-fluid" id="userusage-donut-chart">
+ {{donut-chart data=model.selectedQueue.userUsagesDonutChartData
+ title="User Usages"
+ showLabels=true
+ parentId="userusage-donut-chart"
+ maxHeight=350}}
+ </div>
+{{/if}}
+
+ <div class="col-lg-3 container-fluid" id="numapplications-donut-chart">
+ {{donut-chart data=model.selectedQueue.numOfApplicationsDonutChartData
+ title="Running Apps"
+ showLabels=true
+ parentId="numapplications-donut-chart"
+ ratio=0.5
+ maxHeight=350}}
+ </div>
+</div>
+
+<hr>
+
+<div class="row">
+ <div class="col-md-12 container-fluid">
+ {{app-table table-id="apps-table" arr=model.apps}}
+ {{simple-table table-id="apps-table" bFilter=true colTypes="elapsed-time" colTargets="7"}}
+ </div>
+</div>
+
+{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/converter.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/converter.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/converter.js
new file mode 100644
index 0000000..fd8f491
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/converter.js
@@ -0,0 +1,109 @@
+/**
+ * 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.
+ */
+
+import Constants from 'yarn-ui/constants';
+
+export default {
+ containerIdToAttemptId: function(containerId) {
+ if (containerId) {
+ var arr = containerId.split('_');
+ var attemptId = ["appattempt", arr[1],
+ arr[2], this.padding(arr[3], 6)];
+ return attemptId.join('_');
+ }
+ },
+ attemptIdToAppId: function(attemptId) {
+ if (attemptId) {
+ var arr = attemptId.split('_');
+ var appId = ["application", arr[1],
+ arr[2]].join('_');
+ return appId;
+ }
+ },
+ padding: function(str, toLen=2) {
+ str = str.toString();
+ if (str.length >= toLen) {
+ return str;
+ }
+ return '0'.repeat(toLen - str.length) + str;
+ },
+ resourceToString: function(mem, cpu) {
+ mem = Math.max(0, mem);
+ cpu = Math.max(0, cpu);
+ return mem + " MBs, " + cpu + " VCores";
+ },
+ msToElapsedTime: function(timeInMs) {
+ var sec_num = timeInMs / 1000; // don't forget the second param
+ var hours = Math.floor(sec_num / 3600);
+ var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
+ var seconds = sec_num - (hours * 3600) - (minutes * 60);
+
+ var timeStrArr = [];
+
+ if (hours > 0) {
+ timeStrArr.push(hours + ' Hrs');
+ }
+ if (minutes > 0) {
+ timeStrArr.push(minutes + ' Mins');
+ }
+ if (seconds > 0) {
+ timeStrArr.push(Math.round(seconds) + " Secs");
+ }
+ return timeStrArr.join(' : ');
+ },
+ elapsedTimeToMs: function(elapsedTime) {
+ elapsedTime = elapsedTime.toLowerCase();
+ var arr = elapsedTime.split(' : ');
+ var total = 0;
+ for (var i = 0; i < arr.length; i++) {
+ if (arr[i].indexOf('hr') > 0) {
+ total += parseInt(arr[i].substring(0, arr[i].indexOf(' '))) * 3600;
+ } else if (arr[i].indexOf('min') > 0) {
+ total += parseInt(arr[i].substring(0, arr[i].indexOf(' '))) * 60;
+ } else if (arr[i].indexOf('sec') > 0) {
+ total += parseInt(arr[i].substring(0, arr[i].indexOf(' ')));
+ }
+ }
+ return total * 1000;
+ },
+ timeStampToDate: function(timeStamp) {
+ var dateTimeString = moment(parseInt(timeStamp)).format("YYYY/MM/DD HH:mm:ss");
+ return dateTimeString;
+ },
+ dateToTimeStamp: function(date) {
+ if (date) {
+ var ts = moment(date, "YYYY/MM/DD HH:mm:ss").valueOf();
+ return ts;
+ }
+ },
+ splitForContainerLogs: function(id) {
+ if (id) {
+ var splits = id.split(Constants.PARAM_SEPARATOR);
+ var splitLen = splits.length;
+ if (splitLen < 3) {
+ return null;
+ }
+ var fileName = splits[2];
+ var index;
+ for (index = 3; index < splitLen; index++) {
+ fileName = fileName + Constants.PARAM_SEPARATOR + splits[index];
+ }
+ return [splits[0], splits[1], fileName];
+ }
+ },
+};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/sorter.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/sorter.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/sorter.js
new file mode 100644
index 0000000..febef6f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/sorter.js
@@ -0,0 +1,73 @@
+/**
+ * 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.
+ */
+
+import Converter from 'yarn-ui/utils/converter';
+import Ember from 'ember';
+
+export default {
+ _initElapsedTimeSorter: function() {
+ Ember.$.extend(Ember.$.fn.dataTableExt.oSort, {
+ "elapsed-time-pre": function (a) {
+ return Converter.padding(Converter.elapsedTimeToMs(a), 20);
+ },
+ });
+ },
+
+ _initNaturalSorter: function() {
+ Ember.$.extend(Ember.$.fn.dataTableExt.oSort, {
+ "natural-asc": function (a, b) {
+ return naturalSort(a,b);
+ },
+ "natural-desc": function (a, b) {
+ return naturalSort(a,b) * -1;
+ },
+ });
+ },
+
+ initDataTableSorter: function() {
+ this._initElapsedTimeSorter();
+ this._initNaturalSorter();
+ },
+};
+
+/**
+ * Natural sort implementation.
+ * Typically used to sort application Ids'.
+ */
+function naturalSort(a, b) {
+ var diff = a.length - b.length;
+ if (diff != 0) {
+ var splitA = a.split("_");
+ var splitB = b.split("_");
+ if (splitA.length != splitB.length) {
+ return a.localeCompare(b);
+ }
+ for (var i = 1; i < splitA.length; i++) {
+ var splitdiff = splitA[i].length - splitB[i].length;
+ if (splitdiff != 0) {
+ return splitdiff;
+ }
+ var splitCompare = splitA[i].localeCompare(splitB[i]);
+ if (splitCompare != 0) {
+ return splitCompare;
+ }
+ }
+ return diff;
+ }
+ return a.localeCompare(b);
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower.json
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower.json
new file mode 100644
index 0000000..de66650
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower.json
@@ -0,0 +1,22 @@
+{
+ "name": "yarn-ui",
+ "dependencies": {
+ "ember": "2.0.1",
+ "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.4",
+ "ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
+ "ember-data": "2.0.0",
+ "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.6",
+ "ember-qunit": "0.4.9",
+ "ember-qunit-notifications": "0.0.7",
+ "ember-resolver": "~0.1.18",
+ "jquery": "1.11.3",
+ "loader.js": "ember-cli/loader.js#3.2.1",
+ "qunit": "~1.18.0",
+ "bootstrap": "~3.3.2",
+ "d3": "~3.5.6",
+ "datatables": "~1.10.8",
+ "spin.js": "~2.3.2",
+ "momentjs": "~2.10.6",
+ "select2": "4.0.0"
+ }
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/environment.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/environment.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/environment.js
new file mode 100644
index 0000000..9a14068
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/environment.js
@@ -0,0 +1,65 @@
+/**
+ * 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.
+ */
+
+/* jshint node: true */
+
+module.exports = function(environment) {
+ var ENV = {
+ modulePrefix: 'yarn-ui',
+ environment: environment,
+ baseURL: '/',
+ locationType: 'auto',
+ EmberENV: {
+ FEATURES: {
+ // Here you can enable experimental features on an ember canary build
+ // e.g. 'with-controller': true
+ }
+ },
+
+ APP: {
+ // Here you can pass flags/options to your application instance
+ // when it is created
+ }
+ };
+
+ if (environment === 'development') {
+ // ENV.APP.LOG_RESOLVER = true;
+ // ENV.APP.LOG_ACTIVE_GENERATION = true;
+ // ENV.APP.LOG_TRANSITIONS = true;
+ // ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
+ // ENV.APP.LOG_VIEW_LOOKUPS = true;
+ }
+
+ if (environment === 'test') {
+ // Testem prefers this...
+ ENV.baseURL = '/';
+ ENV.locationType = 'none';
+
+ // keep test console output quieter
+ ENV.APP.LOG_ACTIVE_GENERATION = false;
+ ENV.APP.LOG_VIEW_LOOKUPS = false;
+
+ ENV.APP.rootElement = '#ember-testing';
+ }
+
+ if (environment === 'production') {
+
+ }
+
+ return ENV;
+};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js
new file mode 100644
index 0000000..cf5ad83
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js
@@ -0,0 +1,47 @@
+/**
+ * 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.
+ */
+
+/* global require, module */
+var EmberApp = require('ember-cli/lib/broccoli/ember-app');
+
+module.exports = function(defaults) {
+ var app = new EmberApp(defaults, {
+ // Add options here
+ });
+
+ app.import("bower_components/datatables/media/css/jquery.dataTables.min.css");
+ app.import("bower_components/datatables/media/js/jquery.dataTables.min.js");
+ app.import("bower_components/momentjs/min/moment.min.js");
+ app.import("bower_components/select2/dist/css/select2.min.css");
+ app.import("bower_components/select2/dist/js/select2.min.js");
+
+ // Use `app.import` to add additional libraries to the generated
+ // output files.
+ //
+ // If you need to use different assets in different
+ // environments, specify an object as the first parameter. That
+ // object's keys should be the environment name and the values
+ // should be the asset to use in that environment.
+ //
+ // If the library that you are including contains AMD or ES6
+ // modules that you would like to import into your application
+ // please specify an object with the list of modules as keys
+ // along with the exports of each module as its value.
+
+ return app.toTree();
+};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/jsconfig.json
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/jsconfig.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/jsconfig.json
new file mode 100644
index 0000000..875bb90
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/jsconfig.json
@@ -0,0 +1,6 @@
+{
+ "compilerOptions": {
+ "target": "ES6",
+ "module": "commonjs"
+ }
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json
new file mode 100644
index 0000000..b52ac1d
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json
@@ -0,0 +1,44 @@
+{
+ "name": "yarn-ui",
+ "version": "0.0.1",
+ "description": "New UI framework of Apache Hadoop YARN",
+ "private": true,
+ "directories": {
+ "doc": "doc",
+ "test": "tests"
+ },
+ "scripts": {
+ "build": "ember build",
+ "start": "ember server",
+ "test": "ember test"
+ },
+ "repository": "",
+ "engines": {
+ "node": ">= 0.10.0"
+ },
+ "author": "",
+ "license": "Apache",
+ "devDependencies": {
+ "broccoli-asset-rev": "^2.1.2",
+ "ember-bootstrap": "0.2.0",
+ "ember-cli": "1.13.8",
+ "ember-cli-app-version": "0.5.0",
+ "ember-cli-babel": "^5.1.3",
+ "ember-cli-content-security-policy": "0.4.0",
+ "ember-cli-dependency-checker": "^1.0.1",
+ "ember-cli-htmlbars": "0.7.9",
+ "ember-cli-htmlbars-inline-precompile": "^0.2.0",
+ "ember-cli-ic-ajax": "0.2.1",
+ "ember-cli-inject-live-reload": "^1.3.1",
+ "ember-cli-qunit": "^1.0.0",
+ "ember-cli-release": "0.2.3",
+ "ember-cli-sri": "^1.0.3",
+ "ember-cli-uglify": "^1.2.0",
+ "ember-d3": "0.1.0",
+ "ember-data": "1.13.8",
+ "ember-disable-proxy-controllers": "^1.0.0",
+ "ember-export-application-global": "^1.0.3",
+ "ember-spin-spinner": "0.2.3",
+ "select2": "4.0.0"
+ }
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/Sorting icons.psd
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/Sorting icons.psd b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/Sorting icons.psd
new file mode 100644
index 0000000..53b2e06
Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/Sorting icons.psd differ
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/favicon.ico
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/favicon.ico b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/favicon.ico
new file mode 100644
index 0000000..6eeaa2a
Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/favicon.ico differ
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_asc.png
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_asc.png b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_asc.png
new file mode 100644
index 0000000..e1ba61a
Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_asc.png differ
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_asc_disabled.png
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_asc_disabled.png b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_asc_disabled.png
new file mode 100644
index 0000000..fb11dfe
Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_asc_disabled.png differ
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_both.png
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_both.png b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_both.png
new file mode 100644
index 0000000..af5bc7c
Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_both.png differ
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_desc.png
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_desc.png b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_desc.png
new file mode 100644
index 0000000..0e156de
Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_desc.png differ
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_desc_disabled.png
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_desc_disabled.png b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_desc_disabled.png
new file mode 100644
index 0000000..c9fdd8a
Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/assets/images/datatables/sort_desc_disabled.png differ
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/crossdomain.xml
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/crossdomain.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/crossdomain.xml
new file mode 100644
index 0000000..43a2ea6
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/public/crossdomain.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+
+<!--
+* 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.
+-->
+
+<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
+<cross-domain-policy>
+ <!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->
+
+ <!-- Most restrictive policy: -->
+ <site-control permitted-cross-domain-policies="none"/>
+
+ <!-- Least restrictive policy: -->
+ <!--
+ <site-control permitted-cross-domain-policies="all"/>
+ <allow-access-from domain="*" to-ports="*" secure="false"/>
+ <allow-http-request-headers-from domain="*" headers="*" secure="false"/>
+ -->
+</cross-domain-policy>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/testem.json
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/testem.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/testem.json
new file mode 100644
index 0000000..0f35392
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/testem.json
@@ -0,0 +1,12 @@
+{
+ "framework": "qunit",
+ "test_page": "tests/index.html?hidepassed",
+ "disable_watching": true,
+ "launch_in_ci": [
+ "PhantomJS"
+ ],
+ "launch_in_dev": [
+ "PhantomJS",
+ "Chrome"
+ ]
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/helpers/resolver.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/helpers/resolver.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/helpers/resolver.js
new file mode 100644
index 0000000..f94998c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/helpers/resolver.js
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+import Resolver from 'ember/resolver';
+import config from '../../config/environment';
+
+var resolver = Resolver.create();
+
+resolver.namespace = {
+ modulePrefix: config.modulePrefix,
+ podModulePrefix: config.podModulePrefix
+};
+
+export default resolver;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/helpers/start-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/helpers/start-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/helpers/start-app.js
new file mode 100644
index 0000000..a7d05be
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/helpers/start-app.js
@@ -0,0 +1,36 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import Application from '../../app';
+import config from '../../config/environment';
+
+export default function startApp(attrs) {
+ var application;
+
+ var attributes = Ember.merge({}, config.APP);
+ attributes = Ember.merge(attributes, attrs); // use defaults, but you can override;
+
+ Ember.run(function() {
+ application = Application.create(attributes);
+ application.setupForTesting();
+ application.injectTestHelpers();
+ });
+
+ return application;
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/index.html
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/index.html b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/index.html
new file mode 100644
index 0000000..9681e8b
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/index.html
@@ -0,0 +1,51 @@
+<!--
+* 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.
+-->
+
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <title>YarnUi Tests</title>
+ <meta name="description" content="">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+
+ {{content-for 'head'}}
+ {{content-for 'test-head'}}
+
+ <link rel="stylesheet" href="assets/vendor.css">
+ <link rel="stylesheet" href="assets/yarn-ui.css">
+ <link rel="stylesheet" href="assets/test-support.css">
+
+ {{content-for 'head-footer'}}
+ {{content-for 'test-head-footer'}}
+ </head>
+ <body>
+
+ {{content-for 'body'}}
+ {{content-for 'test-body'}}
+ <script src="assets/vendor.js"></script>
+ <script src="assets/test-support.js"></script>
+ <script src="assets/yarn-ui.js"></script>
+ <script src="testem.js"></script>
+ <script src="assets/test-loader.js"></script>
+
+ {{content-for 'body-footer'}}
+ {{content-for 'test-body-footer'}}
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/test-helper.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/test-helper.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/test-helper.js
new file mode 100644
index 0000000..96975ee
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/test-helper.js
@@ -0,0 +1,24 @@
+/**
+ * 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.
+ */
+
+import resolver from './helpers/resolver';
+import {
+ setResolver
+} from 'ember-qunit';
+
+setResolver(resolver);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-app-test.js
new file mode 100644
index 0000000..726345f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-app-test.js
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('adapter:yarn-app', 'Unit | Adapter | yarn app', {
+ // Specify the other units that are required for this test.
+ // needs: ['serializer:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ var adapter = this.subject();
+ assert.ok(adapter);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-container-log-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-container-log-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-container-log-test.js
new file mode 100644
index 0000000..e6e7b43
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-container-log-test.js
@@ -0,0 +1,73 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+import Constants from 'yarn-ui/constants';
+
+moduleFor('adapter:yarn-container-log', 'Unit | Adapter | ContainerLog', {
+});
+
+test('Basic creation', function(assert) {
+ let adapter = this.subject();
+
+ assert.ok(adapter);
+ assert.ok(adapter.urlForFindRecord);
+ assert.ok(adapter.ajax);
+ assert.ok(adapter.headers);
+ assert.ok(adapter.host);
+ assert.ok(adapter.namespace);
+ assert.equal(adapter.headers.Accept, "text/plain");
+ assert.equal(adapter.namespace, "ws/v1/node");
+});
+
+test('urlForFindRecord test', function(assert) {
+ let adapter = this.subject();
+ let host = adapter.host;
+ assert.equal(adapter.urlForFindRecord("localhost:8042" +
+ Constants.PARAM_SEPARATOR + "container_e27_11111111111_0001_01_000001" +
+ Constants.PARAM_SEPARATOR + "syslog"),
+ host + "localhost:8042/ws/v1/node/containerlogs/" +
+ "container_e27_11111111111_0001_01_000001/syslog");
+});
+
+test('ajaxOptions test', function(assert) {
+ let adapter = this.subject();
+ var hash = adapter.ajaxOptions('/containerlogs', 'type', {});
+ assert.equal(hash.dataType, 'text');
+});
+
+test('findRecord test', function(assert) {
+ let adapter = this.subject(),
+ testModel = { modelName: "testModel" },
+ testStore = {},
+ testSnapshot = {};
+ let host = adapter.host;
+ let testId = "localhost:8042" + Constants.PARAM_SEPARATOR +
+ "container_e27_11111111111_0001_01_000001" + Constants.PARAM_SEPARATOR +
+ "syslog";
+ assert.expect(2);
+
+ adapter.ajax = function (url, method) {
+ assert.equal(url, host + "localhost:8042/ws/v1/node/containerlogs/" +
+ "container_e27_11111111111_0001_01_000001/syslog");
+ assert.equal(method, 'GET');
+ };
+
+ adapter.findRecord(testStore, testModel, testId, testSnapshot);
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-app-test.js
new file mode 100644
index 0000000..3a25996
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-app-test.js
@@ -0,0 +1,93 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('adapter:yarn-node-app', 'Unit | Adapter | NodeApp', {
+});
+
+test('Basic creation', function(assert) {
+ let adapter = this.subject();
+ assert.expect(11);
+ assert.ok(adapter);
+ assert.ok(adapter.urlForQueryRecord);
+ assert.ok(adapter.queryRecord);
+ assert.ok(adapter.urlForQuery);
+ assert.ok(adapter.query);
+ assert.ok(adapter.ajax);
+ assert.ok(adapter.headers);
+ assert.ok(adapter.host);
+ assert.ok(adapter.namespace);
+ assert.equal("application/json", adapter.headers.Accept);
+ assert.equal("ws/v1/node", adapter.namespace);
+});
+
+test('urlForQueryRecord test', function(assert) {
+ let adapter = this.subject();
+ let host = adapter.host;
+ assert.equal(
+ host + "localhost:8042/ws/v1/node/apps/application_1111111111_1111",
+ adapter.urlForQueryRecord(
+ {nodeAddr: "localhost:8042", appId: "application_1111111111_1111"}));
+});
+
+test('urlForQuery test', function(assert) {
+ let adapter = this.subject();
+ let host = adapter.host;
+ assert.equal(host + "localhost:8042/ws/v1/node/apps",
+ adapter.urlForQuery({nodeAddr: "localhost:8042"}));
+});
+
+test('query test', function(assert) {
+ let adapter = this.subject(),
+ testModel = { modelName: "testModel" },
+ testStore = {},
+ testQuery = {nodeAddr: "localhost:8042"};
+ let host = adapter.host;
+ assert.expect(3);
+
+ adapter.ajax = function (url, method, hash) {
+ assert.equal(host + "localhost:8042/ws/v1/node/apps", url);
+ assert.equal('GET', method);
+ assert.equal(null, hash.data);
+ };
+
+ adapter.query(testStore, testModel, testQuery);
+});
+
+test('queryRecord test', function(assert) {
+ let adapter = this.subject(),
+ testModel = { modelName: "testModel" },
+ testStore = {},
+ testQuery = {
+ nodeAddr: "localhost:8042",
+ appId: "application_1111111111_1111"
+ };
+ let host = adapter.host;
+ assert.expect(3);
+
+ adapter.ajax = function (url, method, hash) {
+ assert.equal(
+ host + "localhost:8042/ws/v1/node/apps/application_1111111111_1111",
+ url);
+ assert.equal('GET', method);
+ assert.equal(null, hash.data);
+ };
+
+ adapter.queryRecord(testStore, testModel, testQuery);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-container-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-container-test.js
new file mode 100644
index 0000000..7d2bb2d
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-container-test.js
@@ -0,0 +1,93 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('adapter:yarn-node-container', 'Unit | Adapter | NodeContainer', {
+});
+
+test('Basic creation', function(assert) {
+ let adapter = this.subject();
+ assert.expect(11);
+ assert.ok(adapter);
+ assert.ok(adapter.urlForQueryRecord);
+ assert.ok(adapter.queryRecord);
+ assert.ok(adapter.urlForQuery);
+ assert.ok(adapter.query);
+ assert.ok(adapter.ajax);
+ assert.ok(adapter.headers);
+ assert.ok(adapter.host);
+ assert.ok(adapter.namespace);
+ assert.equal("application/json", adapter.headers.Accept);
+ assert.equal("ws/v1/node", adapter.namespace);
+});
+
+test('urlForQueryRecord test', function(assert) {
+ let adapter = this.subject();
+ let host = adapter.host;
+ assert.equal(host + "localhost:8042/ws/v1/node/containers/" +
+ "container_e27_11111111111_0001_01_000001",
+ adapter.urlForQueryRecord(
+ {nodeHttpAddr: "localhost:8042",
+ containerId: "container_e27_11111111111_0001_01_000001"}));
+});
+
+test('urlForQuery test', function(assert) {
+ let adapter = this.subject();
+ let host = adapter.host;
+ assert.equal(host + "localhost:8042/ws/v1/node/containers",
+ adapter.urlForQuery({nodeHttpAddr: "localhost:8042"}));
+});
+
+test('query test', function(assert) {
+ let adapter = this.subject(),
+ testModel = { modelName: "testModel" },
+ testStore = {},
+ testQuery = {nodeHttpAddr: "localhost:8042"};
+ let host = adapter.host;
+ assert.expect(3);
+
+ adapter.ajax = function (url, method, hash) {
+ assert.equal(host + "localhost:8042/ws/v1/node/containers", url);
+ assert.equal('GET', method);
+ assert.equal(null, hash.data);
+ };
+
+ adapter.query(testStore, testModel, testQuery);
+});
+
+test('queryRecord test', function(assert) {
+ let adapter = this.subject(),
+ testModel = { modelName: "testModel" },
+ testStore = {},
+ testQuery = {
+ nodeHttpAddr: "localhost:8042",
+ containerId: "container_e27_11111111111_0001_01_000001"
+ };
+ let host = adapter.host;
+ assert.expect(3);
+
+ adapter.ajax = function (url, method, hash) {
+ assert.equal(host + "localhost:8042/ws/v1/node/containers/" +
+ "container_e27_11111111111_0001_01_000001", url);
+ assert.equal('GET', method);
+ assert.equal(null, hash.data);
+ };
+
+ adapter.queryRecord(testStore, testModel, testQuery);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-test.js
new file mode 100644
index 0000000..15aefef
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-node-test.js
@@ -0,0 +1,42 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('adapter:yarn-node', 'Unit | Adapter | Node', {
+});
+
+test('Basic creation', function(assert) {
+ let adapter = this.subject();
+
+ assert.ok(adapter);
+ assert.ok(adapter.urlForFindRecord);
+ assert.ok(adapter.ajax);
+ assert.ok(adapter.headers);
+ assert.ok(adapter.host);
+ assert.ok(adapter.namespace);
+ assert.equal(adapter.headers.Accept, "application/json");
+ assert.equal(adapter.namespace, "ws/v1/node");
+});
+
+test('urlForFindRecord test', function(assert) {
+ let adapter = this.subject();
+ let host = adapter.host;
+ assert.equal(adapter.urlForFindRecord("localhost:8042"),
+ host + "localhost:8042/ws/v1/node");
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-rm-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-rm-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-rm-node-test.js
new file mode 100644
index 0000000..bf009d4
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/adapters/yarn-rm-node-test.js
@@ -0,0 +1,44 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('adapter:yarn-rm-node', 'Unit | Adapter | RMNode', {
+ // Specify the other units that are required for this test.
+ // needs: ['serializer:foo']
+});
+
+test('Basic creation', function(assert) {
+ let adapter = this.subject();
+
+ assert.ok(adapter);
+ assert.ok(adapter.urlForFindRecord);
+ assert.ok(adapter.ajax);
+ assert.ok(adapter.headers);
+ assert.ok(adapter.host);
+ assert.ok(adapter.namespace);
+ assert.equal(adapter.headers.Accept, "application/json");
+ assert.equal(adapter.namespace, "ws/v1/cluster");
+});
+
+test('urlForFindRecord test', function(assert) {
+ let adapter = this.subject();
+ let host = adapter.host;
+ assert.equal(adapter.urlForFindRecord("localhost:8042"),
+ host + "/ws/v1/cluster/nodes/localhost:8042");
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-apps-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-apps-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-apps-test.js
new file mode 100644
index 0000000..baa67cc
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-apps-test.js
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('controller:yarn-apps', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ var controller = this.subject();
+ assert.ok(controller);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-queues-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-queues-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-queues-test.js
new file mode 100644
index 0000000..39cf493
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-queues-test.js
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('controller:yarn-queues', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ var controller = this.subject();
+ assert.ok(controller);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/mixins/charts-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/mixins/charts-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/mixins/charts-test.js
new file mode 100644
index 0000000..1f5ab99
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/mixins/charts-test.js
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import ChartsMixin from '../../../mixins/charts';
+import { module, test } from 'qunit';
+
+module('Unit | Mixin | charts');
+
+// Replace this with your real tests.
+test('it works', function(assert) {
+ var ChartsObject = Ember.Object.extend(ChartsMixin);
+ var subject = ChartsObject.create();
+ assert.ok(subject);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-app-test.js
new file mode 100644
index 0000000..8b6df23
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-app-test.js
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+
+import { moduleForModel, test } from 'ember-qunit';
+
+moduleForModel('yarn-app', 'Unit | Model | yarn app', {
+ // Specify the other units that are required for this test.
+ needs: []
+});
+
+test('it exists', function(assert) {
+ var model = this.subject();
+ // var store = this.store();
+ assert.ok(!!model);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-container-log-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-container-log-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-container-log-test.js
new file mode 100644
index 0000000..45808a5
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-container-log-test.js
@@ -0,0 +1,48 @@
+/**
+ * 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.
+ */
+
+import { moduleForModel, test } from 'ember-qunit';
+
+moduleForModel('yarn-container-log', 'Unit | Model | ContainerLog', {
+ // Specify the other units that are required for this test.
+ needs: []
+});
+
+test('Basic creation test', function(assert) {
+ let model = this.subject();
+ assert.ok(model);
+ assert.ok(model._notifyProperties);
+ assert.ok(model.didLoad);
+ assert.ok(model.logs);
+ assert.ok(model.containerID);
+ assert.ok(model.logFileName);
+});
+
+test('test fields', function(assert) {
+ let model = this.subject();
+
+ Ember.run(function () {
+ model.set("logs", "This is syslog");
+ model.set("containerID", "container_e32_1456000363780_0002_01_000001");
+ model.set("logFileName", "syslog");
+ assert.equal(model.get("logs"), "This is syslog");
+ assert.equal(model.get("containerID"), "container_e32_1456000363780_0002_01_000001");
+ assert.equal(model.get("logFileName"), "syslog");
+ });
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-app-test.js
new file mode 100644
index 0000000..7e2e62f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-app-test.js
@@ -0,0 +1,65 @@
+/**
+ * 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.
+ */
+
+import { moduleForModel, test } from 'ember-qunit';
+
+moduleForModel('yarn-node-app', 'Unit | Model | NodeApp', {
+ // Specify the other units that are required for this test.
+ needs: []
+});
+
+test('Basic creation test', function(assert) {
+ let model = this.subject();
+
+ assert.ok(model);
+ assert.ok(model._notifyProperties);
+ assert.ok(model.didLoad);
+ assert.ok(model.appId);
+ assert.ok(model.state);
+ assert.ok(model.user);
+ assert.ok(model.containers);
+});
+
+test('test fields', function(assert) {
+ let model = this.subject();
+
+ assert.expect(9);
+ Ember.run(function () {
+ model.set("appId", "application_1456251210105_0002");
+ model.set("id", "application_1456251210105_0002");
+ model.set("state", "RUNNING");
+ model.set("user", "hadoop");
+ model.set("containers", ["container_e38_1456251210105_0002_01_000001",
+ "container_e38_1456251210105_0002_01_000002"]);
+ assert.equal(model.get("appId"), "application_1456251210105_0002");
+ assert.equal(model.get("state"), "RUNNING");
+ assert.equal(model.get("user"), "hadoop");
+ assert.deepEqual(model.get("containers"),
+ ["container_e38_1456251210105_0002_01_000001",
+ "container_e38_1456251210105_0002_01_000002"]);
+ assert.equal(model.get("appStateStyle"), "label label-primary");
+ assert.equal(model.get("isDummyApp"), false);
+ model.set("id", "dummy");
+ assert.equal(model.get("isDummyApp"), true);
+ model.set("state", "FINISHED");
+ assert.equal(model.get("appStateStyle"), "label label-success");
+ model.set("state", "NEW");
+ assert.equal(model.get("appStateStyle"), "label label-default");
+ });
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-container-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-container-test.js
new file mode 100644
index 0000000..88bf233
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-container-test.js
@@ -0,0 +1,78 @@
+/**
+ * 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.
+ */
+
+import { moduleForModel, test } from 'ember-qunit';
+
+moduleForModel('yarn-node-container', 'Unit | Model | NodeContainer', {
+ // Specify the other units that are required for this test.
+ needs: []
+});
+
+test('Basic creation test', function(assert) {
+ let model = this.subject();
+
+ assert.ok(model);
+ assert.ok(model._notifyProperties);
+ assert.ok(model.didLoad);
+ assert.ok(model.containerId);
+ assert.ok(model.state);
+ assert.ok(model.user);
+ assert.ok(model.exitCode);
+ assert.ok(model.totalMemoryNeeded);
+ assert.ok(model.totalVCoresNeeded);
+ assert.ok(model.containerLogFiles);
+ assert.ok(model.isDummyContainer);
+ assert.ok(model.containerStateStyle);
+});
+
+test('test fields', function(assert) {
+ let model = this.subject();
+
+ Ember.run(function () {
+ model.set("containerId", "container_e32_1456000363780_0002_01_000003");
+ model.set("state", "RUNNING");
+ model.set("exitCode", "-1000");
+ model.set("user", "hadoop");
+ model.set("id", "container_e32_1456000363780_0002_01_000003");
+ model.set("totalMemoryNeeded", 1024);
+ model.set("totalVCoresNeeded", 1);
+ model.set("containerLogFiles", ["syslog", "stderr", "stdout"]);
+ assert.equal(model.get("containerId"), "container_e32_1456000363780_0002_01_000003");
+ assert.equal(model.get("id"), "container_e32_1456000363780_0002_01_000003");
+ assert.equal(model.get("totalMemoryNeeded"), 1024);
+ assert.equal(model.get("totalVCoresNeeded"), 1);
+ assert.equal(model.get("user"), "hadoop");
+ assert.equal(model.get("exitCode"), "-1000");
+ assert.equal(model.get("containerLogFiles").length, 3);
+ assert.deepEqual(model.get("containerLogFiles"), ["syslog", "stderr", "stdout"]);
+ assert.equal(model.get("isDummyContainer"), false);
+ assert.equal(model.get("containerStateStyle"), "label label-primary");
+ model.set("id", "dummy");
+ assert.equal(model.get("isDummyContainer"), true);
+ model.set("state", "EXITED_WITH_SUCCESS");
+ assert.equal(model.get("containerStateStyle"), "label label-success");
+ model.set("state", "EXITED_WITH_FAILURE");
+ assert.equal(model.get("containerStateStyle"), "label label-danger");
+ model.set("state", "DONE");
+ model.set("exitCode", "0");
+ assert.equal(model.get("containerStateStyle"), "label label-success");
+ model.set("exitCode", "-105");
+ assert.equal(model.get("containerStateStyle"), "label label-danger");
+ });
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-test.js
new file mode 100644
index 0000000..5877589
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-node-test.js
@@ -0,0 +1,58 @@
+/**
+ * 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.
+ */
+
+import { moduleForModel, test } from 'ember-qunit';
+
+moduleForModel('yarn-node', 'Unit | Model | Node', {
+ // Specify the other units that are required for this test.
+ needs: []
+});
+
+test('Basic creation test', function(assert) {
+ let model = this.subject();
+
+ assert.ok(model);
+ assert.ok(model._notifyProperties);
+ assert.ok(model.didLoad);
+ assert.ok(model.totalVmemAllocatedContainersMB);
+ assert.ok(model.vmemCheckEnabled);
+ assert.ok(model.pmemCheckEnabled);
+ assert.ok(model.nodeHealthy);
+ assert.ok(model.lastNodeUpdateTime);
+ assert.ok(model.healthReport);
+ assert.ok(model.nmStartupTime);
+ assert.ok(model.nodeManagerBuildVersion);
+ assert.ok(model.hadoopBuildVersion);
+});
+
+test('test fields', function(assert) {
+ let model = this.subject();
+
+ assert.expect(4);
+ Ember.run(function () {
+ model.set("totalVmemAllocatedContainersMB", 4096);
+ model.set("totalPmemAllocatedContainersMB", 2048);
+ model.set("totalVCoresAllocatedContainers", 4);
+ model.set("hadoopBuildVersion", "3.0.0-SNAPSHOT");
+ assert.equal(model.get("totalVmemAllocatedContainersMB"), 4096);
+ assert.equal(model.get("totalPmemAllocatedContainersMB"), 2048);
+ assert.equal(model.get("totalVCoresAllocatedContainers"), 4);
+ assert.equal(model.get("hadoopBuildVersion"), "3.0.0-SNAPSHOT");
+ });
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-rm-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-rm-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-rm-node-test.js
new file mode 100644
index 0000000..4fd2517
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/models/yarn-rm-node-test.js
@@ -0,0 +1,95 @@
+/**
+ * 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.
+ */
+
+import { moduleForModel, test } from 'ember-qunit';
+
+moduleForModel('yarn-rm-node', 'Unit | Model | RMNode', {
+ // Specify the other units that are required for this test.
+ needs: []
+});
+
+test('Basic creation test', function(assert) {
+ let model = this.subject();
+
+ assert.ok(model);
+ assert.ok(model._notifyProperties);
+ assert.ok(model.didLoad);
+ assert.ok(model.rack);
+ assert.ok(model.state);
+ assert.ok(model.nodeHostName);
+ assert.ok(model.nodeHTTPAddress);
+ assert.ok(model.lastHealthUpdate);
+ assert.ok(model.healthReport);
+ assert.ok(model.numContainers);
+ assert.ok(model.usedMemoryMB);
+ assert.ok(model.availMemoryMB);
+ assert.ok(model.usedVirtualCores);
+ assert.ok(model.availableVirtualCores);
+ assert.ok(model.version);
+ assert.ok(model.nodeLabels);
+ assert.ok(model.nodeLabelsAsString);
+ assert.ok(model.nodeStateStyle);
+ assert.ok(model.isDummyNode);
+ assert.ok(model.getMemoryDataForDonutChart);
+ assert.ok(model.getVCoreDataForDonutChart);
+});
+
+test('test fields', function(assert) {
+ let model = this.subject();
+
+ Ember.run(function () {
+ model.set("rack", "/default-rack");
+ model.set("state", "RUNNING");
+ model.set("nodeHostName", "localhost");
+ model.set("id", "localhost:64318");
+ model.set("nodeHTTPAddress", "localhost:8042");
+ model.set("usedMemoryMB", 1024);
+ model.set("availMemoryMB", 7168);
+ model.set("usedVirtualCores", 1);
+ model.set("availableVirtualCores", 7);
+ model.set("nodeLabels", ["x"]);
+ assert.equal(model.get("rack"), "/default-rack");
+ assert.equal(model.get("state"), "RUNNING");
+ assert.equal(model.get("nodeHostName"), "localhost");
+ assert.equal(model.get("id"), "localhost:64318");
+ assert.equal(model.get("nodeHTTPAddress"), "localhost:8042");
+ assert.equal(model.get("usedMemoryMB"), 1024);
+ assert.equal(model.get("availMemoryMB"), 7168);
+ assert.equal(model.get("usedVirtualCores"), 1);
+ assert.equal(model.get("availableVirtualCores"), 7);
+ assert.equal(model.get("isDummyNode"), false);
+ assert.deepEqual(model.get("nodeLabels"), ["x"]);
+ assert.equal(model.get("nodeLabelsAsString"), "x");
+ assert.deepEqual(model.get("nodeStateStyle"), "label label-success");
+ assert.deepEqual(model.get("getMemoryDataForDonutChart"),
+ [{label: "Used", value: 1024}, {label: "Available", value: 7168}]);
+ assert.deepEqual(model.get("getVCoreDataForDonutChart"),
+ [{label: "Used", value: 1}, {label: "Available", value: 7}]);
+ model.set("state", "SHUTDOWN");
+ assert.deepEqual(model.get("nodeStateStyle"), "label label-danger");
+ model.set("state", "REBOOTED");
+ assert.deepEqual(model.get("nodeStateStyle"), "label label-warning");
+ model.set("state", "NEW");
+ assert.deepEqual(model.get("nodeStateStyle"), "label label-default");
+ model.set("nodeLabels", ["x","y"]);
+ assert.equal(model.get("nodeLabelsAsString"), "x");
+ model.set("nodeLabels", undefined);
+ assert.equal(model.get("nodeLabelsAsString"), "");
+ });
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-apps-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-apps-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-apps-test.js
new file mode 100644
index 0000000..3a69c9f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-apps-test.js
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:yarn-apps', 'Unit | Route | yarn apps', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+test('it exists', function(assert) {
+ var route = this.subject();
+ assert.ok(route);
+});
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[31/50] [abbrv] hadoop git commit: YARN-4517. Add nodes page and fix
bunch of license issues. (Varun Saxena via wangda)
Posted by wa...@apache.org.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-app-test.js
new file mode 100644
index 0000000..21a715c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-app-test.js
@@ -0,0 +1,102 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('serializer:yarn-node-app', 'Unit | Serializer | NodeApp', {
+});
+
+test('Basic creation test', function(assert) {
+ let serializer = this.subject();
+
+ assert.ok(serializer);
+ assert.ok(serializer.normalizeSingleResponse);
+ assert.ok(serializer.normalizeArrayResponse);
+ assert.ok(serializer.internalNormalizeSingleResponse);
+});
+
+test('normalizeArrayResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-node-app"
+ },
+ payload = {
+ apps: {
+ app: [{
+ id:"application_1456251210105_0001", state:"FINISHED", user:"root"
+ },{
+ id:"application_1456251210105_0002", state:"RUNNING",user:"root",
+ containerids:["container_e38_1456251210105_0002_01_000001",
+ "container_e38_1456251210105_0002_01_000002"]
+ }]
+ }
+ };
+ assert.expect(15);
+ var response =
+ serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ assert.ok(response.data);
+ assert.equal(response.data.length, 2);
+ assert.equal(response.data[0].attributes.containers, undefined);
+ assert.equal(response.data[1].attributes.containers.length, 2);
+ assert.deepEqual(response.data[1].attributes.containers,
+ payload.apps.app[1].containerids);
+ for (var i = 0; i < 2; i++) {
+ assert.equal(response.data[i].type, modelClass.modelName);
+ assert.equal(response.data[i].id, payload.apps.app[i].id);
+ assert.equal(response.data[i].attributes.appId, payload.apps.app[i].id);
+ assert.equal(response.data[i].attributes.state, payload.apps.app[i].state);
+ assert.equal(response.data[i].attributes.user, payload.apps.app[i].user);
+ }
+});
+
+test('normalizeArrayResponse no apps test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-node-app"
+ },
+ payload = { apps: null };
+ assert.expect(5);
+ var response =
+ serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ assert.ok(response.data);
+ assert.equal(response.data.length, 1);
+ assert.equal(response.data[0].type, modelClass.modelName);
+ assert.equal(response.data[0].id, "dummy");
+ assert.equal(response.data[0].attributes.appId, undefined);
+});
+
+test('normalizeSingleResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-node-app"
+ },
+ payload = {
+ app: {id:"application_1456251210105_0001", state:"FINISHED", user:"root"}
+ };
+ assert.expect(7);
+ var response =
+ serializer.normalizeSingleResponse({}, modelClass, payload, null, null);
+ assert.ok(response.data);
+ assert.equal(payload.app.id, response.data.id);
+ assert.equal(modelClass.modelName, response.data.type);
+ assert.equal(payload.app.id, response.data.attributes.appId);
+ assert.equal(payload.app.state, response.data.attributes.state);
+ assert.equal(payload.app.user, response.data.attributes.user);
+ assert.equal(response.data.attributes.containers, undefined);
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-container-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-container-test.js
new file mode 100644
index 0000000..1f08467
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-container-test.js
@@ -0,0 +1,128 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('serializer:yarn-node-container', 'Unit | Serializer | NodeContainer', {
+});
+
+test('Basic creation test', function(assert) {
+ let serializer = this.subject();
+
+ assert.ok(serializer);
+ assert.ok(serializer.normalizeSingleResponse);
+ assert.ok(serializer.normalizeArrayResponse);
+ assert.ok(serializer.internalNormalizeSingleResponse);
+});
+
+test('normalizeArrayResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-node-container"
+ },
+ payload = {
+ containers: {
+ container: [{
+ id: "container_e32_1456000363780_0002_01_000001", state: "RUNNING",
+ exitCode:-1000,diagnostics:"",user:"root",totalMemoryNeededMB:2048,
+ totalVCoresNeeded:1,containerLogsLink: "http://localhost:8042/node/" +
+ "containerlogs/container_e32_1456000363780_0002_01_000001/root",
+ nodeId: "localhost:64318", containerLogFiles:["syslog","stderr",
+ "stdout"]
+ },{
+ id:"container_e32_1456000363780_0002_01_000003", state:"RUNNING",
+ exitCode:-1000, diagnostics:"", user:"root", totalMemoryNeededMB:1024,
+ totalVCoresNeeded:1,containerLogsLink:"http://localhost:8042/node" +
+ "/containerlogs/container_e32_1456000363780_0002_01_000003/root",
+ nodeId:"localhost:64318",containerLogFiles:["syslog","stderr",
+ "syslog.shuffle","stdout"]
+ }]
+ }
+ };
+ assert.expect(14);
+ var response =
+ serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ assert.ok(response.data);
+ assert.equal(response.data.length, 2);
+ assert.equal(response.data[0].id,
+ "container_e32_1456000363780_0002_01_000001");
+ assert.equal(response.data[1].id,
+ "container_e32_1456000363780_0002_01_000003");
+ assert.equal(response.data[0].attributes.containerLogFiles.length, 3);
+ assert.equal(response.data[1].attributes.containerLogFiles.length, 4);
+ for (var i = 0; i < 2; i++) {
+ assert.equal(response.data[i].type, modelClass.modelName);
+ assert.deepEqual(response.data[i].attributes.containerLogFiles,
+ payload.containers.container[i].containerLogFiles);
+ assert.equal(response.data[i].attributes.state,
+ payload.containers.container[i].state);
+ assert.equal(response.data[i].attributes.user,
+ payload.containers.container[i].user);
+ }
+});
+
+test('normalizeArrayResponse no containers test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-node-container"
+ },
+ payload = { containers: null };
+ assert.expect(5);
+ var response =
+ serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ assert.ok(response.data);
+ assert.equal(response.data.length, 1);
+ assert.equal(response.data[0].type, modelClass.modelName);
+ assert.equal(response.data[0].id, "dummy");
+ assert.equal(response.data[0].attributes.containerId, undefined);
+});
+
+test('normalizeSingleResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-node-container"
+ },
+ payload = {
+ container: {
+ id: "container_e32_1456000363780_0002_01_000001", state: "RUNNING",
+ exitCode:-1000,diagnostics:"",user:"root",totalMemoryNeededMB:2048,
+ totalVCoresNeeded:1,containerLogsLink: "http://localhost:8042/node/" +
+ "containerlogs/container_e32_1456000363780_0002_01_000001/root",
+ nodeId: "localhost:64318", containerLogFiles:["syslog","stderr",
+ "stdout"]
+ }
+ };
+ assert.expect(11);
+ var response =
+ serializer.normalizeSingleResponse({}, modelClass, payload, null, null);
+ assert.ok(response.data);
+ assert.equal(response.data.id, payload.container.id);
+ assert.equal(response.data.type, modelClass.modelName);
+ assert.equal(response.data.attributes.containerId, payload.container.id);
+ assert.equal(response.data.attributes.state, payload.container.state);
+ assert.equal(response.data.attributes.user, payload.container.user);
+ assert.equal(response.data.attributes.exitCode, payload.container.exitCode);
+ assert.equal(response.data.attributes.totalMemoryNeededMB,
+ payload.container.totalMemoryNeeded);
+ assert.equal(response.data.attributes.totalVCoresNeeded,
+ payload.container.totalVCoresNeeded);
+ assert.equal(response.data.attributes.containerLogFiles.length, 3);
+ assert.deepEqual(response.data.attributes.containerLogFiles,
+ payload.container.containerLogFiles);
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-test.js
new file mode 100644
index 0000000..0e76ccb
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-test.js
@@ -0,0 +1,69 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+import Converter from 'yarn-ui/utils/converter';
+
+moduleFor('serializer:yarn-node', 'Unit | Serializer | Node', {
+});
+
+test('Basic creation test', function(assert) {
+ let serializer = this.subject();
+
+ assert.ok(serializer);
+ assert.ok(serializer.normalizeSingleResponse);
+ assert.ok(serializer.internalNormalizeSingleResponse);
+});
+
+test('normalizeSingleResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-node"
+ },
+ payload = {
+ nodeInfo: {
+ healthReport: "Healthy", totalVmemAllocatedContainersMB: 344064,
+ totalPmemAllocatedContainersMB: 163840,
+ totalVCoresAllocatedContainers: 160,
+ vmemCheckEnabled: true, pmemCheckEnabled: true,
+ lastNodeUpdateTime: 1456250210310, nodeHealthy: true,
+ nodeManagerVersion: "3.0.0-SNAPSHOT",
+ nodeManagerBuildVersion: "3.0.0-SNAPSHOT",
+ nodeManagerVersionBuiltOn: "2000-01-01T00:00Z",
+ hadoopVersion: "3.0.0-SNAPSHOT",
+ hadoopBuildVersion: "3.0.0-SNAPSHOT",
+ hadoopVersionBuiltOn: "2000-01-01T00:00Z",
+ id: "localhost:64318", nodeHostName: "192.168.0.102",
+ nmStartupTime: 1456250208231
+ }
+ };
+ assert.expect(6);
+ var id = "localhost:64318";
+ var response = serializer.normalizeSingleResponse({}, modelClass, payload, id, null);
+ assert.equal(response.data.id, id);
+ assert.equal(response.data.type, modelClass.modelName);
+ assert.equal(response.data.attributes.totalVmemAllocatedContainersMB,
+ payload.nodeInfo.totalVmemAllocatedContainersMB);
+ assert.equal(response.data.attributes.totalPmemAllocatedContainersMB,
+ payload.nodeInfo.totalPmemAllocatedContainersMB);
+ assert.equal(response.data.attributes.totalVCoresAllocatedContainers,
+ payload.nodeInfo.totalVCoresAllocatedContainers);
+ assert.equal(response.data.attributes.nmStartupTime,
+ Converter.timeStampToDate(payload.nodeInfo.nmStartupTime));
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-rm-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-rm-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-rm-node-test.js
new file mode 100644
index 0000000..bc6397d
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-rm-node-test.js
@@ -0,0 +1,153 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('serializer:yarn-rm-node', 'Unit | Serializer | RMNode', {
+});
+
+test('Basic creation test', function(assert) {
+ let serializer = this.subject();
+
+ assert.ok(serializer);
+ assert.ok(serializer.normalizeSingleResponse);
+ assert.ok(serializer.normalizeArrayResponse);
+ assert.ok(serializer.internalNormalizeSingleResponse);
+});
+
+test('normalizeArrayResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-rm-node"
+ },
+ payload = {
+ nodes: {
+ node: [{
+ rack: "/default-rack", state: "RUNNING", id: "192.168.1.1:64318",
+ nodeHostName: "192.168.1.1", nodeHTTPAddress: "192.168.1.1:8042",
+ lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
+ healthReport: "", numContainers: 0, usedMemoryMB: 2048,
+ availMemoryMB: 161792, usedVirtualCores: 2,
+ availableVirtualCores: 158, nodeLabels: ["x"],
+ resourceUtilization: {
+ nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
+ nodeCPUUsage: 0.14995001256465912,
+ aggregatedContainersPhysicalMemoryMB: 0,
+ aggregatedContainersVirtualMemoryMB: 0,
+ containersCPUUsage: 0
+ }
+ },{
+ rack: "/default-rack", state: "RUNNING", id: "192.168.1.2:64318",
+ nodeHostName: "192.168.1.2", nodeHTTPAddress: "192.168.1.2:8042",
+ lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
+ healthReport: "", numContainers: 0, usedMemoryMB: 0,
+ availMemoryMB: 163840, usedVirtualCores: 0,
+ availableVirtualCores: 160, nodeLabels: ["y"],
+ resourceUtilization: {
+ nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
+ nodeCPUUsage: 0.14995001256465912,
+ aggregatedContainersPhysicalMemoryMB: 0,
+ aggregatedContainersVirtualMemoryMB: 0,
+ containersCPUUsage: 0
+ }
+ }]
+ }
+ };
+ assert.expect(12);
+ var response =
+ serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ assert.ok(response.data);
+ assert.equal(response.data.length, 2);
+ assert.equal(response.data[0].id, "192.168.1.1:64318");
+ assert.equal(response.data[1].id, "192.168.1.2:64318");
+ for (var i = 0; i < 2; i++) {
+ assert.equal(response.data[i].type, modelClass.modelName);
+ assert.equal(response.data[i].attributes.nodeHostName,
+ payload.nodes.node[i].nodeHostName);
+ assert.equal(response.data[i].attributes.nodeHTTPAddress,
+ payload.nodes.node[i].nodeHTTPAddress);
+ assert.deepEqual(response.data[i].attributes.nodeLabels,
+ payload.nodes.node[i].nodeLabels);
+ }
+});
+
+test('normalizeArrayResponse no nodes test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-rm-node"
+ },
+ payload = { nodes: null };
+ assert.expect(5);
+ var response =
+ serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ console.log(response);
+ assert.ok(response.data);
+ assert.equal(response.data.length, 1);
+ assert.equal(response.data[0].type, modelClass.modelName);
+ assert.equal(response.data[0].id, "dummy");
+ assert.equal(response.data[0].attributes.nodeHostName, undefined);
+});
+
+test('normalizeSingleResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-rm-node"
+ },
+ payload = {
+ node: {
+ rack: "/default-rack", state: "RUNNING", id: "192.168.1.1:64318",
+ nodeHostName: "192.168.1.1", nodeHTTPAddress: "192.168.1.1:8042",
+ lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
+ healthReport: "", numContainers: 0, usedMemoryMB: 2048,
+ availMemoryMB: 161792, usedVirtualCores: 2,
+ availableVirtualCores: 158, nodeLabels: ["x"],
+ resourceUtilization: {
+ nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
+ nodeCPUUsage: 0.14995001256465912,
+ aggregatedContainersPhysicalMemoryMB: 0,
+ aggregatedContainersVirtualMemoryMB: 0,
+ containersCPUUsage: 0
+ }
+ }
+ };
+ assert.expect(13);
+ var id = "localhost:64318";
+ var response =
+ serializer.normalizeSingleResponse({}, modelClass, payload, id, null);
+ assert.ok(response.data);
+ assert.equal(response.data.id, id);
+ assert.equal(response.data.type, modelClass.modelName);
+ assert.equal(response.data.attributes.rack, payload.node.rack);
+ assert.equal(response.data.attributes.state, payload.node.state);
+ assert.equal(response.data.attributes.nodeHostName,
+ payload.node.nodeHostName);
+ assert.equal(response.data.attributes.nodeHTTPAddress,
+ payload.node.nodeHTTPAddress);
+ assert.equal(response.data.attributes.version, payload.node.version);
+ assert.equal(response.data.attributes.availMemoryMB,
+ payload.node.availMemoryMB);
+ assert.equal(response.data.attributes.usedMemoryMB,
+ payload.node.usedMemoryMB);
+ assert.equal(response.data.attributes.availableVirtualCores,
+ payload.node.availableVirtualCores);
+ assert.equal(response.data.attributes.usedVirtualCores,
+ payload.node.usedVirtualCores);
+ assert.deepEqual(response.data.attributes.nodeLabels,
+ payload.node.nodeLabels);
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/converter-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/converter-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/converter-test.js
index 55cf71d..481537d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/converter-test.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/converter-test.js
@@ -1,10 +1,52 @@
+/**
+ * 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.
+ */
+
import converter from '../../../utils/converter';
import { module, test } from 'qunit';
-module('Unit | Utility | converter');
+module('Unit | Utility | Converter');
// Replace this with your real tests.
test('it works', function(assert) {
- var result = converter();
- assert.ok(result);
+ assert.ok(converter);
+ assert.ok(converter.splitForContainerLogs);
+});
+
+test('split for container logs', function(assert) {
+ var id = "localhost:64318!container_e32_1456000363780_0002_01_000001!" +
+ "syslog";
+ var arr = converter.splitForContainerLogs(id);
+ assert.ok(arr);
+ assert.deepEqual(arr, ["localhost:64318",
+ "container_e32_1456000363780_0002_01_000001", "syslog"]);
+ id = "localhost:64318!container_e32_1456000363780_0002_01_000001!" +
+ "syslog!logs";
+ arr = converter.splitForContainerLogs(id);
+ assert.ok(arr);
+ assert.deepEqual(arr, ["localhost:64318",
+ "container_e32_1456000363780_0002_01_000001", "syslog!logs"]);
+ id = "localhost:64318!container_e32_1456000363780_0002_01_000001";
+ arr = converter.splitForContainerLogs(id);
+ assert.notOk(arr);
+ id = null;
+ arr = converter.splitForContainerLogs(id);
+ assert.notOk(arr);
+ id = undefined;
+ arr = converter.splitForContainerLogs(id);
+ assert.notOk(arr);
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/sorter-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/sorter-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/sorter-test.js
new file mode 100644
index 0000000..8f17380
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/sorter-test.js
@@ -0,0 +1,26 @@
+/**
+ * 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.
+ */
+
+import Sorter from 'yarn-ui/utils/sorter';
+import { module, test } from 'qunit';
+
+module('Unit | Utility | Sorter');
+
+test('Basic creation test', function(assert) {
+ assert.ok(Sorter);
+});
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[45/50] [abbrv] hadoop git commit: YARN-5321. [YARN-3368] Add
resource usage for application by node managers (Wangda Tan via Sunil G)
YARN-5320. [YARN-3368] Add resource usage by applications and queues to
cluster overview page (Wangda Tan via Sunil G)
Posted by wa...@apache.org.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue.hbs
index 8ce4ffa..aae4177 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queue.hbs
@@ -16,55 +16,95 @@
* limitations under the License.
}}
-<div class="container-fluid">
- {{queue-navigator model=model.queues selected=model.selected}}
+<div class="col-md-12 container-fluid">
+ {{em-breadcrumbs items=breadcrumbs}}
</div>
-<div class="row">
- <div class="col-lg-3 container-fluid">
- {{queue-configuration-table queue=model.selectedQueue}}
- </div>
+<div class="col-md-12 container-fluid">
+ <div class="row">
- <div class="col-lg-3 container-fluid" id="capacity-bar-chart">
- {{bar-chart data=model.selectedQueue.capacitiesBarChartData
- title="Queue Capacities"
- parentId="capacity-bar-chart"
- textWidth=150
- ratio=0.5
- maxHeight=350}}
- </div>
+ <div class="col-md-2 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4>Application</h4>
+ </div>
+ <div class="panel-body">
+ <ul class="nav nav-pills nav-stacked" id="stacked-menu">
+ <ul class="nav nav-pills nav-stacked collapse in">
+ {{#link-to 'yarn-queue' tagName="li"}}
+ {{#link-to 'yarn-queue' model.selected}}Information
+ {{/link-to}}
+ {{/link-to}}
+ {{#link-to 'yarn-queue-apps' tagName="li"}}
+ {{#link-to 'yarn-queue-apps' model.selected}}Applications List
+ {{/link-to}}
+ {{/link-to}}
+ </ul>
+ </ul>
+ </div>
+ </div>
+ </div>
-{{#if model.selectedQueue.hasUserUsages}}
- <div class="col-lg-3 container-fluid" id="userusage-donut-chart">
- {{donut-chart data=model.selectedQueue.userUsagesDonutChartData
- title="User Usages"
- showLabels=true
- parentId="userusage-donut-chart"
- maxHeight=350}}
- </div>
-{{/if}}
+ <div class="col-md-10 container-fluid">
+ <!-- timeline view of children -->
+ <div class="row">
- <div class="col-lg-3 container-fluid" id="numapplications-donut-chart">
- {{donut-chart data=model.selectedQueue.numOfApplicationsDonutChartData
- title="Running Apps"
- showLabels=true
- parentId="numapplications-donut-chart"
- ratio=0.5
- maxHeight=350}}
- </div>
-</div>
+ <div class="col-lg-4 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Queue Information
+ </div>
+ {{queue-configuration-table queue=model.selectedQueue}}
+ </div>
+ </div>
-<hr>
+ <div class="col-lg-4 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Queue Capacities
+ </div>
+ <div class="container-fluid" id="capacity-bar-chart">
+ <br/>
+ {{bar-chart data=model.selectedQueue.capacitiesBarChartData
+ title=""
+ parentId="capacity-bar-chart"
+ textWidth=170
+ ratio=0.55
+ maxHeight=350}}
+ </div>
+ </div>
+ </div>
+
+ {{#if model.selectedQueue.hasUserUsages}}
+ <div class="col-lg-4 container-fluid" id="userusage-donut-chart">
+ {{donut-chart data=model.selectedQueue.userUsagesDonutChartData
+ title="User Usages"
+ showLabels=true
+ parentId="userusage-donut-chart"
+ type="memory"
+ ratio=0.6
+ maxHeight=350}}
+ </div>
+ {{/if}}
+
+ <div class="col-lg-4 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Running Apps
+ </div>
+ <div class="container-fluid" id="numapplications-donut-chart">
+ {{donut-chart data=model.selectedQueue.numOfApplicationsDonutChartData
+ showLabels=true
+ parentId="numapplications-donut-chart"
+ ratio=0.6
+ maxHeight=350}}
+ </div>
+ </div>
+ </div>
+
+ </div>
+ </div>
-<div class="row">
- <div class="col-md-12 container-fluid">
- {{#if model.apps}}
- {{app-table table-id="apps-table" arr=model.apps}}
- {{simple-table table-id="apps-table" bFilter=true colTypes="elapsed-time" colTargets="7"}}
- {{else}}
- <h4 align = "center">Could not find any applications from this cluster</h4>
- {{/if}}
</div>
</div>
-
-{{outlet}}
\ No newline at end of file
+{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queues.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queues.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queues.hbs
new file mode 100644
index 0000000..e27341b
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-queues.hbs
@@ -0,0 +1,72 @@
+{{!
+ * 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.
+}}
+
+<div class="col-md-12 container-fluid">
+ {{em-breadcrumbs items=breadcrumbs}}
+</div>
+
+<div class="container-fluid">
+ {{queue-navigator model=model.queues selected=model.selected}}
+
+ <div class="row">
+
+ <div class="col-lg-4 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Queue Information
+ </div>
+ {{queue-configuration-table queue=model.selectedQueue}}
+ </div>
+ </div>
+
+ <div class="col-lg-4 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Queue Capacities
+ </div>
+ <div class="container-fluid" id="capacity-bar-chart">
+ <br/>
+ {{bar-chart data=model.selectedQueue.capacitiesBarChartData
+ title=""
+ parentId="capacity-bar-chart"
+ textWidth=150
+ ratio=0.55
+ maxHeight=350}}
+ </div>
+ </div>
+ </div>
+
+ <div class="col-lg-4 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Running Apps
+ </div>
+ <div class="container-fluid" id="numapplications-donut-chart">
+ {{donut-chart data=model.selectedQueue.numOfApplicationsDonutChartData
+ showLabels=true
+ parentId="numapplications-donut-chart"
+ ratio=0.6
+ maxHeight=350}}
+ </div>
+ </div>
+ </div>
+
+ </div>
+</div>
+
+{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/color-utils.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/color-utils.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/color-utils.js
new file mode 100644
index 0000000..b96ec16
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/color-utils.js
@@ -0,0 +1,67 @@
+/**
+ * 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.
+ */
+
+import Constants from 'yarn-ui/constants';
+
+export default {
+ preDefinedColors : ["#1f77b4", "#aec7e8", "#ffbb78",
+ "#98df8a", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b",
+ "#c49c94", "#e377c2", "#f7b6d2", "#c7c7c7", "#bcbd22",
+ "#dbdb8d", "#17becf", "#9edae5"],
+
+ colorMap: {
+ "warn": "#ff7f0e",
+ "good": "#2ca02c",
+ "error": "#d62728",
+ "others": "#7f7f7f",
+ },
+
+ getColors: function(nColors, colorsTarget, reverse = false) {
+ var colors = [];
+ for (var i = 0; i < nColors; i++) {
+ colors.push(undefined);
+ }
+
+ var startIdx = 0;
+
+ if (reverse) {
+ startIdx = Math.max(nColors - colorsTarget.length, 0);
+ }
+
+ for (var i = 0; i < colorsTarget.length; i++) {
+ if (i + startIdx < nColors) {
+ colors[i + startIdx] = this.getColorByTarget(colorsTarget[i]);
+ }
+ }
+
+ var idx = 0;
+ for (var i = 0; i < nColors; i++) {
+ if (!colors[i]) {
+ colors[i] = this.preDefinedColors[i % this.preDefinedColors.length];
+ idx ++;
+ }
+ }
+
+ console.log(colors);
+ return colors;
+ },
+
+ getColorByTarget: function(target) {
+ return this.colorMap[target];
+ }
+};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/converter.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/converter.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/converter.js
index fd8f491..6fd9d30 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/converter.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/converter.js
@@ -106,4 +106,21 @@ export default {
return [splits[0], splits[1], fileName];
}
},
+ memoryToSimpliedUnit: function(mb) {
+ var unit = "MB"
+ var value = mb;
+ if (value / 1024 >= 0.9) {
+ value = value / 1024;
+ unit = "GB";
+ }
+ if (value / 1024 >= 0.9) {
+ value = value / 1024;
+ unit = "TB";
+ }
+ if (value / 1024 >= 0.9) {
+ value = value / 1024;
+ unit = "PB";
+ }
+ return value.toFixed(1) + " " + unit;
+ }
};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/href-address-utils.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/href-address-utils.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/href-address-utils.js
new file mode 100644
index 0000000..fd940a2
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/href-address-utils.js
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+import Constants from 'yarn-ui/constants';
+
+export default {
+ getApplicationLink: function(applicationId) {
+ return "#/yarn-app/" + applicationId;
+ },
+
+ getQueueLink: function(queueName) {
+ return '#/yarn-queue/' + queueName;
+ }
+};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/mock.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/mock.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/mock.js
new file mode 100644
index 0000000..62eebc1
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/mock.js
@@ -0,0 +1,36 @@
+/**
+ * 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.
+ */
+
+export default {
+ initMockNodesData: function(ref) {
+ var data = [];
+ for (var i = 0; i < 3; i++) {
+ for (var j = 0; j < 38; j++) {
+ var node = ref.get('targetObject.store').createRecord('YarnRmNode', {
+ rack: "/rack-" + i,
+ nodeHostName: "hadoop-" + ["centos6", "ubuntu7", "win"][i % 3] + "-" + ["web", "etl", "dm"][j % 3] + "-" + j,
+ usedMemoryMB: Math.abs(Math.random() * 10000),
+ availMemoryMB: Math.abs(Math.random() * 10000)
+ });
+ data.push(node);
+ }
+ }
+
+ ref.set("model", data);
+ },
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower.json
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower.json
index b23dbbc..fe5f289 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower.json
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower.json
@@ -18,6 +18,7 @@
"datatables": "~1.10.8",
"spin.js": "~2.3.2",
"momentjs": "~2.10.6",
- "select2": "4.0.0"
+ "select2": "4.0.0",
+ "snippet-ss": "~1.11.0"
}
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json
index 417eb98..baa473a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json
@@ -21,6 +21,7 @@
"devDependencies": {
"broccoli-asset-rev": "2.4.2",
"broccoli-funnel": "1.0.1",
+ "em-table": "0.1.6",
"ember-bootstrap": "0.5.1",
"ember-array-contains-helper": "1.0.2",
"ember-cli": "1.13.13",
@@ -45,5 +46,8 @@
"ember-spin-spinner": "0.2.3",
"ember-truth-helpers": "1.2.0",
"select2": "4.0.0"
+ },
+ "dependencies": {
+ "em-helpers": "^0.5.13"
}
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-app-attempt-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-app-attempt-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-app-attempt-test.js
new file mode 100644
index 0000000..0d6c16c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-app-attempt-test.js
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('controller:yarn-app-attempt', 'Unit | Controller | yarn app attempt', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ let controller = this.subject();
+ assert.ok(controller);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-app-attempts-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-app-attempts-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-app-attempts-test.js
new file mode 100644
index 0000000..3894db2
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-app-attempts-test.js
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('controller:yarn-app-attempts', 'Unit | Controller | yarn app attempts', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ let controller = this.subject();
+ assert.ok(controller);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-app-test.js
new file mode 100644
index 0000000..1cc95c5
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-app-test.js
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('controller:yarn-app', 'Unit | Controller | yarn app', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ let controller = this.subject();
+ assert.ok(controller);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-node-apps-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-node-apps-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-node-apps-test.js
new file mode 100644
index 0000000..40c5d44
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-node-apps-test.js
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('controller:yarn-node-apps', 'Unit | Controller | yarn node apps', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ let controller = this.subject();
+ assert.ok(controller);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-node-containers-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-node-containers-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-node-containers-test.js
new file mode 100644
index 0000000..929adcd
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-node-containers-test.js
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('controller:yarn-node-containers', 'Unit | Controller | yarn node containers', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ let controller = this.subject();
+ assert.ok(controller);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-node-test.js
new file mode 100644
index 0000000..59f443f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-node-test.js
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('controller:yarn-node', 'Unit | Controller | yarn node', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ let controller = this.subject();
+ assert.ok(controller);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-nodes-heatmap-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-nodes-heatmap-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-nodes-heatmap-test.js
new file mode 100644
index 0000000..4833302
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-nodes-heatmap-test.js
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('controller:yarn-nodes-heatmap', 'Unit | Controller | yarn nodes heatmap', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ let controller = this.subject();
+ assert.ok(controller);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-nodes-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-nodes-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-nodes-test.js
new file mode 100644
index 0000000..ccd0bff
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-nodes-test.js
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('controller:yarn-nodes', 'Unit | Controller | yarn nodes', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ let controller = this.subject();
+ assert.ok(controller);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-queue-apps-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-queue-apps-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-queue-apps-test.js
new file mode 100644
index 0000000..adf2e07
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-queue-apps-test.js
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('controller:yarn-queue-apps', 'Unit | Controller | yarn queue apps', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ let controller = this.subject();
+ assert.ok(controller);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-queues-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-queues-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-queues-test.js
index 39cf493..0978208 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-queues-test.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-queues-test.js
@@ -18,13 +18,13 @@
import { moduleFor, test } from 'ember-qunit';
-moduleFor('controller:yarn-queues', {
+moduleFor('controller:yarn-queues', 'Unit | Controller | yarn queues', {
// Specify the other units that are required for this test.
// needs: ['controller:foo']
});
// Replace this with your real tests.
test('it exists', function(assert) {
- var controller = this.subject();
+ let controller = this.subject();
assert.ok(controller);
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-services-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-services-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-services-test.js
new file mode 100644
index 0000000..53834e2
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/controllers/yarn-services-test.js
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('controller:yarn-services', 'Unit | Controller | yarn services', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ let controller = this.subject();
+ assert.ok(controller);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-app-attempts-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-app-attempts-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-app-attempts-test.js
new file mode 100644
index 0000000..917a159
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-app-attempts-test.js
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:yarn-app-attempts', 'Unit | Route | yarn app attempts', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+test('it exists', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-queue-apps-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-queue-apps-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-queue-apps-test.js
new file mode 100644
index 0000000..6738ea0
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-queue-apps-test.js
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:yarn-queue-apps', 'Unit | Route | yarn queue apps', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+test('it exists', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c2c918a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-queues-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-queues-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-queues-test.js
new file mode 100644
index 0000000..5153435
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-queues-test.js
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:yarn-queues', 'Unit | Route | yarn queues', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+test('it exists', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+});
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[18/50] [abbrv] hadoop git commit: HADOOP-13439. Fix race between
TestMetricsSystemImpl and TestGangliaMetrics. Contributed by Chen Liang.
Posted by wa...@apache.org.
HADOOP-13439. Fix race between TestMetricsSystemImpl and TestGangliaMetrics. Contributed by Chen Liang.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/8f9b6185
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/8f9b6185
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/8f9b6185
Branch: refs/heads/YARN-3368
Commit: 8f9b61852bf6600b65e49875fec172bac9e0a85d
Parents: 0ad48aa
Author: Masatake Iwasaki <iw...@apache.org>
Authored: Tue Aug 9 09:54:44 2016 +0900
Committer: Masatake Iwasaki <iw...@apache.org>
Committed: Tue Aug 9 09:54:44 2016 +0900
----------------------------------------------------------------------
.../metrics2/impl/TestGangliaMetrics.java | 48 ++++++++++++--------
1 file changed, 28 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f9b6185/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java
index daf64bd..7e094ed 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java
@@ -50,23 +50,28 @@ import org.junit.Test;
public class TestGangliaMetrics {
public static final Log LOG = LogFactory.getLog(TestMetricsSystemImpl.class);
- private final String[] expectedMetrics =
- { "test.s1rec.C1",
- "test.s1rec.G1",
- "test.s1rec.Xxx",
- "test.s1rec.Yyy",
- "test.s1rec.S1NumOps",
- "test.s1rec.S1AvgTime" };
+ // This is the prefix to locate the config file for this particular test
+ // This is to avoid using the same config file with other test cases,
+ // which can cause race conditions.
+ private String testNamePrefix = "gangliametrics";
+ private final String[] expectedMetrics = {
+ testNamePrefix + ".s1rec.C1",
+ testNamePrefix + ".s1rec.G1",
+ testNamePrefix + ".s1rec.Xxx",
+ testNamePrefix + ".s1rec.Yyy",
+ testNamePrefix + ".s1rec.S1NumOps",
+ testNamePrefix + ".s1rec.S1AvgTime"
+ };
@Test
public void testTagsForPrefix() throws Exception {
ConfigBuilder cb = new ConfigBuilder()
- .add("test.sink.ganglia.tagsForPrefix.all", "*")
- .add("test.sink.ganglia.tagsForPrefix.some", "NumActiveSinks, " +
- "NumActiveSources")
- .add("test.sink.ganglia.tagsForPrefix.none", "");
+ .add(testNamePrefix + ".sink.ganglia.tagsForPrefix.all", "*")
+ .add(testNamePrefix + ".sink.ganglia.tagsForPrefix.some",
+ "NumActiveSinks, " + "NumActiveSources")
+ .add(testNamePrefix + ".sink.ganglia.tagsForPrefix.none", "");
GangliaSink30 sink = new GangliaSink30();
- sink.init(cb.subset("test.sink.ganglia"));
+ sink.init(cb.subset(testNamePrefix + ".sink.ganglia"));
List<MetricsTag> tags = new ArrayList<MetricsTag>();
tags.add(new MetricsTag(MsInfo.Context, "all"));
@@ -101,11 +106,14 @@ public class TestGangliaMetrics {
// Setting long interval to avoid periodic publishing.
// We manually publish metrics by MeticsSystem#publishMetricsNow here.
ConfigBuilder cb = new ConfigBuilder().add("*.period", 120)
- .add("test.sink.gsink30.context", "test") // filter out only "test"
- .add("test.sink.gsink31.context", "test") // filter out only "test"
- .save(TestMetricsConfig.getTestFilename("hadoop-metrics2-test"));
-
- MetricsSystemImpl ms = new MetricsSystemImpl("Test");
+ .add(testNamePrefix
+ + ".sink.gsink30.context", testNamePrefix) // filter out only "test"
+ .add(testNamePrefix
+ + ".sink.gsink31.context", testNamePrefix) // filter out only "test"
+ .save(TestMetricsConfig.getTestFilename("hadoop-metrics2-"
+ + testNamePrefix));
+
+ MetricsSystemImpl ms = new MetricsSystemImpl(testNamePrefix);
ms.start();
TestSource s1 = ms.register("s1", "s1 desc", new TestSource("s1rec"));
s1.c1.incr();
@@ -119,13 +127,13 @@ public class TestGangliaMetrics {
// Setup test for GangliaSink30
AbstractGangliaSink gsink30 = new GangliaSink30();
- gsink30.init(cb.subset("test"));
+ gsink30.init(cb.subset(testNamePrefix));
MockDatagramSocket mockds30 = new MockDatagramSocket();
GangliaMetricsTestHelper.setDatagramSocket(gsink30, mockds30);
// Setup test for GangliaSink31
AbstractGangliaSink gsink31 = new GangliaSink31();
- gsink31.init(cb.subset("test"));
+ gsink31.init(cb.subset(testNamePrefix));
MockDatagramSocket mockds31 = new MockDatagramSocket();
GangliaMetricsTestHelper.setDatagramSocket(gsink31, mockds31);
@@ -168,7 +176,7 @@ public class TestGangliaMetrics {
}
@SuppressWarnings("unused")
- @Metrics(context="test")
+ @Metrics(context="gangliametrics")
private static class TestSource {
@Metric("C1 desc") MutableCounterLong c1;
@Metric("XXX desc") MutableCounterLong xxx;
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[17/50] [abbrv] hadoop git commit: HADOOP-12747. support wildcard in
libjars argument (sjlee)
Posted by wa...@apache.org.
HADOOP-12747. support wildcard in libjars argument (sjlee)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/0ad48aa2
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/0ad48aa2
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/0ad48aa2
Branch: refs/heads/YARN-3368
Commit: 0ad48aa2c8f41196743305c711ea19cc48f186da
Parents: 0705489
Author: Sangjin Lee <sj...@apache.org>
Authored: Mon Aug 8 17:34:56 2016 -0700
Committer: Sangjin Lee <sj...@apache.org>
Committed: Mon Aug 8 17:34:56 2016 -0700
----------------------------------------------------------------------
.../java/org/apache/hadoop/fs/FileUtil.java | 73 +++++++---
.../hadoop/util/ApplicationClassLoader.java | 20 +--
.../hadoop/util/GenericOptionsParser.java | 134 ++++++++++++++-----
.../java/org/apache/hadoop/fs/TestFileUtil.java | 59 ++++++--
.../hadoop/util/TestGenericOptionsParser.java | 74 +++++++---
5 files changed, 270 insertions(+), 90 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/0ad48aa2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java
index 53ced77..84a8abb 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java
@@ -18,7 +18,14 @@
package org.apache.hadoop.fs;
-import java.io.*;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.net.InetAddress;
import java.net.URI;
import java.net.UnknownHostException;
@@ -36,6 +43,8 @@ import java.util.zip.ZipFile;
import org.apache.commons.collections.map.CaseInsensitiveMap;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.conf.Configuration;
@@ -43,11 +52,9 @@ import org.apache.hadoop.fs.permission.FsAction;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.io.IOUtils;
import org.apache.hadoop.io.nativeio.NativeIO;
-import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.util.Shell;
import org.apache.hadoop.util.Shell.ShellCommandExecutor;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.util.StringUtils;
/**
* A collection of file-processing util methods
@@ -1209,19 +1216,13 @@ public class FileUtil {
continue;
}
if (classPathEntry.endsWith("*")) {
- boolean foundWildCardJar = false;
// Append all jars that match the wildcard
- Path globPath = new Path(classPathEntry).suffix("{.jar,.JAR}");
- FileStatus[] wildcardJars = FileContext.getLocalFSFileContext().util()
- .globStatus(globPath);
- if (wildcardJars != null) {
- for (FileStatus wildcardJar: wildcardJars) {
- foundWildCardJar = true;
- classPathEntryList.add(wildcardJar.getPath().toUri().toURL()
- .toExternalForm());
+ List<Path> jars = getJarsInDirectory(classPathEntry);
+ if (!jars.isEmpty()) {
+ for (Path jar: jars) {
+ classPathEntryList.add(jar.toUri().toURL().toExternalForm());
}
- }
- if (!foundWildCardJar) {
+ } else {
unexpandedWildcardClasspath.append(File.pathSeparator);
unexpandedWildcardClasspath.append(classPathEntry);
}
@@ -1277,6 +1278,48 @@ public class FileUtil {
return jarCp;
}
+ /**
+ * Returns all jars that are in the directory. It is useful in expanding a
+ * wildcard path to return all jars from the directory to use in a classpath.
+ * It operates only on local paths.
+ *
+ * @param path the path to the directory. The path may include the wildcard.
+ * @return the list of jars as URLs, or an empty list if there are no jars, or
+ * the directory does not exist locally
+ */
+ public static List<Path> getJarsInDirectory(String path) {
+ return getJarsInDirectory(path, true);
+ }
+
+ /**
+ * Returns all jars that are in the directory. It is useful in expanding a
+ * wildcard path to return all jars from the directory to use in a classpath.
+ *
+ * @param path the path to the directory. The path may include the wildcard.
+ * @return the list of jars as URLs, or an empty list if there are no jars, or
+ * the directory does not exist
+ */
+ public static List<Path> getJarsInDirectory(String path, boolean useLocal) {
+ List<Path> paths = new ArrayList<>();
+ try {
+ // add the wildcard if it is not provided
+ if (!path.endsWith("*")) {
+ path += File.separator + "*";
+ }
+ Path globPath = new Path(path).suffix("{.jar,.JAR}");
+ FileContext context = useLocal ?
+ FileContext.getLocalFSFileContext() :
+ FileContext.getFileContext(globPath.toUri());
+ FileStatus[] files = context.util().globStatus(globPath);
+ if (files != null) {
+ for (FileStatus file: files) {
+ paths.add(file.getPath());
+ }
+ }
+ } catch (IOException ignore) {} // return the empty list
+ return paths;
+ }
+
public static boolean compareFs(FileSystem srcFs, FileSystem destFs) {
if (srcFs==null || destFs==null) {
return false;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/0ad48aa2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ApplicationClassLoader.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ApplicationClassLoader.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ApplicationClassLoader.java
index 8c1601a..2f46e1f 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ApplicationClassLoader.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ApplicationClassLoader.java
@@ -19,7 +19,6 @@
package org.apache.hadoop.util;
import java.io.File;
-import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
@@ -34,6 +33,8 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.fs.FileUtil;
+import org.apache.hadoop.fs.Path;
/**
* A {@link URLClassLoader} for application isolation. Classes from the
@@ -58,14 +59,6 @@ public class ApplicationClassLoader extends URLClassLoader {
private static final Log LOG =
LogFactory.getLog(ApplicationClassLoader.class.getName());
- private static final FilenameFilter JAR_FILENAME_FILTER =
- new FilenameFilter() {
- @Override
- public boolean accept(File dir, String name) {
- return name.endsWith(".jar") || name.endsWith(".JAR");
- }
- };
-
static {
try (InputStream is = ApplicationClassLoader.class.getClassLoader()
.getResourceAsStream(PROPERTIES_FILE);) {
@@ -116,11 +109,10 @@ public class ApplicationClassLoader extends URLClassLoader {
List<URL> urls = new ArrayList<URL>();
for (String element : classpath.split(File.pathSeparator)) {
if (element.endsWith("/*")) {
- String dir = element.substring(0, element.length() - 1);
- File[] files = new File(dir).listFiles(JAR_FILENAME_FILTER);
- if (files != null) {
- for (File file : files) {
- urls.add(file.toURI().toURL());
+ List<Path> jars = FileUtil.getJarsInDirectory(element);
+ if (!jars.isEmpty()) {
+ for (Path jar: jars) {
+ urls.add(jar.toUri().toURL());
}
}
} else {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/0ad48aa2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/GenericOptionsParser.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/GenericOptionsParser.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/GenericOptionsParser.java
index 8a06b1f..170812b 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/GenericOptionsParser.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/GenericOptionsParser.java
@@ -17,6 +17,7 @@
*/
package org.apache.hadoop.util;
+import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintStream;
@@ -41,6 +42,7 @@ import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.FileUtil;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.security.Credentials;
import org.apache.hadoop.security.UserGroupInformation;
@@ -167,8 +169,8 @@ public class GenericOptionsParser {
*/
public GenericOptionsParser(Configuration conf,
Options options, String[] args) throws IOException {
- parseGeneralOptions(options, conf, args);
this.conf = conf;
+ parseGeneralOptions(options, args);
}
/**
@@ -259,12 +261,11 @@ public class GenericOptionsParser {
}
/**
- * Modify configuration according user-specified generic options
- * @param conf Configuration to be modified
+ * Modify configuration according user-specified generic options.
+ *
* @param line User-specified generic options
*/
- private void processGeneralOptions(Configuration conf,
- CommandLine line) throws IOException {
+ private void processGeneralOptions(CommandLine line) throws IOException {
if (line.hasOption("fs")) {
FileSystem.setDefaultUri(conf, line.getOptionValue("fs"));
}
@@ -296,8 +297,9 @@ public class GenericOptionsParser {
}
if (line.hasOption("libjars")) {
- conf.set("tmpjars",
- validateFiles(line.getOptionValue("libjars"), conf),
+ // for libjars, we allow expansion of wildcards
+ conf.set("tmpjars",
+ validateFiles(line.getOptionValue("libjars"), true),
"from -libjars command line option");
//setting libjars in client classpath
URL[] libjars = getLibJars(conf);
@@ -310,12 +312,12 @@ public class GenericOptionsParser {
}
if (line.hasOption("files")) {
conf.set("tmpfiles",
- validateFiles(line.getOptionValue("files"), conf),
+ validateFiles(line.getOptionValue("files")),
"from -files command line option");
}
if (line.hasOption("archives")) {
conf.set("tmparchives",
- validateFiles(line.getOptionValue("archives"), conf),
+ validateFiles(line.getOptionValue("archives")),
"from -archives command line option");
}
conf.setBoolean("mapreduce.client.genericoptionsparser.used", true);
@@ -348,7 +350,7 @@ public class GenericOptionsParser {
*/
public static URL[] getLibJars(Configuration conf) throws IOException {
String jars = conf.get("tmpjars");
- if(jars==null) {
+ if (jars == null || jars.trim().isEmpty()) {
return null;
}
String[] files = jars.split(",");
@@ -359,7 +361,7 @@ public class GenericOptionsParser {
cp.add(FileSystem.getLocal(conf).pathToFile(tmp).toURI().toURL());
} else {
LOG.warn("The libjars file " + tmp + " is not on the local " +
- "filesystem. Ignoring.");
+ "filesystem. It will not be added to the local classpath.");
}
}
return cp.toArray(new URL[0]);
@@ -371,28 +373,62 @@ public class GenericOptionsParser {
* if the files specified do not have a scheme.
* it returns the paths uri converted defaulting to file:///.
* So an input of /home/user/file1,/home/user/file2 would return
- * file:///home/user/file1,file:///home/user/file2
- * @param files
- * @return
+ * file:///home/user/file1,file:///home/user/file2.
+ *
+ * This method does not recognize wildcards.
+ *
+ * @param files the input files argument
+ * @return a comma-separated list of validated and qualified paths, or null
+ * if the input files argument is null
*/
- private String validateFiles(String files, Configuration conf)
- throws IOException {
- if (files == null)
+ private String validateFiles(String files) throws IOException {
+ return validateFiles(files, false);
+ }
+
+ /**
+ * takes input as a comma separated list of files
+ * and verifies if they exist. It defaults for file:///
+ * if the files specified do not have a scheme.
+ * it returns the paths uri converted defaulting to file:///.
+ * So an input of /home/user/file1,/home/user/file2 would return
+ * file:///home/user/file1,file:///home/user/file2.
+ *
+ * @param files the input files argument
+ * @param expandWildcard whether a wildcard entry is allowed and expanded. If
+ * true, any directory followed by a wildcard is a valid entry and is replaced
+ * with the list of jars in that directory. It is used to support the wildcard
+ * notation in a classpath.
+ * @return a comma-separated list of validated and qualified paths, or null
+ * if the input files argument is null
+ */
+ private String validateFiles(String files, boolean expandWildcard)
+ throws IOException {
+ if (files == null) {
return null;
+ }
String[] fileArr = files.split(",");
if (fileArr.length == 0) {
throw new IllegalArgumentException("File name can't be empty string");
}
- String[] finalArr = new String[fileArr.length];
+ List<String> finalPaths = new ArrayList<>(fileArr.length);
for (int i =0; i < fileArr.length; i++) {
String tmp = fileArr[i];
if (tmp.isEmpty()) {
throw new IllegalArgumentException("File name can't be empty string");
}
- String finalPath;
URI pathURI;
+ final String wildcard = "*";
+ boolean isWildcard = tmp.endsWith(wildcard) && expandWildcard;
try {
- pathURI = new URI(tmp);
+ if (isWildcard) {
+ // strip the wildcard
+ tmp = tmp.substring(0, tmp.length() - 1);
+ }
+ // handle the case where a wildcard alone ("*") or the wildcard on the
+ // current directory ("./*") is specified
+ pathURI = matchesCurrentDirectory(tmp) ?
+ new File(Path.CUR_DIR).toURI() :
+ new URI(tmp);
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
@@ -404,10 +440,13 @@ public class GenericOptionsParser {
if (!localFs.exists(path)) {
throw new FileNotFoundException("File " + tmp + " does not exist.");
}
- finalPath = path.makeQualified(localFs.getUri(),
- localFs.getWorkingDirectory()).toString();
- }
- else {
+ if (isWildcard) {
+ expandWildcard(finalPaths, path, localFs);
+ } else {
+ finalPaths.add(path.makeQualified(localFs.getUri(),
+ localFs.getWorkingDirectory()).toString());
+ }
+ } else {
// check if the file exists in this file system
// we need to recreate this filesystem object to copy
// these files to the file system ResourceManager is running
@@ -416,12 +455,41 @@ public class GenericOptionsParser {
if (!fs.exists(path)) {
throw new FileNotFoundException("File " + tmp + " does not exist.");
}
- finalPath = path.makeQualified(fs.getUri(),
- fs.getWorkingDirectory()).toString();
+ if (isWildcard) {
+ expandWildcard(finalPaths, path, fs);
+ } else {
+ finalPaths.add(path.makeQualified(fs.getUri(),
+ fs.getWorkingDirectory()).toString());
+ }
+ }
+ }
+ if (finalPaths.isEmpty()) {
+ throw new IllegalArgumentException("Path " + files + " cannot be empty.");
+ }
+ return StringUtils.join(",", finalPaths);
+ }
+
+ private boolean matchesCurrentDirectory(String path) {
+ return path.isEmpty() || path.equals(Path.CUR_DIR) ||
+ path.equals(Path.CUR_DIR + File.separator);
+ }
+
+ private void expandWildcard(List<String> finalPaths, Path path, FileSystem fs)
+ throws IOException {
+ if (!fs.isDirectory(path)) {
+ throw new FileNotFoundException(path + " is not a directory.");
+ }
+ // get all the jars in the directory
+ List<Path> jars = FileUtil.getJarsInDirectory(path.toString(),
+ fs.equals(FileSystem.getLocal(conf)));
+ if (jars.isEmpty()) {
+ LOG.warn(path + " does not have jars in it. It will be ignored.");
+ } else {
+ for (Path jar: jars) {
+ finalPaths.add(jar.makeQualified(fs.getUri(),
+ fs.getWorkingDirectory()).toString());
}
- finalArr[i] = finalPath;
}
- return StringUtils.arrayToString(finalArr);
}
/**
@@ -473,18 +541,18 @@ public class GenericOptionsParser {
/**
* Parse the user-specified options, get the generic options, and modify
- * configuration accordingly
+ * configuration accordingly.
+ *
* @param opts Options to use for parsing args.
- * @param conf Configuration to be modified
* @param args User-specified arguments
*/
- private void parseGeneralOptions(Options opts, Configuration conf,
- String[] args) throws IOException {
+ private void parseGeneralOptions(Options opts, String[] args)
+ throws IOException {
opts = buildGeneralOptions(opts);
CommandLineParser parser = new GnuParser();
try {
commandLine = parser.parse(opts, preProcessForWindows(args), true);
- processGeneralOptions(conf, commandLine);
+ processGeneralOptions(commandLine);
} catch(ParseException e) {
LOG.warn("options parsing failed: "+e.getMessage());
http://git-wip-us.apache.org/repos/asf/hadoop/blob/0ad48aa2/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileUtil.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileUtil.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileUtil.java
index 0b7519c..3c733d2 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileUtil.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileUtil.java
@@ -17,18 +17,25 @@
*/
package org.apache.hadoop.fs;
-import org.apache.hadoop.test.GenericTestUtils;
-import org.junit.*;
+import static org.apache.hadoop.test.PlatformAssumptions.assumeNotWindows;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
+import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.URI;
-import java.io.PrintWriter;
import java.net.URISyntaxException;
+import java.net.URL;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -43,15 +50,15 @@ import java.util.zip.ZipOutputStream;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.test.GenericTestUtils;
import org.apache.hadoop.util.StringUtils;
import org.apache.tools.tar.TarEntry;
import org.apache.tools.tar.TarOutputStream;
-
-
-import static org.apache.hadoop.test.PlatformAssumptions.assumeNotWindows;
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
public class TestFileUtil {
private static final Log LOG = LogFactory.getLog(TestFileUtil.class);
@@ -1055,6 +1062,40 @@ public class TestFileUtil {
}
}
+ @Test
+ public void testGetJarsInDirectory() throws Exception {
+ List<Path> jars = FileUtil.getJarsInDirectory("/foo/bar/bogus/");
+ assertTrue("no jars should be returned for a bogus path",
+ jars.isEmpty());
+
+ // setup test directory for files
+ assertFalse(tmp.exists());
+ assertTrue(tmp.mkdirs());
+
+ // create jar files to be returned
+ File jar1 = new File(tmp, "wildcard1.jar");
+ File jar2 = new File(tmp, "wildcard2.JAR");
+ List<File> matches = Arrays.asList(jar1, jar2);
+ for (File match: matches) {
+ assertTrue("failure creating file: " + match, match.createNewFile());
+ }
+
+ // create non-jar files, which we expect to not be included in the result
+ assertTrue(new File(tmp, "text.txt").createNewFile());
+ assertTrue(new File(tmp, "executable.exe").createNewFile());
+ assertTrue(new File(tmp, "README").createNewFile());
+
+ // pass in the directory
+ String directory = tmp.getCanonicalPath();
+ jars = FileUtil.getJarsInDirectory(directory);
+ assertEquals("there should be 2 jars", 2, jars.size());
+ for (Path jar: jars) {
+ URL url = jar.toUri().toURL();
+ assertTrue("the jar should match either of the jars",
+ url.equals(jar1.toURI().toURL()) || url.equals(jar2.toURI().toURL()));
+ }
+ }
+
@Ignore
public void setupCompareFs() {
// Set up Strings
http://git-wip-us.apache.org/repos/asf/hadoop/blob/0ad48aa2/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestGenericOptionsParser.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestGenericOptionsParser.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestGenericOptionsParser.java
index d575586..0dbfe3d 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestGenericOptionsParser.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestGenericOptionsParser.java
@@ -17,6 +17,13 @@
*/
package org.apache.hadoop.util;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -26,8 +33,9 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
-import junit.framework.TestCase;
-
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
import org.apache.commons.math3.util.Pair;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
@@ -38,20 +46,18 @@ import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.token.Token;
import org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier;
import org.apache.hadoop.test.GenericTestUtils;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.commons.cli.Options;
-import org.junit.Assert;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import com.google.common.collect.Maps;
-import static org.junit.Assert.fail;
-public class TestGenericOptionsParser extends TestCase {
+public class TestGenericOptionsParser {
File testDir;
Configuration conf;
FileSystem localFs;
-
-
+
+ @Test
public void testFilesOption() throws Exception {
File tmpFile = new File(testDir, "tmpfile");
Path tmpPath = new Path(tmpFile.toString());
@@ -97,10 +103,38 @@ public class TestGenericOptionsParser extends TestCase {
assertNull("files is not null", files);
}
+ @Test
+ public void testLibjarsOption() throws Exception {
+ File tmpJar = new File(testDir, "tmp.jar");
+ Path tmpJarPath = new Path(tmpJar.toString());
+ localFs.create(tmpJarPath);
+ String[] args = new String[2];
+ // pass a libjars option
+ // first, pass the jar directly
+ args[0] = "-libjars";
+ // Convert a file to a URI as File.toString() is not a valid URI on
+ // all platforms and GenericOptionsParser accepts only valid URIs
+ args[1] = tmpJar.toURI().toString();
+ new GenericOptionsParser(conf, args);
+ String libjars = conf.get("tmpjars");
+ assertNotNull("libjars is null", libjars);
+ assertEquals("libjars does not match",
+ localFs.makeQualified(tmpJarPath).toString(), libjars);
+
+ // now test the wildcard
+ args[1] = testDir.toURI().toString() + "*";
+ new GenericOptionsParser(conf, args);
+ libjars = conf.get("tmpjars");
+ assertNotNull("libjars is null", libjars);
+ assertEquals("libjars does not match",
+ localFs.makeQualified(tmpJarPath).toString(), libjars);
+ }
+
/**
* Test the case where the libjars, files and archives arguments
* contains an empty token, which should create an IllegalArgumentException.
*/
+ @Test
public void testEmptyFilenames() throws Exception {
List<Pair<String, String>> argsAndConfNames = new ArrayList<Pair<String, String>>();
argsAndConfNames.add(new Pair<String, String>("-libjars", "tmpjars"));
@@ -108,7 +142,6 @@ public class TestGenericOptionsParser extends TestCase {
argsAndConfNames.add(new Pair<String, String>("-archives", "tmparchives"));
for (Pair<String, String> argAndConfName : argsAndConfNames) {
String arg = argAndConfName.getFirst();
- String configName = argAndConfName.getSecond();
File tmpFileOne = new File(testDir, "tmpfile1");
Path tmpPathOne = new Path(tmpFileOne.toString());
@@ -162,6 +195,7 @@ public class TestGenericOptionsParser extends TestCase {
* Test that options passed to the constructor are used.
*/
@SuppressWarnings("static-access")
+ @Test
public void testCreateWithOptions() throws Exception {
// Create new option newOpt
Option opt = OptionBuilder.withArgName("int")
@@ -183,6 +217,7 @@ public class TestGenericOptionsParser extends TestCase {
/**
* Test that multiple conf arguments can be used.
*/
+ @Test
public void testConfWithMultipleOpts() throws Exception {
String[] args = new String[2];
args[0] = "--conf=foo";
@@ -193,10 +228,9 @@ public class TestGenericOptionsParser extends TestCase {
assertEquals("2st conf param is incorrect",
"bar", g.getCommandLine().getOptionValues("conf")[1]);
}
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+
+ @Before
+ public void setUp() throws Exception {
conf = new Configuration();
localFs = FileSystem.getLocal(conf);
testDir = GenericTestUtils.getTestDir("generic");
@@ -204,9 +238,8 @@ public class TestGenericOptionsParser extends TestCase {
localFs.delete(new Path(testDir.toString()), true);
}
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
+ @After
+ public void tearDown() throws Exception {
if(testDir.exists()) {
localFs.delete(new Path(testDir.toString()), true);
}
@@ -216,6 +249,7 @@ public class TestGenericOptionsParser extends TestCase {
* testing -fileCache option
* @throws IOException
*/
+ @Test
public void testTokenCacheOption() throws IOException {
FileSystem localFs = FileSystem.getLocal(conf);
@@ -264,6 +298,7 @@ public class TestGenericOptionsParser extends TestCase {
}
/** Test -D parsing */
+ @Test
public void testDOptionParsing() throws Exception {
String[] args;
Map<String,String> expectedMap;
@@ -344,7 +379,7 @@ public class TestGenericOptionsParser extends TestCase {
assertEquals(entry.getValue(), conf.get(entry.getKey()));
}
- Assert.assertArrayEquals(
+ assertArrayEquals(
Arrays.toString(remainingArgs) + Arrays.toString(expectedRemainingArgs),
expectedRemainingArgs, remainingArgs);
}
@@ -352,6 +387,7 @@ public class TestGenericOptionsParser extends TestCase {
/** Test passing null as args. Some classes still call
* Tool interface from java passing null.
*/
+ @Test
public void testNullArgs() throws IOException {
GenericOptionsParser parser = new GenericOptionsParser(conf, null);
parser.getRemainingArgs();
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[08/50] [abbrv] hadoop git commit: MAPREDUCE-6748. Enhance logging
for Cluster.java around InetSocketAddress (Vrushali C via Varun Saxena)
Posted by wa...@apache.org.
MAPREDUCE-6748. Enhance logging for Cluster.java around InetSocketAddress (Vrushali C via Varun Saxena)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/6529fe93
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/6529fe93
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/6529fe93
Branch: refs/heads/YARN-3368
Commit: 6529fe934546395cff73e4246f12f2dda13d2131
Parents: 4d3af47
Author: Varun Saxena <va...@apache.org>
Authored: Mon Aug 8 21:49:54 2016 +0530
Committer: Varun Saxena <va...@apache.org>
Committed: Mon Aug 8 21:49:54 2016 +0530
----------------------------------------------------------------------
.../src/main/java/org/apache/hadoop/mapreduce/Cluster.java | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/6529fe93/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Cluster.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Cluster.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Cluster.java
index 6ca918d..dcce2aa 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Cluster.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Cluster.java
@@ -106,6 +106,10 @@ public class Cluster {
"Cannot initialize Cluster. Please check your configuration for "
+ MRConfig.FRAMEWORK_NAME
+ " and the correspond server addresses.");
+ if (jobTrackAddr != null) {
+ LOG.info(
+ "Initializing cluster for Job Tracker=" + jobTrackAddr.toString());
+ }
for (ClientProtocolProvider provider : providerList) {
LOG.debug("Trying ClientProtocolProvider : "
+ provider.getClass().getName());
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[13/50] [abbrv] hadoop git commit: HADOOP-13457. Remove hardcoded
absolute path for shell executable. (Chen Liang)
Posted by wa...@apache.org.
HADOOP-13457. Remove hardcoded absolute path for shell executable. (Chen Liang)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/58e1523c
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/58e1523c
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/58e1523c
Branch: refs/heads/YARN-3368
Commit: 58e1523c8ea1363ea8ab115fb718227a90bfab87
Parents: 2ed58c4
Author: Arpit Agarwal <ar...@apache.org>
Authored: Mon Aug 8 12:29:24 2016 -0700
Committer: Arpit Agarwal <ar...@apache.org>
Committed: Mon Aug 8 12:36:27 2016 -0700
----------------------------------------------------------------------
.../hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/58e1523c/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java
index 7149268..78f77c2 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java
@@ -371,7 +371,7 @@ public abstract class Shell {
String absolutePath = script.getAbsolutePath();
return WINDOWS ?
new String[] {"cmd", "/c", absolutePath }
- : new String[] {"/bin/bash", bashQuote(absolutePath) };
+ : new String[] {"bash", bashQuote(absolutePath) };
}
/** a Unix command to set permission: {@value}. */
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[30/50] [abbrv] hadoop git commit: YARN-4733. [YARN-3368] Initial
commit of new YARN web UI. (wangda)
Posted by wa...@apache.org.
YARN-4733. [YARN-3368] Initial commit of new YARN web UI. (wangda)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/906fc27b
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/906fc27b
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/906fc27b
Branch: refs/heads/YARN-3368
Commit: 906fc27be46c0350580913eb094ccacabc73f620
Parents: 85422bb
Author: Wangda Tan <wa...@apache.org>
Authored: Tue Dec 8 16:37:50 2015 -0800
Committer: Wangda Tan <wa...@apache.org>
Committed: Tue Aug 9 14:44:56 2016 -0700
----------------------------------------------------------------------
.../hadoop-yarn/hadoop-yarn-ui/.bowerrc | 4 +
.../hadoop-yarn/hadoop-yarn-ui/.editorconfig | 34 +++
.../hadoop-yarn/hadoop-yarn-ui/.ember-cli | 11 +
.../hadoop-yarn/hadoop-yarn-ui/.gitignore | 17 ++
.../hadoop-yarn/hadoop-yarn-ui/.jshintrc | 32 +++
.../hadoop-yarn/hadoop-yarn-ui/.travis.yml | 23 ++
.../hadoop-yarn/hadoop-yarn-ui/.watchmanconfig | 3 +
.../hadoop-yarn/hadoop-yarn-ui/README.md | 24 ++
.../hadoop-yarn-ui/app/adapters/cluster-info.js | 19 ++
.../app/adapters/cluster-metric.js | 19 ++
.../app/adapters/yarn-app-attempt.js | 31 +++
.../hadoop-yarn-ui/app/adapters/yarn-app.js | 25 ++
.../app/adapters/yarn-container.js | 42 +++
.../hadoop-yarn-ui/app/adapters/yarn-queue.js | 19 ++
.../hadoop-yarn/hadoop-yarn-ui/app/app.js | 20 ++
.../hadoop-yarn-ui/app/components/.gitkeep | 0
.../app/components/app-attempt-table.js | 4 +
.../hadoop-yarn-ui/app/components/app-table.js | 4 +
.../hadoop-yarn-ui/app/components/bar-chart.js | 104 +++++++
.../app/components/base-chart-component.js | 109 ++++++++
.../app/components/container-table.js | 4 +
.../app/components/donut-chart.js | 148 ++++++++++
.../app/components/item-selector.js | 21 ++
.../app/components/queue-configuration-table.js | 4 +
.../app/components/queue-navigator.js | 4 +
.../hadoop-yarn-ui/app/components/queue-view.js | 272 +++++++++++++++++++
.../app/components/simple-table.js | 30 ++
.../app/components/timeline-view.js | 250 +++++++++++++++++
.../app/components/tree-selector.js | 257 ++++++++++++++++++
.../hadoop-yarn-ui/app/controllers/.gitkeep | 0
.../app/controllers/cluster-overview.js | 5 +
.../hadoop-yarn-ui/app/controllers/yarn-apps.js | 4 +
.../app/controllers/yarn-queue.js | 6 +
.../hadoop-yarn-ui/app/helpers/.gitkeep | 0
.../hadoop-yarn/hadoop-yarn-ui/app/index.html | 25 ++
.../hadoop-yarn-ui/app/models/.gitkeep | 0
.../hadoop-yarn-ui/app/models/cluster-info.js | 13 +
.../hadoop-yarn-ui/app/models/cluster-metric.js | 115 ++++++++
.../app/models/yarn-app-attempt.js | 44 +++
.../hadoop-yarn-ui/app/models/yarn-app.js | 65 +++++
.../hadoop-yarn-ui/app/models/yarn-container.js | 39 +++
.../hadoop-yarn-ui/app/models/yarn-queue.js | 76 ++++++
.../hadoop-yarn-ui/app/models/yarn-user.js | 8 +
.../hadoop-yarn/hadoop-yarn-ui/app/router.js | 16 ++
.../hadoop-yarn-ui/app/routes/.gitkeep | 0
.../app/routes/cluster-overview.js | 11 +
.../app/routes/yarn-app-attempt.js | 21 ++
.../hadoop-yarn-ui/app/routes/yarn-app.js | 10 +
.../hadoop-yarn-ui/app/routes/yarn-apps.js | 8 +
.../hadoop-yarn-ui/app/routes/yarn-queue.js | 20 ++
.../app/routes/yarn-queues/index.js | 5 +
.../app/routes/yarn-queues/queues-selector.js | 7 +
.../app/serializers/cluster-info.js | 29 ++
.../app/serializers/cluster-metric.js | 29 ++
.../app/serializers/yarn-app-attempt.js | 49 ++++
.../hadoop-yarn-ui/app/serializers/yarn-app.js | 66 +++++
.../app/serializers/yarn-container.js | 54 ++++
.../app/serializers/yarn-queue.js | 127 +++++++++
.../hadoop-yarn-ui/app/styles/app.css | 141 ++++++++++
.../app/templates/application.hbs | 25 ++
.../app/templates/cluster-overview.hbs | 56 ++++
.../app/templates/components/.gitkeep | 0
.../templates/components/app-attempt-table.hbs | 28 ++
.../app/templates/components/app-table.hbs | 62 +++++
.../templates/components/container-table.hbs | 36 +++
.../components/queue-configuration-table.hbs | 40 +++
.../templates/components/queue-navigator.hbs | 18 ++
.../app/templates/components/timeline-view.hbs | 35 +++
.../app/templates/yarn-app-attempt.hbs | 12 +
.../hadoop-yarn-ui/app/templates/yarn-app.hbs | 145 ++++++++++
.../hadoop-yarn-ui/app/templates/yarn-apps.hbs | 3 +
.../hadoop-yarn-ui/app/templates/yarn-queue.hbs | 48 ++++
.../hadoop-yarn-ui/app/utils/converter.js | 74 +++++
.../hadoop-yarn-ui/app/utils/sorter.js | 15 +
.../hadoop-yarn/hadoop-yarn-ui/bower.json | 22 ++
.../hadoop-yarn-ui/config/environment.js | 47 ++++
.../hadoop-yarn-ui/ember-cli-build.js | 29 ++
.../hadoop-yarn/hadoop-yarn-ui/jsconfig.json | 6 +
.../hadoop-yarn/hadoop-yarn-ui/package.json | 44 +++
.../assets/images/datatables/Sorting icons.psd | Bin 0 -> 27490 bytes
.../public/assets/images/datatables/favicon.ico | Bin 0 -> 894 bytes
.../assets/images/datatables/sort_asc.png | Bin 0 -> 160 bytes
.../images/datatables/sort_asc_disabled.png | Bin 0 -> 148 bytes
.../assets/images/datatables/sort_both.png | Bin 0 -> 201 bytes
.../assets/images/datatables/sort_desc.png | Bin 0 -> 158 bytes
.../images/datatables/sort_desc_disabled.png | Bin 0 -> 146 bytes
.../hadoop-yarn-ui/public/crossdomain.xml | 15 +
.../hadoop-yarn-ui/public/robots.txt | 3 +
.../hadoop-yarn/hadoop-yarn-ui/testem.json | 12 +
.../hadoop-yarn/hadoop-yarn-ui/tests/.jshintrc | 52 ++++
.../hadoop-yarn-ui/tests/helpers/resolver.js | 11 +
.../hadoop-yarn-ui/tests/helpers/start-app.js | 18 ++
.../hadoop-yarn/hadoop-yarn-ui/tests/index.html | 33 +++
.../hadoop-yarn-ui/tests/test-helper.js | 6 +
.../hadoop-yarn-ui/tests/unit/.gitkeep | 0
.../tests/unit/adapters/yarn-app-test.js | 12 +
.../tests/unit/controllers/yarn-apps-test.js | 12 +
.../tests/unit/controllers/yarn-queues-test.js | 12 +
.../tests/unit/mixins/charts-test.js | 12 +
.../tests/unit/models/yarn-app-test.js | 12 +
.../tests/unit/routes/yarn-apps-test.js | 11 +
.../tests/unit/serializers/yarn-app-test.js | 15 +
.../tests/unit/utils/converter-test.js | 10 +
.../hadoop-yarn/hadoop-yarn-ui/vendor/.gitkeep | 0
104 files changed, 3518 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.bowerrc
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.bowerrc b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.bowerrc
new file mode 100644
index 0000000..959e169
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.bowerrc
@@ -0,0 +1,4 @@
+{
+ "directory": "bower_components",
+ "analytics": false
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.editorconfig
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.editorconfig b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.editorconfig
new file mode 100644
index 0000000..47c5438
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.editorconfig
@@ -0,0 +1,34 @@
+# EditorConfig helps developers define and maintain consistent
+# coding styles between different editors and IDEs
+# editorconfig.org
+
+root = true
+
+
+[*]
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+indent_style = space
+indent_size = 2
+
+[*.js]
+indent_style = space
+indent_size = 2
+
+[*.hbs]
+insert_final_newline = false
+indent_style = space
+indent_size = 2
+
+[*.css]
+indent_style = space
+indent_size = 2
+
+[*.html]
+indent_style = space
+indent_size = 2
+
+[*.{diff,md}]
+trim_trailing_whitespace = false
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.ember-cli
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.ember-cli b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.ember-cli
new file mode 100644
index 0000000..96bd287
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.ember-cli
@@ -0,0 +1,11 @@
+{
+ /**
+ Ember CLI sends analytics information by default. The data is completely
+ anonymous, but there are times when you might want to disable this behavior.
+
+ Setting `disableAnalytics` to true will prevent any data from being sent.
+ */
+ "disableAnalytics": false,
+ "liveReload": true,
+ "watcher": "polling"
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.gitignore
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.gitignore b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.gitignore
new file mode 100644
index 0000000..86fceae
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.gitignore
@@ -0,0 +1,17 @@
+# See http://help.github.com/ignore-files/ for more about ignoring files.
+
+# compiled output
+/dist
+/tmp
+
+# dependencies
+/node_modules
+/bower_components
+
+# misc
+/.sass-cache
+/connect.lock
+/coverage/*
+/libpeerconnection.log
+npm-debug.log
+testem.log
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.jshintrc
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.jshintrc b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.jshintrc
new file mode 100644
index 0000000..08096ef
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.jshintrc
@@ -0,0 +1,32 @@
+{
+ "predef": [
+ "document",
+ "window",
+ "-Promise"
+ ],
+ "browser": true,
+ "boss": true,
+ "curly": true,
+ "debug": false,
+ "devel": true,
+ "eqeqeq": true,
+ "evil": true,
+ "forin": false,
+ "immed": false,
+ "laxbreak": false,
+ "newcap": true,
+ "noarg": true,
+ "noempty": false,
+ "nonew": false,
+ "nomen": false,
+ "onevar": false,
+ "plusplus": false,
+ "regexp": false,
+ "undef": true,
+ "sub": true,
+ "strict": false,
+ "white": false,
+ "eqnull": true,
+ "esnext": true,
+ "unused": true
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.travis.yml
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.travis.yml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.travis.yml
new file mode 100644
index 0000000..66dd107
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.travis.yml
@@ -0,0 +1,23 @@
+---
+language: node_js
+node_js:
+ - "0.12"
+
+sudo: false
+
+cache:
+ directories:
+ - node_modules
+
+before_install:
+ - export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH
+ - "npm config set spin false"
+ - "npm install -g npm@^2"
+
+install:
+ - npm install -g bower
+ - npm install
+ - bower install
+
+script:
+ - npm test
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.watchmanconfig
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.watchmanconfig b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.watchmanconfig
new file mode 100644
index 0000000..5e9462c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/.watchmanconfig
@@ -0,0 +1,3 @@
+{
+ "ignore_dirs": ["tmp"]
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/README.md
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/README.md b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/README.md
new file mode 100644
index 0000000..d5cba6e
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/README.md
@@ -0,0 +1,24 @@
+# Yarn-ui
+*This is a WIP project, nobody should use it in production.*
+
+## Prerequisites
+
+You will need the following things properly installed on your computer.
+
+* Install Node.js with NPM: https://nodejs.org/download/
+* After Node.js installed, install bower: `npm install -g bower`.
+* Install Ember-cli: `npm install -g ember-cli`
+
+## Installation
+
+* Goto root directory of yarn-ui project: `hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui`
+* `npm install && bower install`, it will take a while to finish.
+
+## Try it
+
+* Packaging and deploying Hadoop in this branch (You can use latest trunk after YARN-4417 committed to trunk)
+* Modify `app/adapters/yarn-app.js`, change `host` to your YARN RM web address
+* If you running YARN RM in your localhost, you should install `npm install -g corsproxy` and run `corsproxy` to avoid CORS errors. More details: `https://www.npmjs.com/package/corsproxy`. And the `host` of `app/adapters/yarn-app.js` should start with `localhost:1337`.
+* Run `ember server`
+* Visit your app at [http://localhost:4200](http://localhost:4200).
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-info.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-info.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-info.js
new file mode 100644
index 0000000..ef65792
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-info.js
@@ -0,0 +1,19 @@
+import DS from 'ember-data';
+
+export default DS.JSONAPIAdapter.extend({
+ headers: {
+ Accept: 'application/json'
+ },
+ host: 'http://localhost:1337/localhost:8088', // configurable
+ namespace: 'ws/v1/cluster', // common const
+ pathForType(modelName) {
+ return ''; // move to some common place, return path by modelname.
+ },
+ ajax(url, method, hash) {
+ hash = hash || {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "RM";
+ return this._super(url, method, hash);
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-metric.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-metric.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-metric.js
new file mode 100644
index 0000000..d0f084c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-metric.js
@@ -0,0 +1,19 @@
+import DS from 'ember-data';
+
+export default DS.JSONAPIAdapter.extend({
+ headers: {
+ Accept: 'application/json'
+ },
+ host: 'http://localhost:1337/localhost:8088', // configurable
+ namespace: 'ws/v1/cluster/metrics', // common const
+ pathForType(modelName) {
+ return ''; // move to some common place, return path by modelname.
+ },
+ ajax(url, method, hash) {
+ hash = hash || {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "RM";
+ return this._super(url, method, hash);
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app-attempt.js
new file mode 100644
index 0000000..3c95d64
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app-attempt.js
@@ -0,0 +1,31 @@
+import DS from 'ember-data';
+import Converter from 'yarn-ui/utils/converter';
+
+export default DS.JSONAPIAdapter.extend({
+ headers: {
+ Accept: 'application/json'
+ },
+ host: 'http://localhost:1337/localhost:8088', // configurable
+ namespace: 'ws/v1/cluster', // common const
+
+ urlForQuery(query, modelName) {
+ var url = this._buildURL();
+ return url + '/apps/' + query.appId + "/appattempts";
+ },
+
+ urlForFindRecord(id, modelName, snapshot) {
+ var url = this._buildURL();
+ var url = url + '/apps/' +
+ Converter.attemptIdToAppId(id) + "/appattempts/" + id;
+ console.log(url);
+ return url;
+ },
+
+ ajax(url, method, hash) {
+ hash = {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "RM";
+ return this._super(url, method, hash);
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app.js
new file mode 100644
index 0000000..e1108be
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app.js
@@ -0,0 +1,25 @@
+import DS from 'ember-data';
+
+export default DS.JSONAPIAdapter.extend({
+ headers: {
+ Accept: 'application/json'
+ },
+ host: 'http://localhost:1337/localhost:8088', // configurable
+ namespace: 'ws/v1/cluster', // common const
+ pathForType(modelName) {
+ return 'apps'; // move to some common place, return path by modelname.
+ },
+ /*
+ urlForQuery(query, modelName) {
+ var url = this._buildURL();
+ return url + '/apps/' + query.appId + "/appattempts";
+ },
+ */
+ ajax(url, method, hash) {
+ hash = hash || {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "RM";
+ return this._super(url, method, hash);
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container.js
new file mode 100644
index 0000000..fe09f59
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container.js
@@ -0,0 +1,42 @@
+import DS from 'ember-data';
+import Converter from 'yarn-ui/utils/converter';
+
+export default DS.JSONAPIAdapter.extend({
+ headers: {
+ Accept: 'application/json'
+ },
+ rmHost: 'http://localhost:1337/localhost:8088',
+ tsHost: 'http://localhost:1337/localhost:8188',
+ host: function() {
+ return undefined
+ }.property(),
+ rmNamespace: 'ws/v1/cluster',
+ tsNamespace: 'ws/v1/applicationhistory',
+ namespace: function() {
+ return undefined
+ }.property(),
+
+ urlForQuery(query, modelName) {
+ if (query.is_rm) {
+ this.set("host", this.rmHost);
+ this.set("namespace", this.rmNamespace);
+ } else {
+ this.set("host", this.tsHost);
+ this.set("namespace", this.tsNamespace);
+ }
+
+ var url = this._buildURL();
+ url = url + '/apps/' + Converter.attemptIdToAppId(query.app_attempt_id)
+ + "/appattempts/" + query.app_attempt_id + "/containers";
+ console.log(url);
+ return url;
+ },
+
+ ajax(url, method, hash) {
+ hash = {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "RM";
+ return this._super(url, method, hash);
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-queue.js
new file mode 100644
index 0000000..39cf796
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-queue.js
@@ -0,0 +1,19 @@
+import DS from 'ember-data';
+
+export default DS.JSONAPIAdapter.extend({
+ headers: {
+ Accept: 'application/json'
+ },
+ host: 'http://localhost:1337/localhost:8088', // configurable
+ namespace: 'ws/v1/cluster', // common const
+ pathForType(modelName) {
+ return 'scheduler'; // move to some common place, return path by modelname.
+ },
+ ajax(url, method, hash) {
+ hash = hash || {};
+ hash.crossDomain = true;
+ hash.xhrFields = {withCredentials: true};
+ hash.targetServer = "RM";
+ return this._super(url, method, hash);
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/app.js
new file mode 100644
index 0000000..ff28ecf
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/app.js
@@ -0,0 +1,20 @@
+import Ember from 'ember';
+import Resolver from 'ember/resolver';
+import loadInitializers from 'ember/load-initializers';
+import config from './config/environment';
+import Sorter from 'yarn-ui/utils/sorter';
+
+var App;
+
+Ember.MODEL_FACTORY_INJECTIONS = true;
+
+App = Ember.Application.extend({
+ modulePrefix: config.modulePrefix,
+ podModulePrefix: config.podModulePrefix,
+ Resolver: Resolver
+});
+
+loadInitializers(App, config.modulePrefix);
+Sorter.initDataTableSorter();
+
+export default App;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/.gitkeep
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/.gitkeep b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/.gitkeep
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/app-attempt-table.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/app-attempt-table.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/app-attempt-table.js
new file mode 100644
index 0000000..aff0493
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/app-attempt-table.js
@@ -0,0 +1,4 @@
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/app-table.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/app-table.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/app-table.js
new file mode 100644
index 0000000..aff0493
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/app-table.js
@@ -0,0 +1,4 @@
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/bar-chart.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/bar-chart.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/bar-chart.js
new file mode 100644
index 0000000..f24e947
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/bar-chart.js
@@ -0,0 +1,104 @@
+import Ember from 'ember';
+import BaseChartComponent from 'yarn-ui/components/base-chart-component';
+
+export default BaseChartComponent.extend({
+ // data:
+ // [{label=label1, value=value1}, ...]
+ // ...
+ renderBarChart: function(data, title, textWidth = 50) {
+ var g = this.chart.g;
+ var layout = this.getLayout();
+ this.renderTitleAndBG(g, title, layout);
+
+ var maxValue = -1;
+ for (var i = 0; i < data.length; i++) {
+ if (data[i] instanceof Array) {
+ if (data[i][0].value > maxValue) {
+ maxValue = data[i][0].value;
+ }
+ } else {
+ if (data[i].value > maxValue) {
+ maxValue = data[i].value;
+ }
+ }
+ }
+
+ var singleBarHeight = 30;
+
+ // 50 is for text
+ var maxBarWidth = layout.x2 - layout.x1 - 2 * layout.margin - textWidth - 50;
+
+ // 30 is for title
+ var maxBarsHeight = layout.y2 - layout.y1 - 2 * layout.margin - 30;
+ var gap = (maxBarsHeight - data.length * singleBarHeight) / (data.length -
+ 1);
+
+ var xScaler = d3.scale.linear()
+ .domain([0, maxValue])
+ .range([0, maxBarWidth]);
+
+ // show bar text
+ for (var i = 0; i < data.length; i++) {
+ g.append("text")
+ .text(
+ function() {
+ return data[i].label;
+ })
+ .attr("y", function() {
+ return layout.y1 + singleBarHeight / 2 + layout.margin + (gap +
+ singleBarHeight) * i + 30;
+ })
+ .attr("x", layout.x1 + layout.margin);
+ }
+
+ // show bar
+ var bar = g.selectAll("bars")
+ .data(data)
+ .enter()
+ .append("rect")
+ .attr("y", function(d, i) {
+ return layout.y1 + 30 + layout.margin + (gap + singleBarHeight) * i;
+ })
+ .attr("x", layout.x1 + layout.margin + textWidth)
+ .attr("height", singleBarHeight)
+ .attr("fill", function(d, i) {
+ return this.colors[i];
+ }.bind(this))
+ .attr("width", 0);
+
+ this.bindTooltip(bar);
+
+ bar.transition()
+ .duration(500)
+ .attr("width", function(d) {
+ var w;
+ w = xScaler(d.value);
+ // At least each item has 3 px
+ w = Math.max(w, 3);
+ return w;
+ });
+
+ // show bar value
+ for (var i = 0; i < data.length; i++) {
+ g.append("text")
+ .text(
+ function() {
+ return data[i].value;
+ })
+ .attr("y", function() {
+ return layout.y1 + singleBarHeight / 2 + layout.margin + (gap +
+ singleBarHeight) * i + 30;
+ })
+ .attr("x", layout.x1 + layout.margin + textWidth + 15 + xScaler(data[i].value));
+ }
+ },
+
+ draw: function() {
+ this.initChart();
+ this.renderBarChart(this.get("data"), this.get("title"), this.get("textWidth"));
+ },
+
+ didInsertElement: function() {
+ this.draw();
+ },
+})
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/base-chart-component.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/base-chart-component.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/base-chart-component.js
new file mode 100644
index 0000000..acf2b5f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/base-chart-component.js
@@ -0,0 +1,109 @@
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+ chart: undefined,
+ tooltip : undefined,
+ colors: d3.scale.category10().range(),
+
+ initChart: function() {
+ this.chart = {
+ svg: undefined,
+ g: undefined,
+ h: 0,
+ w: 0,
+ tooltip: undefined
+ };
+
+ // Init tooltip if it is not initialized
+ this.tooltip = d3.select("#chart-tooltip");
+ if (!this.tooltip) {
+ this.tooltip = d3.select("body")
+ .append("div")
+ .attr("class", "tooltip")
+ .attr("id", "chart-tooltip")
+ .style("opacity", 0);
+ }
+
+ // Init svg
+ var svg = this.chart.svg;
+ if (svg) {
+ svg.remove();
+ }
+
+ var parentId = this.get("parentId");
+ var parent = d3.select("#" + parentId);
+ var bbox = parent.node().getBoundingClientRect();
+ this.chart.w = bbox.width - 30;
+
+ var ratio = 0.75; // 4:3 by default
+ if (this.get("ratio")) {
+ ratio = this.get("ratio");
+ }
+ this.chart.h = bbox.width * ratio;
+
+ if (this.get("maxHeight")) {
+ this.chart.h = Math.min(this.get("maxHeight"), this.chart.h);
+ }
+
+ this.chart.svg = parent.append("svg")
+ .attr("width", this.chart.w)
+ .attr("height", this.chart.h);
+
+ this.chart.g = this.chart.svg.append("g");
+ },
+
+ renderTitleAndBG: function(g, title, layout) {
+ var bg = g.append("g");
+ bg.append("text")
+ .text(title)
+ .attr("x", (layout.x1 + layout.x2) / 2)
+ .attr("y", layout.y1 + layout.margin + 20)
+ .attr("class", "chart-title");
+
+ bg.append("rect")
+ .attr("x", layout.x1)
+ .attr("y", layout.y1)
+ .attr("width", layout.x2 - layout.x1)
+ .attr("height", layout.y2 - layout.y1)
+ .attr("class", "chart-frame");
+ },
+
+ bindTooltip: function(d) {
+ d.on("mouseover", function(d) {
+ this.tooltip
+ .style("left", (d3.event.pageX) + "px")
+ .style("top", (d3.event.pageY - 28) + "px");
+ }.bind(this))
+ .on("mousemove", function(d) {
+ // Handle pie chart case
+ var data = d;
+ if (d.data) {
+ data = d.data;
+ }
+
+ this.tooltip.style("opacity", .9);
+ this.tooltip.html(data.label + " = " + data.value)
+ .style("left", (d3.event.pageX) + "px")
+ .style("top", (d3.event.pageY - 28) + "px");
+ }.bind(this))
+ .on("mouseout", function(d) {
+ this.tooltip.style("opacity", 0);
+ }.bind(this));
+ },
+
+ getLayout: function() {
+ var x1 = 0;
+ var y1 = 0;
+ var x2 = this.chart.w;
+ var y2 = this.chart.h;
+
+ var layout = {
+ x1: x1,
+ y1: y1,
+ x2: x2 - 10,
+ y2: y2 - 10,
+ margin: 10
+ };
+ return layout;
+ },
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/container-table.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/container-table.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/container-table.js
new file mode 100644
index 0000000..aff0493
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/container-table.js
@@ -0,0 +1,4 @@
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/donut-chart.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/donut-chart.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/donut-chart.js
new file mode 100644
index 0000000..608b0c1
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/donut-chart.js
@@ -0,0 +1,148 @@
+import Ember from 'ember';
+import BaseChartComponent from 'yarn-ui/components/base-chart-component';
+
+export default BaseChartComponent.extend({
+ /*
+ * data = [{label="xx", value=},{...}]
+ */
+ renderDonutChart: function(data, title, showLabels = false,
+ middleLabel = "Total", middleValue = undefined) {
+ var g = this.chart.g;
+ var layout = this.getLayout();
+ this.renderTitleAndBG(g, title, layout);
+
+ var total = 0;
+ var allZero = true;
+ for (var i = 0; i < data.length; i++) {
+ total += data[i].value;
+ if (data[i].value > 1e-6) {
+ allZero = false;
+ }
+ }
+
+ if (!middleValue) {
+ middleValue = total;
+ }
+
+ //Width and height
+ var h = layout.y2 - layout.y1;
+
+ // 50 is for title
+ var outerRadius = (h - 50 - 2 * layout.margin) / 2;
+ var innerRadius = outerRadius * 0.618;
+ var arc = d3.svg.arc()
+ .innerRadius(innerRadius)
+ .outerRadius(outerRadius);
+
+ var cx;
+ var cy = layout.y1 + 50 + layout.margin + outerRadius;
+ if (showLabels) {
+ cx = layout.x1 + layout.margin + outerRadius;
+ } else {
+ cx = (layout.x1 + layout.x2) / 2;
+ }
+
+ var pie = d3.layout.pie();
+ pie.sort(null);
+ pie.value(function(d) {
+ var v = d.value;
+ // make sure it > 0
+ v = Math.max(v, 1e-6);
+ return v;
+ });
+
+ //Set up groups
+ var arcs = g
+ .selectAll("g.arc")
+ .data(pie(data))
+ .enter()
+ .append("g")
+ .attr("class", "arc")
+ .attr("transform", "translate(" + cx + "," + cy + ")");
+
+ function tweenPie(finish) {
+ var start = {
+ startAngle: 0,
+ endAngle: 0
+ };
+ var i = d3.interpolate(start, finish);
+ return function(d) {
+ return arc(i(d));
+ };
+ }
+
+ //Draw arc paths
+ var path = arcs.append("path")
+ .attr("fill", function(d, i) {
+ if (d.value > 1e-6) {
+ return this.colors[i];
+ } else {
+ return "white";
+ }
+ }.bind(this))
+ .attr("d", arc)
+ .attr("stroke", function(d, i) {
+ if (allZero) {
+ return this.colors[i];
+ }
+ }.bind(this))
+ .attr("stroke-dasharray", function(d, i) {
+ if (d.value <= 1e-6) {
+ return "10,10";
+ }
+ }.bind(this));
+ this.bindTooltip(path);
+
+ // Show labels
+ if (showLabels) {
+ var lx = layout.x1 + layout.margin + outerRadius * 2 + 30;
+ var squareW = 15;
+ var margin = 10;
+
+ var select = g.selectAll(".rect")
+ .data(data)
+ .enter();
+ select.append("rect")
+ .attr("fill", function(d, i) {
+ return this.colors[i];
+ }.bind(this))
+ .attr("x", lx)
+ .attr("y", function(d, i) {
+ return layout.y1 + 50 + (squareW + margin) * i + layout.margin;
+ })
+ .attr("width", squareW)
+ .attr("height", squareW);
+ select.append("text")
+ .attr("x", lx + squareW + margin)
+ .attr("y", function(d, i) {
+ return layout.y1 + 50 + (squareW + margin) * i + layout.margin + squareW / 2;
+ })
+ .text(function(d) {
+ return d.label + ' = ' + d.value;
+ });
+ }
+
+ if (middleLabel) {
+ var highLightColor = this.colors[0];
+ g.append("text").text(middleLabel).attr("x", cx).attr("y", cy - 10).
+ attr("class", "donut-highlight-text").attr("fill", highLightColor);
+ g.append("text").text(middleValue).attr("x", cx).attr("y", cy + 20).
+ attr("class", "donut-highlight-text").attr("fill", highLightColor).
+ style("font-size", "30px");
+ }
+
+ path.transition()
+ .duration(500)
+ .attrTween('d', tweenPie);
+ },
+
+ draw: function() {
+ this.initChart();
+ this.renderDonutChart(this.get("data"), this.get("title"), this.get("showLabels"),
+ this.get("middleLabel"), this.get("middleValue"));
+ },
+
+ didInsertElement: function() {
+ this.draw();
+ },
+})
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/item-selector.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/item-selector.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/item-selector.js
new file mode 100644
index 0000000..a18ccae
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/item-selector.js
@@ -0,0 +1,21 @@
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+ didInsertElement: function() {
+ $(".js-example-basic-single").select2(
+ {
+ width: '100%',
+ placeholder: "Select a queue"
+ });
+ var elementId = this.get("element-id");
+ var prefix = this.get("prefix");
+
+ var element = d3.select("#" + elementId);
+
+ if (element) {
+ this.get("model").forEach(function(o) {
+ element.append("option").attr("value", o.get("name")).text(prefix + o.get("name"));
+ });
+ }
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-configuration-table.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-configuration-table.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-configuration-table.js
new file mode 100644
index 0000000..aff0493
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-configuration-table.js
@@ -0,0 +1,4 @@
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-navigator.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-navigator.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-navigator.js
new file mode 100644
index 0000000..aff0493
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-navigator.js
@@ -0,0 +1,4 @@
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-view.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-view.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-view.js
new file mode 100644
index 0000000..c1fd8ff
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/queue-view.js
@@ -0,0 +1,272 @@
+import Ember from 'ember';
+import ChartUtilsMixin from 'yarn-ui/mixins/charts-utils';
+
+export default Ember.Component.extend(ChartUtilsMixin, {
+ queues: {
+ data: undefined,
+ foldedQueues: {},
+ selectedQueueCircle: undefined,
+ maxDepth: -1,
+ },
+
+ queueColors: d3.scale.category20().range(),
+
+ renderQueue: function(now, depth, sequence) {
+ if (depth > this.queues.maxDepth) {
+ this.queues.maxDepth = depth;
+ }
+
+ var cx = 20 + depth * 30;
+ var cy = 20 + sequence * 30;
+ var name = now.get("name");
+
+ var g = this.queues.dataGroup.append("g")
+ .attr("id", "queue-" + name + "-g");
+
+ var folded = this.queues.foldedQueues[name];
+ var isParentQueue = false;
+
+ // render its children
+ var children = [];
+ var childrenNames = now.get("children");
+ if (childrenNames) {
+ childrenNames.forEach(function(name) {
+ isParentQueue = true;
+ var child = this.queues.data[name];
+ if (child) {
+ children.push(child);
+ }
+ }.bind(this));
+ }
+ if (folded) {
+ children = [];
+ }
+ var linefunction = d3.svg.line()
+ .interpolate("basis")
+ .x(function(d) {
+ return d.x;
+ })
+ .y(function(d) {
+ return d.y;
+ });
+
+ for (var i = 0; i < children.length; i++) {
+ sequence = sequence + 1;
+ // Get center of children queue
+ var cc = this.renderQueue(children[i],
+ depth + 1, sequence);
+ g.append("path")
+ .attr("class", "queue")
+ .attr("d", linefunction([{
+ x: cx,
+ y: cy
+ }, {
+ x: cc.x - 20,
+ y: cc.y
+ }, cc]));
+ }
+
+ var circle = g.append("circle")
+ .attr("cx", cx)
+ .attr("cy", cy)
+ .attr("class", "queue");
+
+ circle.on('mouseover', function() {
+ circle.style("fill", this.queueColors[1]);
+ }.bind(this));
+ circle.on('mouseout', function() {
+ if (circle != this.queues.selectedQueueCircle) {
+ circle.style("fill", this.queueColors[0]);
+ }
+ }.bind(this));
+ circle.on('click', function() {
+ circle.style("fill", this.queueColors[2]);
+ var pre = this.queues.selectedQueueCircle;
+ this.queues.selectedQueueCircle = circle;
+ if (pre) {
+ pre.on('mouseout')();
+ }
+ this.renderCharts(name);
+ }.bind(this));
+ circle.on('dblclick', function() {
+ if (!isParentQueue) {
+ return;
+ }
+
+ if (this.queues.foldedQueues[name]) {
+ delete this.queues.foldedQueues[name];
+ } else {
+ this.queues.foldedQueues[name] = now;
+ }
+ this.renderQueues();
+ }.bind(this));
+
+ var text = name;
+ if (folded) {
+ text = name + " (+)";
+ }
+
+ // print queue's name
+ g.append("text")
+ .attr("x", cx + 30)
+ .attr("y", cy + 5)
+ .text(text)
+ .attr("class", "queue");
+
+ return {
+ x: cx,
+ y: cy
+ };
+ },
+
+ renderQueues: function() {
+ if (this.queues.dataGroup) {
+ this.queues.dataGroup.remove();
+ }
+ // render queues
+ this.queues.dataGroup = this.canvas.svg.append("g")
+ .attr("id", "queues-g");
+ var rootQueue = undefined;
+
+ if (this.queues.data) {
+ this.renderQueue(this.queues.data['root'], 0, 0);
+
+ }
+ },
+
+ draw: function() {
+ this.queues.data = {};
+ this.get("model")
+ .forEach(function(o) {
+ this.queues.data[o.id] = o;
+ }.bind(this));
+
+ // get w/h of the svg
+ var bbox = d3.select("#main-container")
+ .node()
+ .getBoundingClientRect();
+ this.canvas.w = bbox.width;
+ this.canvas.h = Math.max(Object.keys(this.queues.data)
+ .length * 35, 1500);
+
+ this.canvas.svg = d3.select("#main-container")
+ .append("svg")
+ .attr("width", this.canvas.w)
+ .attr("height", this.canvas.h)
+ .attr("id", "main-svg");
+
+ this.renderBackground();
+
+ this.renderQueues();
+ this.renderCharts("root");
+ },
+
+ didInsertElement: function() {
+ this.draw();
+ },
+
+ /*
+ * data = [{label="xx", value=},{...}]
+ */
+ renderTable: function(data, title, layout) {
+ d3.select("#main-svg")
+ .append('table')
+ .selectAll('tr')
+ .data(data)
+ .enter()
+ .append('tr')
+ .selectAll('td')
+ .data(function(d) {
+ return d;
+ })
+ .enter()
+ .append('td')
+ .text(function(d) {
+ return d;
+ });
+ },
+
+ renderQueueCapacities: function(queue, layout) {
+ // Render bar chart
+ this.renderBarChart(this.charts.g, [{
+ label: "Cap",
+ value: queue.get("capacity")
+ }, {
+ label: "MaxCap",
+ value: queue.get("maxCapacity")
+ }, {
+ label: "UsedCap",
+ value: queue.get("usedCapacity")
+ }], "Queue Capacities", layout, 60);
+ },
+
+ renderChildrenCapacities: function(queue, layout) {
+ var data = [];
+ var children = queue.get("children");
+ if (children) {
+ for (var i = 0; i < children.length; i++) {
+ var child = this.queues.data[children[i]];
+ data.push({
+ label: child.get("name"),
+ value: child.get("capacity")
+ });
+ }
+ }
+
+ this.renderDonutChart(this.charts.g, data, "Children Capacities", layout, true);
+ },
+
+ renderChildrenUsedCapacities: function(queue, layout) {
+ var data = [];
+ var children = queue.get("children");
+ if (children) {
+ for (var i = 0; i < children.length; i++) {
+ var child = this.queues.data[children[i]];
+ data.push({
+ label: child.get("name"),
+ value: child.get("usedCapacity")
+ });
+ }
+ }
+
+ this.renderDonutChart(this.charts.g, data, "Children Used Capacities", layout, true);
+ },
+
+ renderLeafQueueUsedCapacities: function(layout) {
+ var leafQueueUsedCaps = [];
+ for (var queueName in this.queues.data) {
+ var q = this.queues.data[queueName];
+ if ((!q.get("children")) || q.get("children")
+ .length == 0) {
+ // it's a leafqueue
+ leafQueueUsedCaps.push({
+ label: q.get("name"),
+ value: q.get("usedCapacity")
+ });
+ }
+ }
+
+ this.renderDonutChart(this.charts.g, leafQueueUsedCaps, "LeafQueues Used Capacities",
+ layout, true);
+ },
+
+ renderCharts: function(queueName) {
+ this.charts.leftBannerLen = this.queues.maxDepth * 30 + 100;
+ this.initCharts();
+
+ var queue = this.queues.data[queueName];
+ var idx = 0;
+
+ if (queue.get("name") == "root") {
+ this.renderLeafQueueUsedCapacities(this.getLayout(idx++));
+ }
+ if (queue.get("name") != "root") {
+ this.renderQueueCapacities(queue, this.getLayout(idx++));
+ }
+ if (queue.get("children") && queue.get("children")
+ .length > 0) {
+ this.renderChildrenCapacities(queue, this.getLayout(idx++));
+ this.renderChildrenUsedCapacities(queue, this.getLayout(idx++));
+ }
+ },
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/simple-table.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/simple-table.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/simple-table.js
new file mode 100644
index 0000000..ed8ff9b
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/simple-table.js
@@ -0,0 +1,30 @@
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+ didInsertElement: function() {
+ var paging = this.get("paging") ? true : this.get("paging");
+ var ordering = this.get("ordering") ? true : this.get("ordering");
+ var info = this.get("info") ? true : this.get("info");
+ var bFilter = this.get("bFilter") ? true : this.get("bFilter");
+
+ var colDefs = [];
+ if (this.get("colTypes")) {
+ var typesArr = this.get("colTypes").split(' ');
+ var targetsArr = this.get("colTargets").split(' ');
+ for (var i = 0; i < typesArr.length; i++) {
+ colDefs.push({
+ type: typesArr[i],
+ targets: parseInt(targetsArr[i])
+ });
+ }
+ }
+
+ $('#' + this.get('table-id')).DataTable({
+ "paging": paging,
+ "ordering": ordering,
+ "info": info,
+ "bFilter": bFilter,
+ columnDefs: colDefs
+ });
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/timeline-view.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/timeline-view.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/timeline-view.js
new file mode 100644
index 0000000..fe402bb
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/timeline-view.js
@@ -0,0 +1,250 @@
+import Ember from 'ember';
+import Converter from 'yarn-ui/utils/converter';
+
+export default Ember.Component.extend({
+ canvas: {
+ svg: undefined,
+ h: 0,
+ w: 0,
+ tooltip: undefined
+ },
+
+ clusterMetrics: undefined,
+ modelArr: [],
+ colors: d3.scale.category10().range(),
+ _selected: undefined,
+
+ selected: function() {
+ return this._selected;
+ }.property(),
+
+ tableComponentName: function() {
+ return "app-attempt-table";
+ }.property(),
+
+ setSelected: function(d) {
+ if (this._selected == d) {
+ return;
+ }
+
+ // restore color
+ if (this._selected) {
+ var dom = d3.select("#timeline-bar-" + this._selected.get("id"));
+ dom.attr("fill", this.colors[0]);
+ }
+
+ this._selected = d;
+ this.set("selected", d);
+ dom = d3.select("#timeline-bar-" + d.get("id"));
+ dom.attr("fill", this.colors[1]);
+ },
+
+ getPerItemHeight: function() {
+ var arrSize = this.modelArr.length;
+
+ if (arrSize < 20) {
+ return 30;
+ } else if (arrSize < 100) {
+ return 10;
+ } else {
+ return 2;
+ }
+ },
+
+ getPerItemGap: function() {
+ var arrSize = this.modelArr.length;
+
+ if (arrSize < 20) {
+ return 5;
+ } else if (arrSize < 100) {
+ return 1;
+ } else {
+ return 1;
+ }
+ },
+
+ getCanvasHeight: function() {
+ return (this.getPerItemHeight() + this.getPerItemGap()) * this.modelArr.length + 200;
+ },
+
+ draw: function(start, end) {
+ // get w/h of the svg
+ var bbox = d3.select("#" + this.get("parent-id"))
+ .node()
+ .getBoundingClientRect();
+ this.canvas.w = bbox.width;
+ this.canvas.h = this.getCanvasHeight();
+
+ this.canvas.svg = d3.select("#" + this.get("parent-id"))
+ .append("svg")
+ .attr("width", this.canvas.w)
+ .attr("height", this.canvas.h)
+ .attr("id", this.get("my-id"));
+ this.renderTimeline(start, end);
+ },
+
+ renderTimeline: function(start, end) {
+ var border = 30;
+ var singleBarHeight = this.getPerItemHeight();
+ var gap = this.getPerItemGap();
+ var textWidth = 50;
+ /*
+ start-time end-time
+ |--------------------------------------|
+ ==============
+ ==============
+ ==============
+ ===============
+ */
+ var xScaler = d3.scale.linear()
+ .domain([start, end])
+ .range([0, this.canvas.w - 2 * border - textWidth]);
+
+ /*
+ * Render frame of timeline view
+ */
+ this.canvas.svg.append("line")
+ .attr("x1", border + textWidth)
+ .attr("y1", border - 5)
+ .attr("x2", this.canvas.w - border)
+ .attr("y2", border - 5)
+ .attr("class", "chart");
+
+ this.canvas.svg.append("line")
+ .attr("x1", border + textWidth)
+ .attr("y1", border - 10)
+ .attr("x2", border + textWidth)
+ .attr("y2", border - 5)
+ .attr("class", "chart");
+
+ this.canvas.svg.append("line")
+ .attr("x1", this.canvas.w - border)
+ .attr("y1", border - 10)
+ .attr("x2", this.canvas.w - border)
+ .attr("y2", border - 5)
+ .attr("class", "chart");
+
+ this.canvas.svg.append("text")
+ .text(Converter.timeStampToDate(start))
+ .attr("y", border - 15)
+ .attr("x", border + textWidth)
+ .attr("class", "bar-chart-text")
+ .attr("text-anchor", "left");
+
+ this.canvas.svg.append("text")
+ .text(Converter.timeStampToDate(end))
+ .attr("y", border - 15)
+ .attr("x", this.canvas.w - border)
+ .attr("class", "bar-chart-text")
+ .attr("text-anchor", "end");
+
+ // show bar
+ var bar = this.canvas.svg.selectAll("bars")
+ .data(this.modelArr)
+ .enter()
+ .append("rect")
+ .attr("y", function(d, i) {
+ return border + (gap + singleBarHeight) * i;
+ })
+ .attr("x", function(d, i) {
+ return border + textWidth + xScaler(d.get("startTs"));
+ })
+ .attr("height", singleBarHeight)
+ .attr("fill", function(d, i) {
+ return this.colors[0];
+ }.bind(this))
+ .attr("width", function(d, i) {
+ var finishedTs = xScaler(d.get("finishedTs"));
+ finishedTs = finishedTs > 0 ? finishedTs : xScaler(end);
+ return finishedTs - xScaler(d.get("startTs"));
+ })
+ .attr("id", function(d, i) {
+ return "timeline-bar-" + d.get("id");
+ });
+ bar.on("click", function(d) {
+ this.setSelected(d);
+ }.bind(this));
+
+ this.bindTooltip(bar);
+
+ if (this.modelArr.length <= 20) {
+ // show bar texts
+ for (var i = 0; i < this.modelArr.length; i++) {
+ this.canvas.svg.append("text")
+ .text(this.modelArr[i].get(this.get("label")))
+ .attr("y", border + (gap + singleBarHeight) * i + singleBarHeight / 2)
+ .attr("x", border)
+ .attr("class", "bar-chart-text");
+ }
+ }
+ },
+
+ bindTooltip: function(d) {
+ d.on("mouseover", function(d) {
+ this.tooltip
+ .style("left", (d3.event.pageX) + "px")
+ .style("top", (d3.event.pageY - 28) + "px");
+ }.bind(this))
+ .on("mousemove", function(d) {
+ this.tooltip.style("opacity", .9);
+ this.tooltip.html(d.get("tooltipLabel"))
+ .style("left", (d3.event.pageX) + "px")
+ .style("top", (d3.event.pageY - 28) + "px");
+ }.bind(this))
+ .on("mouseout", function(d) {
+ this.tooltip.style("opacity", 0);
+ }.bind(this));
+ },
+
+ initTooltip: function() {
+ this.tooltip = d3.select("body")
+ .append("div")
+ .attr("class", "tooltip")
+ .attr("id", "chart-tooltip")
+ .style("opacity", 0);
+ },
+
+ didInsertElement: function() {
+ // init tooltip
+ this.initTooltip();
+
+ // init model
+ if (this.get("rmModel")) {
+ this.get("rmModel").forEach(function(o) {
+ this.modelArr.push(o);
+ }.bind(this));
+ }
+
+ if (this.get("tsModel")) {
+ this.get("tsModel").forEach(function(o) {
+ this.modelArr.push(o);
+ }.bind(this));
+ }
+
+ this.modelArr.sort(function(a, b) {
+ var tsA = a.get("startTs");
+ var tsB = b.get("startTs");
+
+ return tsA - tsB;
+ });
+ if (this.modelArr.length > 0) {
+ var begin = this.modelArr[0].get("startTs");
+ }
+ var end = 0;
+ for (var i = 0; i < this.modelArr.length; i++) {
+ var ts = this.modelArr[i].get("finishedTs");
+ if (ts > end) {
+ end = ts;
+ }
+ }
+ if (end < begin) {
+ end = Date.now();
+ }
+
+ this.draw(begin, end);
+
+ if (this.modelArr.length > 0) {
+ this.setSelected(this.modelArr[0]);
+ }
+ },
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/tree-selector.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/tree-selector.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/tree-selector.js
new file mode 100644
index 0000000..470deaf
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/tree-selector.js
@@ -0,0 +1,257 @@
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+ // Map: <queue-name, queue>
+ map : undefined,
+
+ // Normalized data for d3
+ treeData: undefined,
+
+ // folded queues, folded[<queue-name>] == true means <queue-name> is folded
+ foldedQueues: { },
+
+ // maxDepth
+ maxDepth: 0,
+
+ // num of leaf queue, folded queue is treated as leaf queue
+ numOfLeafQueue: 0,
+
+ // mainSvg
+ mainSvg: undefined,
+
+ // Init data
+ initData: function() {
+ this.map = { };
+ this.treeData = { };
+ this.maxDepth = 0;
+ this.numOfLeafQueue = 0;
+
+ this.get("model")
+ .forEach(function(o) {
+ this.map[o.id] = o;
+ }.bind(this));
+
+ var selected = this.get("selected");
+
+ this.initQueue("root", 1, this.treeData);
+ },
+
+ // get Children array of given queue
+ getChildrenNamesArray: function(q) {
+ var namesArr = [];
+
+ // Folded queue's children is empty
+ if (this.foldedQueues[q.get("name")]) {
+ return namesArr;
+ }
+
+ var names = q.get("children");
+ if (names) {
+ names.forEach(function(name) {
+ namesArr.push(name);
+ });
+ }
+
+ return namesArr;
+ },
+
+ // Init queues
+ initQueue: function(queueName, depth, node) {
+ if ((!queueName) || (!this.map[queueName])) {
+ // Queue is not existed
+ return;
+ }
+
+ if (depth > this.maxDepth) {
+ this.maxDepth = this.maxDepth + 1;
+ }
+
+ var queue = this.map[queueName];
+
+ var names = this.getChildrenNamesArray(queue);
+
+ node.name = queueName;
+ node.parent = queue.get("parent");
+ node.queueData = queue;
+
+ if (names.length > 0) {
+ node.children = [];
+
+ names.forEach(function(name) {
+ var childQueueData = {};
+ node.children.push(childQueueData);
+ this.initQueue(name, depth + 1, childQueueData);
+ }.bind(this));
+ } else {
+ this.numOfLeafQueue = this.numOfLeafQueue + 1;
+ }
+ },
+
+ update: function(source, root, tree, diagonal) {
+ var duration = 300;
+ var i = 0;
+
+ // Compute the new tree layout.
+ var nodes = tree.nodes(root).reverse();
+ var links = tree.links(nodes);
+
+ // Normalize for fixed-depth.
+ nodes.forEach(function(d) { d.y = d.depth * 200; });
+
+ // Update the nodes\u2026
+ var node = this.mainSvg.selectAll("g.node")
+ .data(nodes, function(d) { return d.id || (d.id = ++i); });
+
+ // Enter any new nodes at the parent's previous position.
+ var nodeEnter = node.enter().append("g")
+ .attr("class", "node")
+ .attr("transform", function(d) { return "translate(" + source.y0 + "," + source.x0 + ")"; })
+ .on("click", function(d,i){
+ if (d.queueData.get("name") != this.get("selected")) {
+ document.location.href = "yarnQueue/" + d.queueData.get("name");
+ }
+ }.bind(this));
+ // .on("click", click);
+
+ nodeEnter.append("circle")
+ .attr("r", 1e-6)
+ .style("fill", function(d) {
+ var usedCap = d.queueData.get("usedCapacity");
+ if (usedCap <= 60.0) {
+ return "LimeGreen";
+ } else if (usedCap <= 100.0) {
+ return "DarkOrange";
+ } else {
+ return "LightCoral";
+ }
+ });
+
+ // append percentage
+ nodeEnter.append("text")
+ .attr("x", function(d) { return 0; })
+ .attr("dy", ".35em")
+ .attr("text-anchor", function(d) { return "middle"; })
+ .text(function(d) {
+ var usedCap = d.queueData.get("usedCapacity");
+ if (usedCap >= 100.0) {
+ return usedCap.toFixed(0) + "%";
+ } else {
+ return usedCap.toFixed(1) + "%";
+ }
+ })
+ .style("fill-opacity", 1e-6);
+
+ // append queue name
+ nodeEnter.append("text")
+ .attr("x", function(d) { return 40; })
+ .attr("dy", ".35em")
+ .attr("text-anchor", function(d) { return "start"; })
+ .text(function(d) { return d.name; })
+ .style("fill-opacity", 1e-6);
+
+ // Transition nodes to their new position.
+ var nodeUpdate = node.transition()
+ .duration(duration)
+ .attr("transform", function(d) { return "translate(" + d.y + "," + d.x + ")"; });
+
+ nodeUpdate.select("circle")
+ .attr("r", 20)
+ .attr("href",
+ function(d) {
+ return "yarnQueues/" + d.queueData.get("name");
+ })
+ .style("stroke", function(d) {
+ if (d.queueData.get("name") == this.get("selected")) {
+ return "red";
+ } else {
+ return "gray";
+ }
+ }.bind(this));
+
+ nodeUpdate.selectAll("text")
+ .style("fill-opacity", 1);
+
+ // Transition exiting nodes to the parent's new position.
+ var nodeExit = node.exit().transition()
+ .duration(duration)
+ .attr("transform", function(d) { return "translate(" + source.y + "," + source.x + ")"; })
+ .remove();
+
+ nodeExit.select("circle")
+ .attr("r", 1e-6);
+
+ nodeExit.select("text")
+ .style("fill-opacity", 1e-6);
+
+ // Update the links\u2026
+ var link = this.mainSvg.selectAll("path.link")
+ .data(links, function(d) { return d.target.id; });
+
+ // Enter any new links at the parent's previous position.
+ link.enter().insert("path", "g")
+ .attr("class", "link")
+ .attr("d", function(d) {
+ var o = {x: source.x0, y: source.y0};
+ return diagonal({source: o, target: o});
+ });
+
+ // Transition links to their new position.
+ link.transition()
+ .duration(duration)
+ .attr("d", diagonal);
+
+ // Transition exiting nodes to the parent's new position.
+ link.exit().transition()
+ .duration(duration)
+ .attr("d", function(d) {
+ var o = {x: source.x, y: source.y};
+ return diagonal({source: o, target: o});
+ })
+ .remove();
+
+ // Stash the old positions for transition.
+ nodes.forEach(function(d) {
+ d.x0 = d.x;
+ d.y0 = d.y;
+ });
+ },
+
+ reDraw: function() {
+ this.initData();
+
+ var margin = {top: 20, right: 120, bottom: 20, left: 120};
+ var treeWidth = this.maxDepth * 200;
+ var treeHeight = this.numOfLeafQueue * 80;
+ var width = treeWidth + margin.left + margin.right;
+ var height = treeHeight + margin.top + margin.bottom;
+ var layout = { };
+
+ if (this.mainSvg) {
+ this.mainSvg.remove();
+ }
+
+ this.mainSvg = d3.select("#" + this.get("parentId")).append("svg")
+ .attr("width", width)
+ .attr("height", height)
+ .attr("class", "tree-selector")
+ .append("g")
+ .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
+
+ var tree = d3.layout.tree().size([treeHeight, treeWidth]);
+
+ var diagonal = d3.svg.diagonal()
+ .projection(function(d) { return [d.y, d.x]; });
+
+ var root = this.treeData;
+ root.x0 = height / 2;
+ root.y0 = 0;
+
+ d3.select(self.frameElement).style("height", height);
+
+ this.update(root, root, tree, diagonal);
+ },
+
+ didInsertElement: function() {
+ this.reDraw();
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/.gitkeep
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/.gitkeep b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/.gitkeep
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/cluster-overview.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/cluster-overview.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/cluster-overview.js
new file mode 100644
index 0000000..5c3c825
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/cluster-overview.js
@@ -0,0 +1,5 @@
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+ loading: true,
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/yarn-apps.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/yarn-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/yarn-apps.js
new file mode 100644
index 0000000..55ff9aa
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/yarn-apps.js
@@ -0,0 +1,4 @@
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/yarn-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/yarn-queue.js
new file mode 100644
index 0000000..b16864e
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/yarn-queue.js
@@ -0,0 +1,6 @@
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+ needReload: true,
+ selectedQueue: undefined,
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/.gitkeep
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/.gitkeep b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/.gitkeep
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/index.html
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/index.html b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/index.html
new file mode 100644
index 0000000..edc4f2e
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/index.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <title>YarnUi</title>
+ <meta name="description" content="">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+
+ {{content-for 'head'}}
+
+ <link rel="stylesheet" href="assets/vendor.css">
+ <link rel="stylesheet" href="assets/yarn-ui.css">
+
+ {{content-for 'head-footer'}}
+ </head>
+ <body>
+ {{content-for 'body'}}
+
+ <script src="assets/vendor.js"></script>
+ <script src="assets/yarn-ui.js"></script>
+
+ {{content-for 'body-footer'}}
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/.gitkeep
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/.gitkeep b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/.gitkeep
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/cluster-info.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/cluster-info.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/cluster-info.js
new file mode 100644
index 0000000..b1f0a88
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/cluster-info.js
@@ -0,0 +1,13 @@
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ startedOn: DS.attr('string'),
+ state: DS.attr('string'),
+ haState: DS.attr('string'),
+ rmStateStoreName: DS.attr('string'),
+ resourceManagerVersion: DS.attr('string'),
+ resourceManagerBuildVersion: DS.attr('string'),
+ hadoopVersion: DS.attr('string'),
+ hadoopBuildVersion: DS.attr('string'),
+ hadoopVersionBuiltOn: DS.attr('string')
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/cluster-metric.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/cluster-metric.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/cluster-metric.js
new file mode 100644
index 0000000..2dd428c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/cluster-metric.js
@@ -0,0 +1,115 @@
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ appsSubmitted: DS.attr('number'),
+ appsCompleted: DS.attr('number'),
+ appsPending: DS.attr('number'),
+ appsRunning: DS.attr('number'),
+ appsFailed: DS.attr('number'),
+ appsKilled: DS.attr('number'),
+ reservedMB: DS.attr('number'),
+ availableMB: DS.attr('number'),
+ allocatedMB: DS.attr('number'),
+ reservedVirtualCores: DS.attr('number'),
+ availableVirtualCores: DS.attr('number'),
+ allocatedVirtualCores: DS.attr('number'),
+ containersAllocated: DS.attr('number'),
+ containersReserved: DS.attr('number'),
+ containersPending: DS.attr('number'),
+ totalMB: DS.attr('number'),
+ totalVirtualCores: DS.attr('number'),
+ totalNodes: DS.attr('number'),
+ lostNodes: DS.attr('number'),
+ unhealthyNodes: DS.attr('number'),
+ decommissionedNodes: DS.attr('number'),
+ rebootedNodes: DS.attr('number'),
+ activeNodes: DS.attr('number'),
+
+ getFinishedAppsDataForDonutChart: function() {
+ var arr = [];
+ arr.push({
+ label: "Completed",
+ value: this.get("appsCompleted")
+ });
+ arr.push({
+ label: "Killed",
+ value: this.get("appsKilled")
+ });
+ arr.push({
+ label: "Failed",
+ value: this.get("appsFailed")
+ });
+
+ return arr;
+ }.property("appsCompleted", "appsKilled", "appsFailed"),
+
+ getRunningAppsDataForDonutChart: function() {
+ var arr = [];
+
+ arr.push({
+ label: "Pending",
+ value: this.get("appsPending")
+ });
+ arr.push({
+ label: "Running",
+ value: this.get("appsRunning")
+ });
+
+ return arr;
+ }.property("appsPending", "appsRunning"),
+
+ getNodesDataForDonutChart: function() {
+ var arr = [];
+ arr.push({
+ label: "Active",
+ value: this.get("activeNodes")
+ });
+ arr.push({
+ label: "Unhealthy",
+ value: this.get("unhealthyNodes")
+ });
+ arr.push({
+ label: "Decomissioned",
+ value: this.get("decommissionedNodes")
+ });
+ return arr;
+ }.property("activeNodes", "unhealthyNodes", "decommissionedNodes"),
+
+ getMemoryDataForDonutChart: function() {
+ var type = "MB";
+ var arr = [];
+ arr.push({
+ label: "Allocated",
+ value: this.get("allocated" + type)
+ });
+ arr.push({
+ label: "Reserved",
+ value: this.get("reserved" + type)
+ });
+ arr.push({
+ label: "Available",
+ value: this.get("available" + type)
+ });
+
+ return arr;
+ }.property("allocatedMB", "reservedMB", "availableMB"),
+
+ getVCoreDataForDonutChart: function() {
+ var type = "VirtualCores";
+ var arr = [];
+ arr.push({
+ label: "Allocated",
+ value: this.get("allocated" + type)
+ });
+ arr.push({
+ label: "Reserved",
+ value: this.get("reserved" + type)
+ });
+ arr.push({
+ label: "Available",
+ value: this.get("available" + type)
+ });
+
+ return arr;
+ }.property("allocatedVirtualCores", "reservedVirtualCores", "availableVirtualCores"),
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app-attempt.js
new file mode 100644
index 0000000..fcb5134
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app-attempt.js
@@ -0,0 +1,44 @@
+import DS from 'ember-data';
+import Converter from 'yarn-ui/utils/converter';
+
+export default DS.Model.extend({
+ startTime: DS.attr('string'),
+ finishedTime: DS.attr('string'),
+ containerId: DS.attr('string'),
+ nodeHttpAddress: DS.attr('string'),
+ nodeId: DS.attr('string'),
+ logsLink: DS.attr('string'),
+
+ startTs: function() {
+ return Converter.dateToTimeStamp(this.get("startTime"));
+ }.property("startTime"),
+
+ finishedTs: function() {
+ var ts = Converter.dateToTimeStamp(this.get("finishedTime"));
+ return ts;
+ }.property("finishedTime"),
+
+ shortAppAttemptId: function() {
+ return "attempt_" +
+ parseInt(Converter.containerIdToAttemptId(this.get("containerId")).split("_")[3]);
+ }.property("containerId"),
+
+ elapsedTime: function() {
+ var elapsedMs = this.get("finishedTs") - this.get("startTs");
+ if (elapsedMs <= 0) {
+ elapsedMs = Date.now() - this.get("startTs");
+ }
+
+ return Converter.msToElapsedTime(elapsedMs);
+ }.property(),
+
+ tooltipLabel: function() {
+ return "<p>Id:" + this.get("id") +
+ "</p><p>ElapsedTime:" +
+ String(this.get("elapsedTime")) + "</p>";
+ }.property(),
+
+ link: function() {
+ return "/yarnAppAttempt/" + this.get("id");
+ }.property(),
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app.js
new file mode 100644
index 0000000..cb79be1
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app.js
@@ -0,0 +1,65 @@
+import Converter from 'yarn-ui/utils/converter';
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ appName: DS.attr('string'),
+ user: DS.attr('string'),
+ queue: DS.attr('string'),
+ state: DS.attr('string'),
+ startTime: DS.attr('string'),
+ elapsedTime: DS.attr('string'),
+ finalStatus: DS.attr('string'),
+ finishedTime: DS.attr('finishedTime'),
+ progress: DS.attr('number'),
+ diagnostics: DS.attr('string'),
+ amContainerLogs: DS.attr('string'),
+ amHostHttpAddress: DS.attr('string'),
+ logAggregationStatus: DS.attr('string'),
+ unmanagedApplication: DS.attr('string'),
+ amNodeLabelExpression: DS.attr('string'),
+ applicationTags: DS.attr('string'),
+ priority: DS.attr('number'),
+ allocatedMB: DS.attr('number'),
+ allocatedVCores: DS.attr('number'),
+ runningContainers: DS.attr('number'),
+ memorySeconds: DS.attr('number'),
+ vcoreSeconds: DS.attr('number'),
+ preemptedResourceMB: DS.attr('number'),
+ preemptedResourceVCores: DS.attr('number'),
+ numNonAMContainerPreempted: DS.attr('number'),
+ numAMContainerPreempted: DS.attr('number'),
+
+ isFailed: function() {
+ return this.get('finalStatus') == "FAILED"
+ }.property("finalStatus"),
+
+ allocatedResource: function() {
+ return Converter.resourceToString(this.get("allocatedMB"), this.get("allocatedVCores"));
+ }.property("allocatedMB", "allocatedVCores"),
+
+ preemptedResource: function() {
+ return Converter.resourceToString(this.get("preemptedResourceMB"), this.get("preemptedResourceVCores"));
+ }.property("preemptedResourceMB", "preemptedResourceVCores"),
+
+ aggregatedResourceUsage: function() {
+ return Converter.resourceToString(this.get("memorySeconds"), this.get("vcoreSeconds")) + " (� Secs)";
+ }.property("memorySeconds", "vcoreSeconds"),
+
+ progressStyle: function() {
+ return "width: " + this.get("progress") + "%";
+ }.property("progress"),
+
+ finalStatusStyle: function() {
+ var style = "default";
+ var finalStatus = this.get("finalStatus");
+ if (finalStatus == "KILLED") {
+ style = "warning";
+ } else if (finalStatus == "FAILED") {
+ style = "danger";
+ } else {
+ style = "success";
+ }
+
+ return "label label-" + style;
+ }.property("finalStatus")
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-container.js
new file mode 100644
index 0000000..f7977be
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-container.js
@@ -0,0 +1,39 @@
+import DS from 'ember-data';
+import Converter from 'yarn-ui/utils/converter';
+
+export default DS.Model.extend({
+ allocatedMB: DS.attr('number'),
+ allocatedVCores: DS.attr('number'),
+ assignedNodeId: DS.attr('string'),
+ priority: DS.attr('number'),
+ startedTime: DS.attr('number'),
+ finishedTime: DS.attr('number'),
+ logUrl: DS.attr('string'),
+ containerExitStatus: DS.attr('number'),
+ containerState: DS.attr('string'),
+ nodeHttpAddress: DS.attr('string'),
+
+ startTs: function() {
+ return Converter.dateToTimeStamp(this.get("startedTime"));
+ }.property("startedTime"),
+
+ finishedTs: function() {
+ var ts = Converter.dateToTimeStamp(this.get("finishedTime"));
+ return ts;
+ }.property("finishedTime"),
+
+ elapsedTime: function() {
+ var elapsedMs = this.get("finishedTs") - this.get("startTs");
+ if (elapsedMs <= 0) {
+ elapsedMs = Date.now() - this.get("startTs");
+ }
+
+ return Converter.msToElapsedTime(elapsedMs);
+ }.property(),
+
+ tooltipLabel: function() {
+ return "<p>Id:" + this.get("id") +
+ "</p><p>ElapsedTime:" +
+ String(this.get("elapsedTime")) + "</p>";
+ }.property(),
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-queue.js
new file mode 100644
index 0000000..5b91d70
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-queue.js
@@ -0,0 +1,76 @@
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ name: DS.attr('string'),
+ children: DS.attr('array'),
+ parent: DS.attr('string'),
+ capacity: DS.attr('number'),
+ maxCapacity: DS.attr('number'),
+ usedCapacity: DS.attr('number'),
+ absCapacity: DS.attr('number'),
+ absMaxCapacity: DS.attr('number'),
+ absUsedCapacity: DS.attr('number'),
+ state: DS.attr('string'),
+ userLimit: DS.attr('number'),
+ userLimitFactor: DS.attr('number'),
+ preemptionDisabled: DS.attr('number'),
+ numPendingApplications: DS.attr('number'),
+ numActiveApplications: DS.attr('number'),
+ users: DS.hasMany('YarnUser'),
+
+ isLeafQueue: function() {
+ var len = this.get("children.length");
+ if (!len) {
+ return true;
+ }
+ return len <= 0;
+ }.property("children"),
+
+ capacitiesBarChartData: function() {
+ return [
+ {
+ label: "Absolute Capacity",
+ value: this.get("name") == "root" ? 100 : this.get("absCapacity")
+ },
+ {
+ label: "Absolute Used",
+ value: this.get("name") == "root" ? this.get("usedCapacity") : this.get("absUsedCapacity")
+ },
+ {
+ label: "Absolute Max Capacity",
+ value: this.get("name") == "root" ? 100 : this.get("absMaxCapacity")
+ }
+ ]
+ }.property("absCapacity", "absUsedCapacity", "absMaxCapacity"),
+
+ userUsagesDonutChartData: function() {
+ var data = [];
+ if (this.get("users")) {
+ this.get("users").forEach(function(o) {
+ data.push({
+ label: o.get("name"),
+ value: o.get("usedMemoryMB")
+ })
+ });
+ }
+
+ return data;
+ }.property("users"),
+
+ hasUserUsages: function() {
+ return this.get("userUsagesDonutChartData").length > 0;
+ }.property(),
+
+ numOfApplicationsDonutChartData: function() {
+ return [
+ {
+ label: "Pending Apps",
+ value: this.get("numPendingApplications") || 0 // TODO, fix the REST API so root will return #applications as well.
+ },
+ {
+ label: "Active Apps",
+ value: this.get("numActiveApplications") || 0
+ }
+ ]
+ }.property(),
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-user.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-user.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-user.js
new file mode 100644
index 0000000..6e9c03c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-user.js
@@ -0,0 +1,8 @@
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ name: DS.attr('string'),
+ queueName: DS.attr('string'),
+ usedMemoryMB: DS.attr('number'),
+ usedVCore: DS.attr('number')
+})
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/router.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/router.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/router.js
new file mode 100644
index 0000000..c31190f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/router.js
@@ -0,0 +1,16 @@
+import Ember from 'ember';
+import config from './config/environment';
+
+var Router = Ember.Router.extend({
+ location: config.locationType
+});
+
+Router.map(function() {
+ this.route('yarnApps');
+ this.route('yarnQueue', { path: '/yarnQueue/:queue_name' });
+ this.route('clusterOverview');
+ this.route('yarnApp', { path: '/yarnApp/:app_id' });
+ this.route('yarnAppAttempt', { path: '/yarnAppAttempt/:app_attempt_id'});
+});
+
+export default Router;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/.gitkeep
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/.gitkeep b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/.gitkeep
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/cluster-overview.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/cluster-overview.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/cluster-overview.js
new file mode 100644
index 0000000..4ba5dcd
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/cluster-overview.js
@@ -0,0 +1,11 @@
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model() {
+ return this.store.findAll('ClusterMetric');
+ },
+
+ afterModel() {
+ this.controllerFor("ClusterOverview").set("loading", false);
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-app-attempt.js
new file mode 100644
index 0000000..3b6adc7
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-app-attempt.js
@@ -0,0 +1,21 @@
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ return Ember.RSVP.hash({
+ attempt: this.store.findRecord('yarnAppAttempt', param.app_attempt_id),
+
+ rmContainers: this.store.query('yarnContainer',
+ {
+ app_attempt_id: param.app_attempt_id,
+ is_rm: true
+ }),
+
+ tsContainers: this.store.query('yarnContainer',
+ {
+ app_attempt_id: param.app_attempt_id,
+ is_rm: false
+ }),
+ });
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-app.js
new file mode 100644
index 0000000..03092aa
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-app.js
@@ -0,0 +1,10 @@
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ return Ember.RSVP.hash({
+ app: this.store.find('yarnApp', param.app_id),
+ attempts: this.store.query('yarnAppAttempt', { appId: param.app_id})
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-apps.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-apps.js
new file mode 100644
index 0000000..79d184f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-apps.js
@@ -0,0 +1,8 @@
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model() {
+ var apps = this.store.findAll('yarnApp');
+ return apps
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queue.js
new file mode 100644
index 0000000..9396bac
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queue.js
@@ -0,0 +1,20 @@
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ return Ember.RSVP.hash({
+ selected : param.queue_name,
+ queues: this.store.findAll('yarnQueue'),
+ selectedQueue : undefined,
+ apps: undefined, // apps of selected queue
+ });
+ },
+
+ afterModel(model) {
+ model.selectedQueue = this.store.peekRecord('yarnQueue', model.selected);
+ model.apps = this.store.findAll('yarnApp');
+ model.apps.forEach(function(o) {
+ console.log(o);
+ })
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queues/index.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queues/index.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queues/index.js
new file mode 100644
index 0000000..9be90b1
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queues/index.js
@@ -0,0 +1,5 @@
+export default Ember.Route.extend({
+ beforeModel() {
+ this.transitionTo('yarnQueues.root');
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queues/queues-selector.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queues/queues-selector.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queues/queues-selector.js
new file mode 100644
index 0000000..0f6c572
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-queues/queues-selector.js
@@ -0,0 +1,7 @@
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model() {
+ return this.store.findAll('yarnQueue');
+ },
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/906fc27b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-info.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-info.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-info.js
new file mode 100644
index 0000000..cc936cb
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-info.js
@@ -0,0 +1,29 @@
+import DS from 'ember-data';
+
+export default DS.JSONAPISerializer.extend({
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ var fixedPayload = {
+ id: id,
+ type: primaryModelClass.modelName,
+ attributes: payload
+ };
+
+ return this._super(store, primaryModelClass, fixedPayload, id,
+ requestType);
+ },
+
+ normalizeArrayResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // return expected is { data: [ {}, {} ] }
+ var normalizedArrayResponse = {};
+
+ // payload has apps : { app: [ {},{},{} ] }
+ // need some error handling for ex apps or app may not be defined.
+ normalizedArrayResponse.data = [
+ this.normalizeSingleResponse(store, primaryModelClass,
+ payload.clusterInfo, payload.clusterInfo.id, requestType)
+ ];
+ return normalizedArrayResponse;
+ }
+});
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[03/50] [abbrv] hadoop git commit: YARN-4624. NPE in
PartitionQueueCapacitiesInfo while accessing Schduler UI. Contributed by
Brahma Reddy Battula
Posted by wa...@apache.org.
YARN-4624. NPE in PartitionQueueCapacitiesInfo while accessing Schduler UI. Contributed by Brahma Reddy Battula
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/d81b8163
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/d81b8163
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/d81b8163
Branch: refs/heads/YARN-3368
Commit: d81b8163b4e5c0466a6af6e1068f512c5fd24a61
Parents: e605d47
Author: Naganarasimha <na...@apache.org>
Authored: Sat Aug 6 01:13:36 2016 +0530
Committer: Naganarasimha <na...@apache.org>
Committed: Sat Aug 6 01:13:36 2016 +0530
----------------------------------------------------------------------
.../resourcemanager/webapp/dao/PartitionQueueCapacitiesInfo.java | 4 ++--
.../server/resourcemanager/webapp/dao/QueueCapacitiesInfo.java | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d81b8163/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/PartitionQueueCapacitiesInfo.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/PartitionQueueCapacitiesInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/PartitionQueueCapacitiesInfo.java
index 9c73bf2..5e298f9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/PartitionQueueCapacitiesInfo.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/PartitionQueueCapacitiesInfo.java
@@ -35,14 +35,14 @@ public class PartitionQueueCapacitiesInfo {
private float absoluteCapacity;
private float absoluteUsedCapacity;
private float absoluteMaxCapacity = 100;
- private Float maxAMLimitPercentage;
+ private float maxAMLimitPercentage;
public PartitionQueueCapacitiesInfo() {
}
public PartitionQueueCapacitiesInfo(String partitionName, float capacity,
float usedCapacity, float maxCapacity, float absCapacity,
- float absUsedCapacity, float absMaxCapacity, Float maxAMLimitPercentage) {
+ float absUsedCapacity, float absMaxCapacity, float maxAMLimitPercentage) {
super();
this.partitionName = partitionName;
this.capacity = capacity;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d81b8163/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/QueueCapacitiesInfo.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/QueueCapacitiesInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/QueueCapacitiesInfo.java
index 1f0aa86..9a3e439 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/QueueCapacitiesInfo.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/QueueCapacitiesInfo.java
@@ -49,7 +49,7 @@ public class QueueCapacitiesInfo {
float absCapacity;
float absUsedCapacity;
float absMaxCapacity;
- Float maxAMLimitPercentage;
+ float maxAMLimitPercentage;
for (String partitionName : capacities.getExistingNodeLabels()) {
usedCapacity = capacities.getUsedCapacity(partitionName) * 100;
capacity = capacities.getCapacity(partitionName) * 100;
@@ -68,7 +68,7 @@ public class QueueCapacitiesInfo {
queueCapacitiesByPartition.add(new PartitionQueueCapacitiesInfo(
partitionName, capacity, usedCapacity, maxCapacity, absCapacity,
absUsedCapacity, absMaxCapacity,
- considerAMUsage ? maxAMLimitPercentage : null));
+ considerAMUsage ? maxAMLimitPercentage : 0f));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[07/50] [abbrv] hadoop git commit: HDFS-10693. metaSave should print
blocks, not LightWeightHashSet. Contributed by Yuanbo Liu.
Posted by wa...@apache.org.
HDFS-10693. metaSave should print blocks, not LightWeightHashSet. Contributed by Yuanbo Liu.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/4d3af47f
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/4d3af47f
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/4d3af47f
Branch: refs/heads/YARN-3368
Commit: 4d3af47f2765f6f57936d316ef2a4150b787cc97
Parents: 131d58a
Author: Konstantin V Shvachko <sh...@apache.org>
Authored: Sun Aug 7 14:29:26 2016 -0700
Committer: Konstantin V Shvachko <sh...@apache.org>
Committed: Sun Aug 7 14:29:26 2016 -0700
----------------------------------------------------------------------
.../hadoop/hdfs/server/blockmanagement/InvalidateBlocks.java | 3 ++-
.../java/org/apache/hadoop/hdfs/server/namenode/TestMetaSave.java | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/4d3af47f/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/InvalidateBlocks.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/InvalidateBlocks.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/InvalidateBlocks.java
index ae28993..694cc95 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/InvalidateBlocks.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/InvalidateBlocks.java
@@ -32,6 +32,7 @@ import org.apache.hadoop.hdfs.protocol.Block;
import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
import org.apache.hadoop.hdfs.server.namenode.NameNode;
import org.apache.hadoop.hdfs.util.LightWeightHashSet;
+import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.util.Time;
import org.apache.hadoop.hdfs.DFSUtil;
@@ -151,7 +152,7 @@ class InvalidateBlocks {
final LightWeightHashSet<Block> blocks = entry.getValue();
if (blocks.size() > 0) {
out.println(entry.getKey());
- out.println(blocks);
+ out.println(StringUtils.join(',', blocks));
}
}
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/4d3af47f/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestMetaSave.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestMetaSave.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestMetaSave.java
index cd1d966..9816d00 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestMetaSave.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestMetaSave.java
@@ -162,6 +162,7 @@ public class TestMetaSave {
//skip 2 lines to reach HDFS-9033 scenario.
line = reader.readLine();
line = reader.readLine();
+ assertTrue(line.contains("blk"));
// skip 1 line for Corrupt Blocks section.
line = reader.readLine();
line = reader.readLine();
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[35/50] [abbrv] hadoop git commit: YARN-4849. [YARN-3368] cleanup
code base, integrate web UI related build to mvn, and fix licenses. (wangda)
Posted by wa...@apache.org.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-container-log-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-container-log-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-container-log-test.js
new file mode 100644
index 0000000..4e68da0
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-container-log-test.js
@@ -0,0 +1,120 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+import Constants from 'yarn-ui/constants';
+
+moduleFor('route:yarn-container-log', 'Unit | Route | ContainerLog', {
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+});
+
+test('Test getting container log', function(assert) {
+ var response = {
+ logs: "This is syslog",
+ containerID: "container_e32_1456000363780_0002_01_000001",
+ logFileName: "syslog"};
+ var store = {
+ findRecord: function(type) {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response);
+ }
+ )}
+ };
+ assert.expect(6);
+ var route = this.subject();
+ route.set('store', store);
+ var model = route.model({node_id: "localhost:64318",
+ node_addr: "localhost:8042",
+ container_id: "container_e32_1456000363780_0002_01_000001",
+ filename: "syslog"});
+ model.then(function(value) {
+ assert.ok(value);
+ assert.ok(value.containerLog);
+ assert.deepEqual(value.containerLog, response);
+ assert.ok(value.nodeInfo);
+ assert.equal(value.nodeInfo.addr, 'localhost:8042');
+ assert.equal(value.nodeInfo.id, 'localhost:64318');
+ });
+});
+
+/**
+ * This can happen when an empty response is sent from server
+ */
+test('Test non HTTP error while getting container log', function(assert) {
+ var error = {};
+ var response = {
+ logs: "",
+ containerID: "container_e32_1456000363780_0002_01_000001",
+ logFileName: "syslog"};
+ var store = {
+ findRecord: function(type) {
+ return new Ember.RSVP.Promise(function(resolve, reject) {
+ reject(error);
+ }
+ )}
+ };
+ assert.expect(6);
+ var route = this.subject();
+ route.set('store', store);
+ var model = route.model({node_id: "localhost:64318",
+ node_addr: "localhost:8042",
+ container_id: "container_e32_1456000363780_0002_01_000001",
+ filename: "syslog"});
+ model.then(function(value) {
+ assert.ok(value);
+ assert.ok(value.containerLog);
+ assert.deepEqual(value.containerLog, response);
+ assert.ok(value.nodeInfo);
+ assert.equal(value.nodeInfo.addr, 'localhost:8042');
+ assert.equal(value.nodeInfo.id, 'localhost:64318');
+ });
+});
+
+test('Test HTTP error while getting container log', function(assert) {
+ var error = {errors: [{status: 404, responseText: 'Not Found'}]};
+ var response = {
+ logs: "",
+ containerID: "container_e32_1456000363780_0002_01_000001",
+ logFileName: "syslog"};
+ var store = {
+ findRecord: function(type) {
+ return new Ember.RSVP.Promise(function(resolve, reject) {
+ reject(error);
+ }
+ )}
+ };
+ assert.expect(5);
+ var route = this.subject();
+ route.set('store', store);
+ var model = route.model({node_id: "localhost:64318",
+ node_addr: "localhost:8042",
+ container_id: "container_e32_1456000363780_0002_01_000001",
+ filename: "syslog"});
+ model.then(function(value) {
+ assert.ok(value);
+ assert.ok(value.errors);
+ assert.equal(value.errors.length, 1);
+ assert.equal(value.errors[0].status, 404);
+ assert.equal(value.errors[0].responseText, 'Not Found');
+ });
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-app-test.js
new file mode 100644
index 0000000..8e5acf9
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-app-test.js
@@ -0,0 +1,56 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:yarn-node-app', 'Unit | Route | NodeApp', {
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+});
+
+test('Test getting specific app on a node', function(assert) {
+ var response =
+ {id:"application_1456251210105_0001", state:"FINISHED", user:"root"};
+ var store = {
+ queryRecord: function(type, query) {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response);
+ });
+ }
+ };
+ assert.expect(6);
+ var route = this.subject();
+ route.set('store', store);
+ var model =
+ route.model({node_id:"localhost:64318", node_addr:"localhost:8042",
+ app_id:"application_1456251210105_0001"}).
+ then(
+ function(value){
+ assert.ok(value);
+ assert.ok(value.nodeApp);
+ assert.deepEqual(value.nodeApp, response);
+ assert.ok(value.nodeInfo);
+ assert.equal(value.nodeInfo.addr, 'localhost:8042');
+ assert.equal(value.nodeInfo.id, 'localhost:64318');
+ }
+ );
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-apps-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-apps-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-apps-test.js
new file mode 100644
index 0000000..44d9995
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-apps-test.js
@@ -0,0 +1,60 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:yarn-node-apps', 'Unit | Route | NodeApps', {
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+});
+
+test('Test getting apps on a node', function(assert) {
+ var response = [
+ {id:"application_1456251210105_0001", state:"FINISHED", user:"root"},
+ {id:"application_1456251210105_0002", state:"RUNNING",user:"root",
+ containerids:["container_e38_1456251210105_0002_01_000001",
+ "container_e38_1456251210105_0002_01_000002"]}];
+ var store = {
+ query: function(type, query) {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response.slice());
+ });
+ }
+ };
+ assert.expect(8);
+ var route = this.subject();
+ route.set('store', store);
+ var model =
+ route.model({node_id:"localhost:64318", node_addr:"localhost:8042"}).
+ then(
+ function(value){
+ assert.ok(value);
+ assert.ok(value.apps);
+ assert.equal(value.apps.length, 2);
+ assert.deepEqual(response[0], value.apps[0]);
+ assert.deepEqual(response[1], value.apps[1]);
+ assert.ok(value.nodeInfo);
+ assert.equal(value.nodeInfo.addr, 'localhost:8042');
+ assert.equal(value.nodeInfo.id, 'localhost:64318');
+ }
+ );
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-container-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-container-test.js
new file mode 100644
index 0000000..f0b68fc
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-container-test.js
@@ -0,0 +1,61 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:yarn-node-container', 'Unit | Route | NodeContainer', {
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+});
+
+test('Test getting specific container on a node', function(assert) {
+ var response =
+ {id: "container_e32_1456000363780_0002_01_000001", state: "RUNNING",
+ exitCode:-1000,diagnostics:"",user:"root",totalMemoryNeededMB:2048,
+ totalVCoresNeeded:1,containerLogsLink: "http://localhost:8042/node/" +
+ "containerlogs/container_e32_1456000363780_0002_01_000001/root",
+ nodeId: "localhost:64318", containerLogFiles:["syslog","stderr",
+ "stdout"]};
+ var store = {
+ queryRecord: function(type, query) {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response);
+ });
+ }
+ };
+ assert.expect(6);
+ var route = this.subject();
+ route.set('store', store);
+ var model =
+ route.model({node_id:"localhost:64318", node_addr:"localhost:8042",
+ container_id:"container_e32_1456000363780_0002_01_000001"}).
+ then(
+ function(value){
+ assert.ok(value);
+ assert.ok(value.nodeContainer);
+ assert.deepEqual(value.nodeContainer, response);
+ assert.ok(value.nodeInfo);
+ assert.equal(value.nodeInfo.addr, 'localhost:8042');
+ assert.equal(value.nodeInfo.id, 'localhost:64318');
+ }
+ );
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-containers-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-containers-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-containers-test.js
new file mode 100644
index 0000000..8359713
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-containers-test.js
@@ -0,0 +1,68 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:yarn-node-containers', 'Unit | Route | NodeContainers', {
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+});
+
+test('Test getting apps on a node', function(assert) {
+ var response =
+ [{id: "container_e32_1456000363780_0002_01_000001", state: "RUNNING",
+ exitCode:-1000,diagnostics:"",user:"root",totalMemoryNeededMB:2048,
+ totalVCoresNeeded:1,containerLogsLink: "http://localhost:8042/node/" +
+ "containerlogs/container_e32_1456000363780_0002_01_000001/root",
+ nodeId: "localhost:64318", containerLogFiles:["syslog","stderr",
+ "stdout"]},
+ {id:"container_e32_1456000363780_0002_01_000003", state:"RUNNING",
+ exitCode:-1000, diagnostics:"", user:"root", totalMemoryNeededMB:1024,
+ totalVCoresNeeded:1,containerLogsLink:"http://localhost:8042/node" +
+ "/containerlogs/container_e32_1456000363780_0002_01_000003/root",
+ nodeId:"localhost:64318",containerLogFiles:["syslog","stderr",
+ "syslog.shuffle","stdout"]}];
+ var store = {
+ query: function(type, query) {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response.slice());
+ });
+ }
+ };
+ assert.expect(8);
+ var route = this.subject();
+ route.set('store', store);
+ var model =
+ route.model({node_id:"localhost:64318", node_addr:"localhost:8042"}).
+ then(
+ function(value){
+ assert.ok(value);
+ assert.ok(value.containers);
+ assert.equal(value.containers.length, 2);
+ assert.deepEqual(value.containers[0], response[0]);
+ assert.deepEqual(value.containers[1], response[1]);
+ assert.ok(value.nodeInfo);
+ assert.equal(value.nodeInfo.addr, 'localhost:8042');
+ assert.equal(value.nodeInfo.id, 'localhost:64318');
+ }
+ );
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-test.js
new file mode 100644
index 0000000..4e82f1b
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-node-test.js
@@ -0,0 +1,84 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+import Ember from 'ember';
+
+moduleFor('route:yarn-node', 'Unit | Route | Node', {
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+});
+
+test('Test getting a node', function(assert) {
+ var nodeResponse =
+ {healthReport: "Healthy", totalVmemAllocatedContainersMB: 344064,
+ totalPmemAllocatedContainersMB: 163840,
+ totalVCoresAllocatedContainers: 160,
+ vmemCheckEnabled: true, pmemCheckEnabled: true,
+ lastNodeUpdateTime: 1456250210310, nodeHealthy: true,
+ nodeManagerVersion: "3.0.0-SNAPSHOT",
+ nodeManagerBuildVersion: "3.0.0-SNAPSHOT",
+ nodeManagerVersionBuiltOn: "2000-01-01T00:00Z",
+ hadoopVersion: "3.0.0-SNAPSHOT",
+ hadoopBuildVersion: "3.0.0-SNAPSHOT",
+ hadoopVersionBuiltOn: "2000-01-01T00:00Z",
+ id: "localhost:64318", nodeHostName: "192.168.0.102",
+ nmStartupTime: 1456250208231};
+ var rmNodeResponse =
+ {rack: "/default-rack", state: "RUNNING", id: "localhost:64318",
+ nodeHostName: "localhost", nodeHTTPAddress: "localhost:8042",
+ lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
+ healthReport: "", numContainers: 0, usedMemoryMB: 0,
+ availMemoryMB: 163840, usedVirtualCores: 0,
+ availableVirtualCores: 160,
+ resourceUtilization: {
+ nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
+ nodeCPUUsage: 0.14995001256465912,
+ aggregatedContainersPhysicalMemoryMB: 0,
+ aggregatedContainersVirtualMemoryMB: 0,
+ containersCPUUsage: 0
+ }};
+
+ // Create store which returns appropriate responses.
+ var store = {
+ findRecord: function(type) {
+ if (type == 'yarnNode') {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(nodeResponse);
+ });
+ } else if (type == 'yarnRmNode') {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(rmNodeResponse);
+ });
+ }
+ }
+ };
+ var route = this.subject();
+ assert.expect(4);
+ route.set('store', store);
+ var model = route.model(
+ {node_addr:"localhost:8042", node_id:"localhost:64318"})._result;
+ assert.ok(model.node);
+ assert.deepEqual(model.node, nodeResponse);
+ assert.ok(model.rmNode);
+ assert.deepEqual(model.rmNode, rmNodeResponse);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-nodes-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-nodes-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-nodes-test.js
new file mode 100644
index 0000000..baa5bd6
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/routes/yarn-nodes-test.js
@@ -0,0 +1,74 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+import Ember from 'ember';
+
+moduleFor('route:yarn-nodes', 'Unit | Route | Nodes', {
+});
+
+test('Basic creation test', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+ assert.ok(route.model);
+});
+
+test('Test getting nodes', function(assert) {
+ var response = [{
+ rack: "/default-rack", state: "RUNNING", id: "192.168.1.1:64318",
+ nodeHostName: "192.168.1.1", nodeHTTPAddress: "192.168.1.1:8042",
+ lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
+ healthReport: "", numContainers: 0, usedMemoryMB: 0,
+ availMemoryMB: 163840, usedVirtualCores: 0,
+ availableVirtualCores: 160,
+ resourceUtilization: {
+ nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
+ nodeCPUUsage: 0.14995001256465912,
+ aggregatedContainersPhysicalMemoryMB: 0,
+ aggregatedContainersVirtualMemoryMB: 0,
+ containersCPUUsage: 0
+ }},
+ {rack: "/default-rack", state: "RUNNING", id: "192.168.1.2:64318",
+ nodeHostName: "192.168.1.2", nodeHTTPAddress: "192.168.1.2:8042",
+ lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
+ healthReport: "", numContainers: 0, usedMemoryMB: 0,
+ availMemoryMB: 163840, usedVirtualCores: 0,
+ availableVirtualCores: 160,
+ resourceUtilization: {
+ nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
+ nodeCPUUsage: 0.14995001256465912,
+ aggregatedContainersPhysicalMemoryMB: 0,
+ aggregatedContainersVirtualMemoryMB: 0,
+ containersCPUUsage: 0
+ }}];
+ var store = {
+ findAll: function(type) {
+ return new Ember.RSVP.Promise(function(resolve) {
+ resolve(response);
+ });
+ }
+ };
+ var route = this.subject();
+ route.set('store', store);
+ var model = route.model()._result;
+ assert.expect(4);
+ assert.ok(model);
+ assert.equal(model.length, 2);
+ assert.deepEqual(response[0], model[0]);
+ assert.deepEqual(response[1], model[1]);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-app-test.js
new file mode 100644
index 0000000..4158612
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-app-test.js
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+
+import { moduleForModel, test } from 'ember-qunit';
+
+moduleForModel('yarn-app', 'Unit | Serializer | yarn app', {
+ // Specify the other units that are required for this test.
+ needs: ['serializer:yarn-app']
+});
+
+// Replace this with your real tests.
+test('it serializes records', function(assert) {
+ var record = this.subject();
+
+ var serializedRecord = record.serialize();
+
+ assert.ok(serializedRecord);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-container-log-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-container-log-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-container-log-test.js
new file mode 100644
index 0000000..2349dc2
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-container-log-test.js
@@ -0,0 +1,49 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('serializer:yarn-container-log', 'Unit | Serializer | ContainerLog', {
+});
+
+test('Basic creation test', function(assert) {
+ let serializer = this.subject();
+
+ assert.ok(serializer);
+ assert.ok(serializer.normalizeSingleResponse);
+});
+
+test('normalizeSingleResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-container-log"
+ },
+ payload = "This is syslog";
+ var id = "localhost:64318!container_e32_1456000363780_0002_01_000001!syslog";
+ assert.expect(6);
+ var response =
+ serializer.normalizeSingleResponse({}, modelClass, payload, id, null);
+ assert.ok(response.data);
+ assert.equal(response.data.id, id);
+ assert.equal(response.data.type, modelClass.modelName);
+ assert.equal(response.data.attributes.logs, payload);
+ assert.equal(response.data.attributes.containerID,
+ "container_e32_1456000363780_0002_01_000001");
+ assert.equal(response.data.attributes.logFileName, "syslog");
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-app-test.js
new file mode 100644
index 0000000..21a715c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-app-test.js
@@ -0,0 +1,102 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('serializer:yarn-node-app', 'Unit | Serializer | NodeApp', {
+});
+
+test('Basic creation test', function(assert) {
+ let serializer = this.subject();
+
+ assert.ok(serializer);
+ assert.ok(serializer.normalizeSingleResponse);
+ assert.ok(serializer.normalizeArrayResponse);
+ assert.ok(serializer.internalNormalizeSingleResponse);
+});
+
+test('normalizeArrayResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-node-app"
+ },
+ payload = {
+ apps: {
+ app: [{
+ id:"application_1456251210105_0001", state:"FINISHED", user:"root"
+ },{
+ id:"application_1456251210105_0002", state:"RUNNING",user:"root",
+ containerids:["container_e38_1456251210105_0002_01_000001",
+ "container_e38_1456251210105_0002_01_000002"]
+ }]
+ }
+ };
+ assert.expect(15);
+ var response =
+ serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ assert.ok(response.data);
+ assert.equal(response.data.length, 2);
+ assert.equal(response.data[0].attributes.containers, undefined);
+ assert.equal(response.data[1].attributes.containers.length, 2);
+ assert.deepEqual(response.data[1].attributes.containers,
+ payload.apps.app[1].containerids);
+ for (var i = 0; i < 2; i++) {
+ assert.equal(response.data[i].type, modelClass.modelName);
+ assert.equal(response.data[i].id, payload.apps.app[i].id);
+ assert.equal(response.data[i].attributes.appId, payload.apps.app[i].id);
+ assert.equal(response.data[i].attributes.state, payload.apps.app[i].state);
+ assert.equal(response.data[i].attributes.user, payload.apps.app[i].user);
+ }
+});
+
+test('normalizeArrayResponse no apps test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-node-app"
+ },
+ payload = { apps: null };
+ assert.expect(5);
+ var response =
+ serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ assert.ok(response.data);
+ assert.equal(response.data.length, 1);
+ assert.equal(response.data[0].type, modelClass.modelName);
+ assert.equal(response.data[0].id, "dummy");
+ assert.equal(response.data[0].attributes.appId, undefined);
+});
+
+test('normalizeSingleResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-node-app"
+ },
+ payload = {
+ app: {id:"application_1456251210105_0001", state:"FINISHED", user:"root"}
+ };
+ assert.expect(7);
+ var response =
+ serializer.normalizeSingleResponse({}, modelClass, payload, null, null);
+ assert.ok(response.data);
+ assert.equal(payload.app.id, response.data.id);
+ assert.equal(modelClass.modelName, response.data.type);
+ assert.equal(payload.app.id, response.data.attributes.appId);
+ assert.equal(payload.app.state, response.data.attributes.state);
+ assert.equal(payload.app.user, response.data.attributes.user);
+ assert.equal(response.data.attributes.containers, undefined);
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-container-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-container-test.js
new file mode 100644
index 0000000..1f08467
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-container-test.js
@@ -0,0 +1,128 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('serializer:yarn-node-container', 'Unit | Serializer | NodeContainer', {
+});
+
+test('Basic creation test', function(assert) {
+ let serializer = this.subject();
+
+ assert.ok(serializer);
+ assert.ok(serializer.normalizeSingleResponse);
+ assert.ok(serializer.normalizeArrayResponse);
+ assert.ok(serializer.internalNormalizeSingleResponse);
+});
+
+test('normalizeArrayResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-node-container"
+ },
+ payload = {
+ containers: {
+ container: [{
+ id: "container_e32_1456000363780_0002_01_000001", state: "RUNNING",
+ exitCode:-1000,diagnostics:"",user:"root",totalMemoryNeededMB:2048,
+ totalVCoresNeeded:1,containerLogsLink: "http://localhost:8042/node/" +
+ "containerlogs/container_e32_1456000363780_0002_01_000001/root",
+ nodeId: "localhost:64318", containerLogFiles:["syslog","stderr",
+ "stdout"]
+ },{
+ id:"container_e32_1456000363780_0002_01_000003", state:"RUNNING",
+ exitCode:-1000, diagnostics:"", user:"root", totalMemoryNeededMB:1024,
+ totalVCoresNeeded:1,containerLogsLink:"http://localhost:8042/node" +
+ "/containerlogs/container_e32_1456000363780_0002_01_000003/root",
+ nodeId:"localhost:64318",containerLogFiles:["syslog","stderr",
+ "syslog.shuffle","stdout"]
+ }]
+ }
+ };
+ assert.expect(14);
+ var response =
+ serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ assert.ok(response.data);
+ assert.equal(response.data.length, 2);
+ assert.equal(response.data[0].id,
+ "container_e32_1456000363780_0002_01_000001");
+ assert.equal(response.data[1].id,
+ "container_e32_1456000363780_0002_01_000003");
+ assert.equal(response.data[0].attributes.containerLogFiles.length, 3);
+ assert.equal(response.data[1].attributes.containerLogFiles.length, 4);
+ for (var i = 0; i < 2; i++) {
+ assert.equal(response.data[i].type, modelClass.modelName);
+ assert.deepEqual(response.data[i].attributes.containerLogFiles,
+ payload.containers.container[i].containerLogFiles);
+ assert.equal(response.data[i].attributes.state,
+ payload.containers.container[i].state);
+ assert.equal(response.data[i].attributes.user,
+ payload.containers.container[i].user);
+ }
+});
+
+test('normalizeArrayResponse no containers test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-node-container"
+ },
+ payload = { containers: null };
+ assert.expect(5);
+ var response =
+ serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ assert.ok(response.data);
+ assert.equal(response.data.length, 1);
+ assert.equal(response.data[0].type, modelClass.modelName);
+ assert.equal(response.data[0].id, "dummy");
+ assert.equal(response.data[0].attributes.containerId, undefined);
+});
+
+test('normalizeSingleResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-node-container"
+ },
+ payload = {
+ container: {
+ id: "container_e32_1456000363780_0002_01_000001", state: "RUNNING",
+ exitCode:-1000,diagnostics:"",user:"root",totalMemoryNeededMB:2048,
+ totalVCoresNeeded:1,containerLogsLink: "http://localhost:8042/node/" +
+ "containerlogs/container_e32_1456000363780_0002_01_000001/root",
+ nodeId: "localhost:64318", containerLogFiles:["syslog","stderr",
+ "stdout"]
+ }
+ };
+ assert.expect(11);
+ var response =
+ serializer.normalizeSingleResponse({}, modelClass, payload, null, null);
+ assert.ok(response.data);
+ assert.equal(response.data.id, payload.container.id);
+ assert.equal(response.data.type, modelClass.modelName);
+ assert.equal(response.data.attributes.containerId, payload.container.id);
+ assert.equal(response.data.attributes.state, payload.container.state);
+ assert.equal(response.data.attributes.user, payload.container.user);
+ assert.equal(response.data.attributes.exitCode, payload.container.exitCode);
+ assert.equal(response.data.attributes.totalMemoryNeededMB,
+ payload.container.totalMemoryNeeded);
+ assert.equal(response.data.attributes.totalVCoresNeeded,
+ payload.container.totalVCoresNeeded);
+ assert.equal(response.data.attributes.containerLogFiles.length, 3);
+ assert.deepEqual(response.data.attributes.containerLogFiles,
+ payload.container.containerLogFiles);
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-test.js
new file mode 100644
index 0000000..0e76ccb
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-node-test.js
@@ -0,0 +1,69 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+import Converter from 'yarn-ui/utils/converter';
+
+moduleFor('serializer:yarn-node', 'Unit | Serializer | Node', {
+});
+
+test('Basic creation test', function(assert) {
+ let serializer = this.subject();
+
+ assert.ok(serializer);
+ assert.ok(serializer.normalizeSingleResponse);
+ assert.ok(serializer.internalNormalizeSingleResponse);
+});
+
+test('normalizeSingleResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-node"
+ },
+ payload = {
+ nodeInfo: {
+ healthReport: "Healthy", totalVmemAllocatedContainersMB: 344064,
+ totalPmemAllocatedContainersMB: 163840,
+ totalVCoresAllocatedContainers: 160,
+ vmemCheckEnabled: true, pmemCheckEnabled: true,
+ lastNodeUpdateTime: 1456250210310, nodeHealthy: true,
+ nodeManagerVersion: "3.0.0-SNAPSHOT",
+ nodeManagerBuildVersion: "3.0.0-SNAPSHOT",
+ nodeManagerVersionBuiltOn: "2000-01-01T00:00Z",
+ hadoopVersion: "3.0.0-SNAPSHOT",
+ hadoopBuildVersion: "3.0.0-SNAPSHOT",
+ hadoopVersionBuiltOn: "2000-01-01T00:00Z",
+ id: "localhost:64318", nodeHostName: "192.168.0.102",
+ nmStartupTime: 1456250208231
+ }
+ };
+ assert.expect(6);
+ var id = "localhost:64318";
+ var response = serializer.normalizeSingleResponse({}, modelClass, payload, id, null);
+ assert.equal(response.data.id, id);
+ assert.equal(response.data.type, modelClass.modelName);
+ assert.equal(response.data.attributes.totalVmemAllocatedContainersMB,
+ payload.nodeInfo.totalVmemAllocatedContainersMB);
+ assert.equal(response.data.attributes.totalPmemAllocatedContainersMB,
+ payload.nodeInfo.totalPmemAllocatedContainersMB);
+ assert.equal(response.data.attributes.totalVCoresAllocatedContainers,
+ payload.nodeInfo.totalVCoresAllocatedContainers);
+ assert.equal(response.data.attributes.nmStartupTime,
+ Converter.timeStampToDate(payload.nodeInfo.nmStartupTime));
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-rm-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-rm-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-rm-node-test.js
new file mode 100644
index 0000000..bc6397d
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/serializers/yarn-rm-node-test.js
@@ -0,0 +1,153 @@
+/**
+ * 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.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('serializer:yarn-rm-node', 'Unit | Serializer | RMNode', {
+});
+
+test('Basic creation test', function(assert) {
+ let serializer = this.subject();
+
+ assert.ok(serializer);
+ assert.ok(serializer.normalizeSingleResponse);
+ assert.ok(serializer.normalizeArrayResponse);
+ assert.ok(serializer.internalNormalizeSingleResponse);
+});
+
+test('normalizeArrayResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-rm-node"
+ },
+ payload = {
+ nodes: {
+ node: [{
+ rack: "/default-rack", state: "RUNNING", id: "192.168.1.1:64318",
+ nodeHostName: "192.168.1.1", nodeHTTPAddress: "192.168.1.1:8042",
+ lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
+ healthReport: "", numContainers: 0, usedMemoryMB: 2048,
+ availMemoryMB: 161792, usedVirtualCores: 2,
+ availableVirtualCores: 158, nodeLabels: ["x"],
+ resourceUtilization: {
+ nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
+ nodeCPUUsage: 0.14995001256465912,
+ aggregatedContainersPhysicalMemoryMB: 0,
+ aggregatedContainersVirtualMemoryMB: 0,
+ containersCPUUsage: 0
+ }
+ },{
+ rack: "/default-rack", state: "RUNNING", id: "192.168.1.2:64318",
+ nodeHostName: "192.168.1.2", nodeHTTPAddress: "192.168.1.2:8042",
+ lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
+ healthReport: "", numContainers: 0, usedMemoryMB: 0,
+ availMemoryMB: 163840, usedVirtualCores: 0,
+ availableVirtualCores: 160, nodeLabels: ["y"],
+ resourceUtilization: {
+ nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
+ nodeCPUUsage: 0.14995001256465912,
+ aggregatedContainersPhysicalMemoryMB: 0,
+ aggregatedContainersVirtualMemoryMB: 0,
+ containersCPUUsage: 0
+ }
+ }]
+ }
+ };
+ assert.expect(12);
+ var response =
+ serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ assert.ok(response.data);
+ assert.equal(response.data.length, 2);
+ assert.equal(response.data[0].id, "192.168.1.1:64318");
+ assert.equal(response.data[1].id, "192.168.1.2:64318");
+ for (var i = 0; i < 2; i++) {
+ assert.equal(response.data[i].type, modelClass.modelName);
+ assert.equal(response.data[i].attributes.nodeHostName,
+ payload.nodes.node[i].nodeHostName);
+ assert.equal(response.data[i].attributes.nodeHTTPAddress,
+ payload.nodes.node[i].nodeHTTPAddress);
+ assert.deepEqual(response.data[i].attributes.nodeLabels,
+ payload.nodes.node[i].nodeLabels);
+ }
+});
+
+test('normalizeArrayResponse no nodes test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-rm-node"
+ },
+ payload = { nodes: null };
+ assert.expect(5);
+ var response =
+ serializer.normalizeArrayResponse({}, modelClass, payload, null, null);
+ console.log(response);
+ assert.ok(response.data);
+ assert.equal(response.data.length, 1);
+ assert.equal(response.data[0].type, modelClass.modelName);
+ assert.equal(response.data[0].id, "dummy");
+ assert.equal(response.data[0].attributes.nodeHostName, undefined);
+});
+
+test('normalizeSingleResponse test', function(assert) {
+ let serializer = this.subject(),
+ modelClass = {
+ modelName: "yarn-rm-node"
+ },
+ payload = {
+ node: {
+ rack: "/default-rack", state: "RUNNING", id: "192.168.1.1:64318",
+ nodeHostName: "192.168.1.1", nodeHTTPAddress: "192.168.1.1:8042",
+ lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT",
+ healthReport: "", numContainers: 0, usedMemoryMB: 2048,
+ availMemoryMB: 161792, usedVirtualCores: 2,
+ availableVirtualCores: 158, nodeLabels: ["x"],
+ resourceUtilization: {
+ nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549,
+ nodeCPUUsage: 0.14995001256465912,
+ aggregatedContainersPhysicalMemoryMB: 0,
+ aggregatedContainersVirtualMemoryMB: 0,
+ containersCPUUsage: 0
+ }
+ }
+ };
+ assert.expect(13);
+ var id = "localhost:64318";
+ var response =
+ serializer.normalizeSingleResponse({}, modelClass, payload, id, null);
+ assert.ok(response.data);
+ assert.equal(response.data.id, id);
+ assert.equal(response.data.type, modelClass.modelName);
+ assert.equal(response.data.attributes.rack, payload.node.rack);
+ assert.equal(response.data.attributes.state, payload.node.state);
+ assert.equal(response.data.attributes.nodeHostName,
+ payload.node.nodeHostName);
+ assert.equal(response.data.attributes.nodeHTTPAddress,
+ payload.node.nodeHTTPAddress);
+ assert.equal(response.data.attributes.version, payload.node.version);
+ assert.equal(response.data.attributes.availMemoryMB,
+ payload.node.availMemoryMB);
+ assert.equal(response.data.attributes.usedMemoryMB,
+ payload.node.usedMemoryMB);
+ assert.equal(response.data.attributes.availableVirtualCores,
+ payload.node.availableVirtualCores);
+ assert.equal(response.data.attributes.usedVirtualCores,
+ payload.node.usedVirtualCores);
+ assert.deepEqual(response.data.attributes.nodeLabels,
+ payload.node.nodeLabels);
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/utils/converter-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/utils/converter-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/utils/converter-test.js
new file mode 100644
index 0000000..481537d
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/utils/converter-test.js
@@ -0,0 +1,52 @@
+/**
+ * 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.
+ */
+
+import converter from '../../../utils/converter';
+import { module, test } from 'qunit';
+
+module('Unit | Utility | Converter');
+
+// Replace this with your real tests.
+test('it works', function(assert) {
+ assert.ok(converter);
+ assert.ok(converter.splitForContainerLogs);
+});
+
+test('split for container logs', function(assert) {
+ var id = "localhost:64318!container_e32_1456000363780_0002_01_000001!" +
+ "syslog";
+ var arr = converter.splitForContainerLogs(id);
+ assert.ok(arr);
+ assert.deepEqual(arr, ["localhost:64318",
+ "container_e32_1456000363780_0002_01_000001", "syslog"]);
+ id = "localhost:64318!container_e32_1456000363780_0002_01_000001!" +
+ "syslog!logs";
+ arr = converter.splitForContainerLogs(id);
+ assert.ok(arr);
+ assert.deepEqual(arr, ["localhost:64318",
+ "container_e32_1456000363780_0002_01_000001", "syslog!logs"]);
+ id = "localhost:64318!container_e32_1456000363780_0002_01_000001";
+ arr = converter.splitForContainerLogs(id);
+ assert.notOk(arr);
+ id = null;
+ arr = converter.splitForContainerLogs(id);
+ assert.notOk(arr);
+ id = undefined;
+ arr = converter.splitForContainerLogs(id);
+ assert.notOk(arr);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/utils/sorter-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/utils/sorter-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/utils/sorter-test.js
new file mode 100644
index 0000000..8f17380
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/utils/sorter-test.js
@@ -0,0 +1,26 @@
+/**
+ * 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.
+ */
+
+import Sorter from 'yarn-ui/utils/sorter';
+import { module, test } from 'qunit';
+
+module('Unit | Utility | Sorter');
+
+test('Basic creation test', function(assert) {
+ assert.ok(Sorter);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/testem.json
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/testem.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/testem.json
deleted file mode 100644
index 0f35392..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/testem.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "framework": "qunit",
- "test_page": "tests/index.html?hidepassed",
- "disable_watching": true,
- "launch_in_ci": [
- "PhantomJS"
- ],
- "launch_in_dev": [
- "PhantomJS",
- "Chrome"
- ]
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/.jshintrc
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/.jshintrc b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/.jshintrc
deleted file mode 100644
index 6ec0b7c..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/.jshintrc
+++ /dev/null
@@ -1,52 +0,0 @@
-{
- "predef": [
- "document",
- "window",
- "location",
- "setTimeout",
- "$",
- "-Promise",
- "define",
- "console",
- "visit",
- "exists",
- "fillIn",
- "click",
- "keyEvent",
- "triggerEvent",
- "find",
- "findWithAssert",
- "wait",
- "DS",
- "andThen",
- "currentURL",
- "currentPath",
- "currentRouteName"
- ],
- "node": false,
- "browser": false,
- "boss": true,
- "curly": true,
- "debug": false,
- "devel": false,
- "eqeqeq": true,
- "evil": true,
- "forin": false,
- "immed": false,
- "laxbreak": false,
- "newcap": true,
- "noarg": true,
- "noempty": false,
- "nonew": false,
- "nomen": false,
- "onevar": false,
- "plusplus": false,
- "regexp": false,
- "undef": true,
- "sub": true,
- "strict": false,
- "white": false,
- "eqnull": true,
- "esnext": true,
- "unused": true
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/resolver.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/resolver.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/resolver.js
deleted file mode 100644
index 28f4ece..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/resolver.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import Resolver from 'ember/resolver';
-import config from '../../config/environment';
-
-var resolver = Resolver.create();
-
-resolver.namespace = {
- modulePrefix: config.modulePrefix,
- podModulePrefix: config.podModulePrefix
-};
-
-export default resolver;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/start-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/start-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/start-app.js
deleted file mode 100644
index 0f7aab1..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/helpers/start-app.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import Ember from 'ember';
-import Application from '../../app';
-import config from '../../config/environment';
-
-export default function startApp(attrs) {
- var application;
-
- var attributes = Ember.merge({}, config.APP);
- attributes = Ember.merge(attributes, attrs); // use defaults, but you can override;
-
- Ember.run(function() {
- application = Application.create(attributes);
- application.setupForTesting();
- application.injectTestHelpers();
- });
-
- return application;
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/index.html
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/index.html b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/index.html
deleted file mode 100644
index 33f7045..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/index.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <title>YarnUi Tests</title>
- <meta name="description" content="">
- <meta name="viewport" content="width=device-width, initial-scale=1">
-
- {{content-for 'head'}}
- {{content-for 'test-head'}}
-
- <link rel="stylesheet" href="assets/vendor.css">
- <link rel="stylesheet" href="assets/yarn-ui.css">
- <link rel="stylesheet" href="assets/test-support.css">
-
- {{content-for 'head-footer'}}
- {{content-for 'test-head-footer'}}
- </head>
- <body>
-
- {{content-for 'body'}}
- {{content-for 'test-body'}}
- <script src="assets/vendor.js"></script>
- <script src="assets/test-support.js"></script>
- <script src="assets/yarn-ui.js"></script>
- <script src="testem.js"></script>
- <script src="assets/test-loader.js"></script>
-
- {{content-for 'body-footer'}}
- {{content-for 'test-body-footer'}}
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/test-helper.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/test-helper.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/test-helper.js
deleted file mode 100644
index e6cfb70..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/test-helper.js
+++ /dev/null
@@ -1,6 +0,0 @@
-import resolver from './helpers/resolver';
-import {
- setResolver
-} from 'ember-qunit';
-
-setResolver(resolver);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/.gitkeep
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/.gitkeep b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/.gitkeep
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-app-test.js
deleted file mode 100644
index 5683d5a..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-app-test.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('adapter:yarn-app', 'Unit | Adapter | yarn app', {
- // Specify the other units that are required for this test.
- // needs: ['serializer:foo']
-});
-
-// Replace this with your real tests.
-test('it exists', function(assert) {
- var adapter = this.subject();
- assert.ok(adapter);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-container-log-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-container-log-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-container-log-test.js
deleted file mode 100644
index e6e7b43..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-container-log-test.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleFor, test } from 'ember-qunit';
-import Constants from 'yarn-ui/constants';
-
-moduleFor('adapter:yarn-container-log', 'Unit | Adapter | ContainerLog', {
-});
-
-test('Basic creation', function(assert) {
- let adapter = this.subject();
-
- assert.ok(adapter);
- assert.ok(adapter.urlForFindRecord);
- assert.ok(adapter.ajax);
- assert.ok(adapter.headers);
- assert.ok(adapter.host);
- assert.ok(adapter.namespace);
- assert.equal(adapter.headers.Accept, "text/plain");
- assert.equal(adapter.namespace, "ws/v1/node");
-});
-
-test('urlForFindRecord test', function(assert) {
- let adapter = this.subject();
- let host = adapter.host;
- assert.equal(adapter.urlForFindRecord("localhost:8042" +
- Constants.PARAM_SEPARATOR + "container_e27_11111111111_0001_01_000001" +
- Constants.PARAM_SEPARATOR + "syslog"),
- host + "localhost:8042/ws/v1/node/containerlogs/" +
- "container_e27_11111111111_0001_01_000001/syslog");
-});
-
-test('ajaxOptions test', function(assert) {
- let adapter = this.subject();
- var hash = adapter.ajaxOptions('/containerlogs', 'type', {});
- assert.equal(hash.dataType, 'text');
-});
-
-test('findRecord test', function(assert) {
- let adapter = this.subject(),
- testModel = { modelName: "testModel" },
- testStore = {},
- testSnapshot = {};
- let host = adapter.host;
- let testId = "localhost:8042" + Constants.PARAM_SEPARATOR +
- "container_e27_11111111111_0001_01_000001" + Constants.PARAM_SEPARATOR +
- "syslog";
- assert.expect(2);
-
- adapter.ajax = function (url, method) {
- assert.equal(url, host + "localhost:8042/ws/v1/node/containerlogs/" +
- "container_e27_11111111111_0001_01_000001/syslog");
- assert.equal(method, 'GET');
- };
-
- adapter.findRecord(testStore, testModel, testId, testSnapshot);
-});
-
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-app-test.js
deleted file mode 100644
index 3a25996..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-app-test.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('adapter:yarn-node-app', 'Unit | Adapter | NodeApp', {
-});
-
-test('Basic creation', function(assert) {
- let adapter = this.subject();
- assert.expect(11);
- assert.ok(adapter);
- assert.ok(adapter.urlForQueryRecord);
- assert.ok(adapter.queryRecord);
- assert.ok(adapter.urlForQuery);
- assert.ok(adapter.query);
- assert.ok(adapter.ajax);
- assert.ok(adapter.headers);
- assert.ok(adapter.host);
- assert.ok(adapter.namespace);
- assert.equal("application/json", adapter.headers.Accept);
- assert.equal("ws/v1/node", adapter.namespace);
-});
-
-test('urlForQueryRecord test', function(assert) {
- let adapter = this.subject();
- let host = adapter.host;
- assert.equal(
- host + "localhost:8042/ws/v1/node/apps/application_1111111111_1111",
- adapter.urlForQueryRecord(
- {nodeAddr: "localhost:8042", appId: "application_1111111111_1111"}));
-});
-
-test('urlForQuery test', function(assert) {
- let adapter = this.subject();
- let host = adapter.host;
- assert.equal(host + "localhost:8042/ws/v1/node/apps",
- adapter.urlForQuery({nodeAddr: "localhost:8042"}));
-});
-
-test('query test', function(assert) {
- let adapter = this.subject(),
- testModel = { modelName: "testModel" },
- testStore = {},
- testQuery = {nodeAddr: "localhost:8042"};
- let host = adapter.host;
- assert.expect(3);
-
- adapter.ajax = function (url, method, hash) {
- assert.equal(host + "localhost:8042/ws/v1/node/apps", url);
- assert.equal('GET', method);
- assert.equal(null, hash.data);
- };
-
- adapter.query(testStore, testModel, testQuery);
-});
-
-test('queryRecord test', function(assert) {
- let adapter = this.subject(),
- testModel = { modelName: "testModel" },
- testStore = {},
- testQuery = {
- nodeAddr: "localhost:8042",
- appId: "application_1111111111_1111"
- };
- let host = adapter.host;
- assert.expect(3);
-
- adapter.ajax = function (url, method, hash) {
- assert.equal(
- host + "localhost:8042/ws/v1/node/apps/application_1111111111_1111",
- url);
- assert.equal('GET', method);
- assert.equal(null, hash.data);
- };
-
- adapter.queryRecord(testStore, testModel, testQuery);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-container-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-container-test.js
deleted file mode 100644
index 7d2bb2d..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-container-test.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('adapter:yarn-node-container', 'Unit | Adapter | NodeContainer', {
-});
-
-test('Basic creation', function(assert) {
- let adapter = this.subject();
- assert.expect(11);
- assert.ok(adapter);
- assert.ok(adapter.urlForQueryRecord);
- assert.ok(adapter.queryRecord);
- assert.ok(adapter.urlForQuery);
- assert.ok(adapter.query);
- assert.ok(adapter.ajax);
- assert.ok(adapter.headers);
- assert.ok(adapter.host);
- assert.ok(adapter.namespace);
- assert.equal("application/json", adapter.headers.Accept);
- assert.equal("ws/v1/node", adapter.namespace);
-});
-
-test('urlForQueryRecord test', function(assert) {
- let adapter = this.subject();
- let host = adapter.host;
- assert.equal(host + "localhost:8042/ws/v1/node/containers/" +
- "container_e27_11111111111_0001_01_000001",
- adapter.urlForQueryRecord(
- {nodeHttpAddr: "localhost:8042",
- containerId: "container_e27_11111111111_0001_01_000001"}));
-});
-
-test('urlForQuery test', function(assert) {
- let adapter = this.subject();
- let host = adapter.host;
- assert.equal(host + "localhost:8042/ws/v1/node/containers",
- adapter.urlForQuery({nodeHttpAddr: "localhost:8042"}));
-});
-
-test('query test', function(assert) {
- let adapter = this.subject(),
- testModel = { modelName: "testModel" },
- testStore = {},
- testQuery = {nodeHttpAddr: "localhost:8042"};
- let host = adapter.host;
- assert.expect(3);
-
- adapter.ajax = function (url, method, hash) {
- assert.equal(host + "localhost:8042/ws/v1/node/containers", url);
- assert.equal('GET', method);
- assert.equal(null, hash.data);
- };
-
- adapter.query(testStore, testModel, testQuery);
-});
-
-test('queryRecord test', function(assert) {
- let adapter = this.subject(),
- testModel = { modelName: "testModel" },
- testStore = {},
- testQuery = {
- nodeHttpAddr: "localhost:8042",
- containerId: "container_e27_11111111111_0001_01_000001"
- };
- let host = adapter.host;
- assert.expect(3);
-
- adapter.ajax = function (url, method, hash) {
- assert.equal(host + "localhost:8042/ws/v1/node/containers/" +
- "container_e27_11111111111_0001_01_000001", url);
- assert.equal('GET', method);
- assert.equal(null, hash.data);
- };
-
- adapter.queryRecord(testStore, testModel, testQuery);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-test.js
deleted file mode 100644
index 15aefef..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-node-test.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('adapter:yarn-node', 'Unit | Adapter | Node', {
-});
-
-test('Basic creation', function(assert) {
- let adapter = this.subject();
-
- assert.ok(adapter);
- assert.ok(adapter.urlForFindRecord);
- assert.ok(adapter.ajax);
- assert.ok(adapter.headers);
- assert.ok(adapter.host);
- assert.ok(adapter.namespace);
- assert.equal(adapter.headers.Accept, "application/json");
- assert.equal(adapter.namespace, "ws/v1/node");
-});
-
-test('urlForFindRecord test', function(assert) {
- let adapter = this.subject();
- let host = adapter.host;
- assert.equal(adapter.urlForFindRecord("localhost:8042"),
- host + "localhost:8042/ws/v1/node");
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-rm-node-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-rm-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-rm-node-test.js
deleted file mode 100644
index bf009d4..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/adapters/yarn-rm-node-test.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('adapter:yarn-rm-node', 'Unit | Adapter | RMNode', {
- // Specify the other units that are required for this test.
- // needs: ['serializer:foo']
-});
-
-test('Basic creation', function(assert) {
- let adapter = this.subject();
-
- assert.ok(adapter);
- assert.ok(adapter.urlForFindRecord);
- assert.ok(adapter.ajax);
- assert.ok(adapter.headers);
- assert.ok(adapter.host);
- assert.ok(adapter.namespace);
- assert.equal(adapter.headers.Accept, "application/json");
- assert.equal(adapter.namespace, "ws/v1/cluster");
-});
-
-test('urlForFindRecord test', function(assert) {
- let adapter = this.subject();
- let host = adapter.host;
- assert.equal(adapter.urlForFindRecord("localhost:8042"),
- host + "/ws/v1/cluster/nodes/localhost:8042");
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-apps-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-apps-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-apps-test.js
deleted file mode 100644
index d25f72d..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-apps-test.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('controller:yarn-apps', {
- // Specify the other units that are required for this test.
- // needs: ['controller:foo']
-});
-
-// Replace this with your real tests.
-test('it exists', function(assert) {
- var controller = this.subject();
- assert.ok(controller);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-queues-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-queues-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-queues-test.js
deleted file mode 100644
index 313dfdd..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/controllers/yarn-queues-test.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('controller:yarn-queues', {
- // Specify the other units that are required for this test.
- // needs: ['controller:foo']
-});
-
-// Replace this with your real tests.
-test('it exists', function(assert) {
- var controller = this.subject();
- assert.ok(controller);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/mixins/charts-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/mixins/charts-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/mixins/charts-test.js
deleted file mode 100644
index b4f3503..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/mixins/charts-test.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import Ember from 'ember';
-import ChartsMixin from '../../../mixins/charts';
-import { module, test } from 'qunit';
-
-module('Unit | Mixin | charts');
-
-// Replace this with your real tests.
-test('it works', function(assert) {
- var ChartsObject = Ember.Object.extend(ChartsMixin);
- var subject = ChartsObject.create();
- assert.ok(subject);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-app-test.js
deleted file mode 100644
index e3261e2..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-app-test.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import { moduleForModel, test } from 'ember-qunit';
-
-moduleForModel('yarn-app', 'Unit | Model | yarn app', {
- // Specify the other units that are required for this test.
- needs: []
-});
-
-test('it exists', function(assert) {
- var model = this.subject();
- // var store = this.store();
- assert.ok(!!model);
-});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-container-log-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-container-log-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-container-log-test.js
deleted file mode 100644
index 45808a5..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-container-log-test.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleForModel, test } from 'ember-qunit';
-
-moduleForModel('yarn-container-log', 'Unit | Model | ContainerLog', {
- // Specify the other units that are required for this test.
- needs: []
-});
-
-test('Basic creation test', function(assert) {
- let model = this.subject();
- assert.ok(model);
- assert.ok(model._notifyProperties);
- assert.ok(model.didLoad);
- assert.ok(model.logs);
- assert.ok(model.containerID);
- assert.ok(model.logFileName);
-});
-
-test('test fields', function(assert) {
- let model = this.subject();
-
- Ember.run(function () {
- model.set("logs", "This is syslog");
- model.set("containerID", "container_e32_1456000363780_0002_01_000001");
- model.set("logFileName", "syslog");
- assert.equal(model.get("logs"), "This is syslog");
- assert.equal(model.get("containerID"), "container_e32_1456000363780_0002_01_000001");
- assert.equal(model.get("logFileName"), "syslog");
- });
-});
-
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-app-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-app-test.js
deleted file mode 100644
index 7e2e62f..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-app-test.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleForModel, test } from 'ember-qunit';
-
-moduleForModel('yarn-node-app', 'Unit | Model | NodeApp', {
- // Specify the other units that are required for this test.
- needs: []
-});
-
-test('Basic creation test', function(assert) {
- let model = this.subject();
-
- assert.ok(model);
- assert.ok(model._notifyProperties);
- assert.ok(model.didLoad);
- assert.ok(model.appId);
- assert.ok(model.state);
- assert.ok(model.user);
- assert.ok(model.containers);
-});
-
-test('test fields', function(assert) {
- let model = this.subject();
-
- assert.expect(9);
- Ember.run(function () {
- model.set("appId", "application_1456251210105_0002");
- model.set("id", "application_1456251210105_0002");
- model.set("state", "RUNNING");
- model.set("user", "hadoop");
- model.set("containers", ["container_e38_1456251210105_0002_01_000001",
- "container_e38_1456251210105_0002_01_000002"]);
- assert.equal(model.get("appId"), "application_1456251210105_0002");
- assert.equal(model.get("state"), "RUNNING");
- assert.equal(model.get("user"), "hadoop");
- assert.deepEqual(model.get("containers"),
- ["container_e38_1456251210105_0002_01_000001",
- "container_e38_1456251210105_0002_01_000002"]);
- assert.equal(model.get("appStateStyle"), "label label-primary");
- assert.equal(model.get("isDummyApp"), false);
- model.set("id", "dummy");
- assert.equal(model.get("isDummyApp"), true);
- model.set("state", "FINISHED");
- assert.equal(model.get("appStateStyle"), "label label-success");
- model.set("state", "NEW");
- assert.equal(model.get("appStateStyle"), "label label-default");
- });
-});
-
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-container-test.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-container-test.js
deleted file mode 100644
index 88bf233..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/models/yarn-node-container-test.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * 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.
- */
-
-import { moduleForModel, test } from 'ember-qunit';
-
-moduleForModel('yarn-node-container', 'Unit | Model | NodeContainer', {
- // Specify the other units that are required for this test.
- needs: []
-});
-
-test('Basic creation test', function(assert) {
- let model = this.subject();
-
- assert.ok(model);
- assert.ok(model._notifyProperties);
- assert.ok(model.didLoad);
- assert.ok(model.containerId);
- assert.ok(model.state);
- assert.ok(model.user);
- assert.ok(model.exitCode);
- assert.ok(model.totalMemoryNeeded);
- assert.ok(model.totalVCoresNeeded);
- assert.ok(model.containerLogFiles);
- assert.ok(model.isDummyContainer);
- assert.ok(model.containerStateStyle);
-});
-
-test('test fields', function(assert) {
- let model = this.subject();
-
- Ember.run(function () {
- model.set("containerId", "container_e32_1456000363780_0002_01_000003");
- model.set("state", "RUNNING");
- model.set("exitCode", "-1000");
- model.set("user", "hadoop");
- model.set("id", "container_e32_1456000363780_0002_01_000003");
- model.set("totalMemoryNeeded", 1024);
- model.set("totalVCoresNeeded", 1);
- model.set("containerLogFiles", ["syslog", "stderr", "stdout"]);
- assert.equal(model.get("containerId"), "container_e32_1456000363780_0002_01_000003");
- assert.equal(model.get("id"), "container_e32_1456000363780_0002_01_000003");
- assert.equal(model.get("totalMemoryNeeded"), 1024);
- assert.equal(model.get("totalVCoresNeeded"), 1);
- assert.equal(model.get("user"), "hadoop");
- assert.equal(model.get("exitCode"), "-1000");
- assert.equal(model.get("containerLogFiles").length, 3);
- assert.deepEqual(model.get("containerLogFiles"), ["syslog", "stderr", "stdout"]);
- assert.equal(model.get("isDummyContainer"), false);
- assert.equal(model.get("containerStateStyle"), "label label-primary");
- model.set("id", "dummy");
- assert.equal(model.get("isDummyContainer"), true);
- model.set("state", "EXITED_WITH_SUCCESS");
- assert.equal(model.get("containerStateStyle"), "label label-success");
- model.set("state", "EXITED_WITH_FAILURE");
- assert.equal(model.get("containerStateStyle"), "label label-danger");
- model.set("state", "DONE");
- model.set("exitCode", "0");
- assert.equal(model.get("containerStateStyle"), "label label-success");
- model.set("exitCode", "-105");
- assert.equal(model.get("containerStateStyle"), "label label-danger");
- });
-});
-
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[37/50] [abbrv] hadoop git commit: YARN-4849. [YARN-3368] cleanup
code base, integrate web UI related build to mvn, and fix licenses. (wangda)
Posted by wa...@apache.org.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queue.js
new file mode 100644
index 0000000..89858bf
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queue.js
@@ -0,0 +1,38 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ return Ember.RSVP.hash({
+ selected : param.queue_name,
+ queues: this.store.findAll('yarnQueue'),
+ selectedQueue : undefined,
+ apps: undefined, // apps of selected queue
+ });
+ },
+
+ afterModel(model) {
+ model.selectedQueue = this.store.peekRecord('yarnQueue', model.selected);
+ model.apps = this.store.findAll('yarnApp');
+ model.apps.forEach(function(o) {
+ console.log(o);
+ })
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues/index.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues/index.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues/index.js
new file mode 100644
index 0000000..7da6f6d
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues/index.js
@@ -0,0 +1,23 @@
+/**
+ * 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.
+ */
+
+export default Ember.Route.extend({
+ beforeModel() {
+ this.transitionTo('yarnQueues.root');
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues/queues-selector.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues/queues-selector.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues/queues-selector.js
new file mode 100644
index 0000000..3686c83
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-queues/queues-selector.js
@@ -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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model() {
+ return this.store.findAll('yarnQueue');
+ },
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/cluster-info.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/cluster-info.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/cluster-info.js
new file mode 100644
index 0000000..fad321a
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/cluster-info.js
@@ -0,0 +1,47 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.JSONAPISerializer.extend({
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ var fixedPayload = {
+ id: id,
+ type: primaryModelClass.modelName,
+ attributes: payload
+ };
+
+ return this._super(store, primaryModelClass, fixedPayload, id,
+ requestType);
+ },
+
+ normalizeArrayResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // return expected is { data: [ {}, {} ] }
+ var normalizedArrayResponse = {};
+
+ // payload has apps : { app: [ {},{},{} ] }
+ // need some error handling for ex apps or app may not be defined.
+ normalizedArrayResponse.data = [
+ this.normalizeSingleResponse(store, primaryModelClass,
+ payload.clusterInfo, payload.clusterInfo.id, requestType)
+ ];
+ return normalizedArrayResponse;
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/cluster-metric.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/cluster-metric.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/cluster-metric.js
new file mode 100644
index 0000000..73c4bc5
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/cluster-metric.js
@@ -0,0 +1,47 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.JSONAPISerializer.extend({
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ var fixedPayload = {
+ id: id,
+ type: primaryModelClass.modelName,
+ attributes: payload
+ };
+
+ return this._super(store, primaryModelClass, fixedPayload, id,
+ requestType);
+ },
+
+ normalizeArrayResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // return expected is { data: [ {}, {} ] }
+ var normalizedArrayResponse = {};
+
+ // payload has apps : { app: [ {},{},{} ] }
+ // need some error handling for ex apps or app may not be defined.
+ normalizedArrayResponse.data = [
+ this.normalizeSingleResponse(store, primaryModelClass,
+ payload.clusterMetrics, 1, requestType)
+ ];
+ return normalizedArrayResponse;
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app-attempt.js
new file mode 100644
index 0000000..291589c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app-attempt.js
@@ -0,0 +1,67 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Converter from 'yarn-ui/utils/converter';
+
+export default DS.JSONAPISerializer.extend({
+ internalNormalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+
+ if (payload.appAttempt) {
+ payload = payload.appAttempt;
+ }
+
+ var fixedPayload = {
+ id: payload.appAttemptId,
+ type: primaryModelClass.modelName, // yarn-app
+ attributes: {
+ startTime: Converter.timeStampToDate(payload.startTime),
+ finishedTime: Converter.timeStampToDate(payload.finishedTime),
+ containerId: payload.containerId,
+ nodeHttpAddress: payload.nodeHttpAddress,
+ nodeId: payload.nodeId,
+ state: payload.nodeId,
+ logsLink: payload.logsLink
+ }
+ };
+
+ return fixedPayload;
+ },
+
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ var p = this.internalNormalizeSingleResponse(store,
+ primaryModelClass, payload, id, requestType);
+ return { data: p };
+ },
+
+ normalizeArrayResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // return expected is { data: [ {}, {} ] }
+ var normalizedArrayResponse = {};
+
+ // payload has apps : { app: [ {},{},{} ] }
+ // need some error handling for ex apps or app may not be defined.
+ normalizedArrayResponse.data = payload.appAttempts.appAttempt.map(singleApp => {
+ return this.internalNormalizeSingleResponse(store, primaryModelClass,
+ singleApp, singleApp.id, requestType);
+ }, this);
+ return normalizedArrayResponse;
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js
new file mode 100644
index 0000000..234ad24
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js
@@ -0,0 +1,84 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Converter from 'yarn-ui/utils/converter';
+
+export default DS.JSONAPISerializer.extend({
+ internalNormalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ if (payload.app) {
+ payload = payload.app;
+ }
+
+ var fixedPayload = {
+ id: id,
+ type: primaryModelClass.modelName, // yarn-app
+ attributes: {
+ appName: payload.name,
+ user: payload.user,
+ queue: payload.queue,
+ state: payload.state,
+ startTime: Converter.timeStampToDate(payload.startedTime),
+ elapsedTime: Converter.msToElapsedTime(payload.elapsedTime),
+ finishedTime: Converter.timeStampToDate(payload.finishedTime),
+ finalStatus: payload.finalStatus,
+ progress: payload.progress,
+ diagnostics: payload.diagnostics,
+ amContainerLogs: payload.amContainerLogs,
+ amHostHttpAddress: payload.amHostHttpAddress,
+ logAggregationStatus: payload.logAggregationStatus,
+ unmanagedApplication: payload.unmanagedApplication,
+ amNodeLabelExpression: payload.amNodeLabelExpression,
+ priority: payload.priority,
+ allocatedMB: payload.allocatedMB,
+ allocatedVCores: payload.allocatedVCores,
+ runningContainers: payload.runningContainers,
+ memorySeconds: payload.memorySeconds,
+ vcoreSeconds: payload.vcoreSeconds,
+ preemptedResourceMB: payload.preemptedResourceMB,
+ preemptedResourceVCores: payload.preemptedResourceVCores,
+ numNonAMContainerPreempted: payload.numNonAMContainerPreempted,
+ numAMContainerPreempted: payload.numAMContainerPreempted
+ }
+ };
+
+ return fixedPayload;
+ },
+
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ var p = this.internalNormalizeSingleResponse(store,
+ primaryModelClass, payload, id, requestType);
+ return { data: p };
+ },
+
+ normalizeArrayResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // return expected is { data: [ {}, {} ] }
+ var normalizedArrayResponse = {};
+
+ // payload has apps : { app: [ {},{},{} ] }
+ // need some error handling for ex apps or app may not be defined.
+ normalizedArrayResponse.data = payload.apps.app.map(singleApp => {
+ return this.internalNormalizeSingleResponse(store, primaryModelClass,
+ singleApp, singleApp.id, requestType);
+ }, this);
+ return normalizedArrayResponse;
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-container-log.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-container-log.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-container-log.js
new file mode 100644
index 0000000..9e10615
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-container-log.js
@@ -0,0 +1,39 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Converter from 'yarn-ui/utils/converter';
+
+export default DS.JSONAPISerializer.extend({
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // Convert plain text response into JSON.
+ // ID is of the form nodeAddress!containerId!fileName
+ var splits = Converter.splitForContainerLogs(id);
+ var convertedPayload = {
+ id: id,
+ type: primaryModelClass.modelName,
+ attributes: {
+ logs: payload,
+ containerID: splits[1],
+ logFileName: splits[2]
+ }
+ };
+ return { data: convertedPayload };
+ },
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-container.js
new file mode 100644
index 0000000..6f0386f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-container.js
@@ -0,0 +1,72 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Converter from 'yarn-ui/utils/converter';
+
+export default DS.JSONAPISerializer.extend({
+ internalNormalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+
+ var fixedPayload = {
+ id: payload.containerId,
+ type: primaryModelClass.modelName, // yarn-app
+ attributes: {
+ allocatedMB: payload.allocatedMB,
+ allocatedVCores: payload.allocatedVCores,
+ assignedNodeId: payload.assignedNodeId,
+ priority: payload.priority,
+ startedTime: Converter.timeStampToDate(payload.startedTime),
+ finishedTime: Converter.timeStampToDate(payload.finishedTime),
+ elapsedTime: payload.elapsedTime,
+ logUrl: payload.logUrl,
+ containerExitStatus: payload.containerExitStatus,
+ containerState: payload.containerState,
+ nodeHttpAddress: payload.nodeHttpAddress
+ }
+ };
+
+ return fixedPayload;
+ },
+
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ var p = this.internalNormalizeSingleResponse(store,
+ primaryModelClass, payload, id, requestType);
+ return { data: p };
+ },
+
+ normalizeArrayResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // return expected is { data: [ {}, {} ] }
+ var normalizedArrayResponse = {};
+
+ if (payload && payload.container) {
+ // payload has apps : { app: [ {},{},{} ] }
+ // need some error handling for ex apps or app may not be defined.
+ normalizedArrayResponse.data = payload.container.map(singleContainer => {
+ return this.internalNormalizeSingleResponse(store, primaryModelClass,
+ singleContainer, singleContainer.id, requestType);
+ }, this);
+ return normalizedArrayResponse;
+ }
+
+ normalizedArrayResponse.data = [];
+ return normalizedArrayResponse;
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-app.js
new file mode 100644
index 0000000..8b1f152
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-app.js
@@ -0,0 +1,86 @@
+/**
+ * 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.
+ */
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Ember from 'ember';
+
+export default DS.JSONAPISerializer.extend({
+ internalNormalizeSingleResponse(store, primaryModelClass, payload) {
+ if (payload.app) {
+ payload = payload.app;
+ }
+
+ var fixedPayload = {
+ id: payload.id,
+ type: primaryModelClass.modelName,
+ attributes: {
+ appId: payload.id,
+ state: payload.state,
+ user: payload.user,
+ containers: payload.containerids
+ }
+ };
+ return fixedPayload;
+ },
+
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // payload is of the form {"app":{}}
+ var p = this.internalNormalizeSingleResponse(store,
+ primaryModelClass, payload);
+ return { data: p };
+ },
+
+ normalizeArrayResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // expected return response is of the form { data: [ {}, {} ] }
+ var normalizedArrayResponse = {};
+ // payload is of the form { "apps" : { "app": [ {},{},{} ] } }
+ if (payload.apps) {
+ normalizedArrayResponse.data = payload.apps.app.map(singleApp => {
+ return this.internalNormalizeSingleResponse(store, primaryModelClass,
+ singleApp);
+ }, this);
+ } else {
+ // No container reported inside containers.
+ // Response of the form { "apps": null }
+ normalizedArrayResponse.data = Ember.makeArray({
+ id: "dummy",
+ type: primaryModelClass.modelName,
+ attributes: {}});
+ }
+ return normalizedArrayResponse;
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-container.js
new file mode 100644
index 0000000..528f2fe
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-container.js
@@ -0,0 +1,74 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Ember from 'ember';
+
+export default DS.JSONAPISerializer.extend({
+ internalNormalizeSingleResponse(store, primaryModelClass, payload) {
+ if (payload.container) {
+ payload = payload.container;
+ }
+ var fixedPayload = {
+ id: payload.id,
+ type: primaryModelClass.modelName,
+ attributes: {
+ containerId: payload.id,
+ state: payload.state,
+ user: payload.user,
+ diagnostics: payload.diagnostics,
+ exitCode: payload.exitCode,
+ totalMemoryNeeded: payload.totalMemoryNeededMB,
+ totalVCoresNeeded: payload.totalVCoresNeeded,
+ containerLogFiles: payload.containerLogFiles
+ }
+ };
+
+ return fixedPayload;
+ },
+
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // payload is of the form {"container":{}}
+ var p = this.internalNormalizeSingleResponse(store,
+ primaryModelClass, payload);
+ return { data: p };
+ },
+
+ normalizeArrayResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // expected return response is of the form { data: [ {}, {} ] }
+ var normalizedArrayResponse = {};
+ if (payload.containers) {
+ // payload is of the form { "containers" : { "container": [ {},{},{} ] } }
+ normalizedArrayResponse.data =
+ payload.containers.container.map(singleContainer => {
+ return this.internalNormalizeSingleResponse(store, primaryModelClass,
+ singleContainer);
+ }, this);
+ } else {
+ // No container reported inside containers.
+ // Response of the form { "containers": null }
+ normalizedArrayResponse.data = Ember.makeArray({
+ id: "dummy",
+ type: primaryModelClass.modelName,
+ attributes: {}});
+ }
+ return normalizedArrayResponse;
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node.js
new file mode 100644
index 0000000..19308e2
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node.js
@@ -0,0 +1,56 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+import Converter from 'yarn-ui/utils/converter';
+
+export default DS.JSONAPISerializer.extend({
+ internalNormalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ if (payload.nodeInfo) {
+ payload = payload.nodeInfo;
+ }
+
+ var fixedPayload = {
+ id: id,
+ type: primaryModelClass.modelName,
+ attributes: {
+ totalVmemAllocatedContainersMB: payload.totalVmemAllocatedContainersMB,
+ totalPmemAllocatedContainersMB: payload.totalPmemAllocatedContainersMB,
+ totalVCoresAllocatedContainers: payload.totalVCoresAllocatedContainers,
+ vmemCheckEnabled: payload.vmemCheckEnabled,
+ pmemCheckEnabled: payload.pmemCheckEnabled,
+ nodeHealthy: payload.nodeHealthy,
+ lastNodeUpdateTime: Converter.timeStampToDate(payload.lastNodeUpdateTime),
+ healthReport: payload.healthReport,
+ nmStartupTime: Converter.timeStampToDate(payload.nmStartupTime),
+ nodeManagerBuildVersion: payload.nodeManagerBuildVersion,
+ hadoopBuildVersion: payload.hadoopBuildVersion
+ }
+ };
+ return fixedPayload;
+ },
+
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // payload is of the form {"nodeInfo":{}}
+ var p = this.internalNormalizeSingleResponse(store,
+ primaryModelClass, payload, id, requestType);
+ return { data: p };
+ },
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-queue.js
new file mode 100644
index 0000000..1c5b7b3
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-queue.js
@@ -0,0 +1,145 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.JSONAPISerializer.extend({
+
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ var children = [];
+ if (payload.queues) {
+ payload.queues.queue.forEach(function(queue) {
+ children.push(queue.queueName);
+ });
+ }
+
+ var includedData = [];
+ var relationshipUserData = [];
+
+ // update user models
+ if (payload.users && payload.users.user) {
+ payload.users.user.forEach(function(u) {
+ includedData.push({
+ type: "YarnUser",
+ id: u.username + "_" + payload.queueName,
+ attributes: {
+ name: u.username,
+ queueName: payload.queueName,
+ usedMemoryMB: u.resourcesUsed.memory || 0,
+ usedVCore: u.resourcesUsed.vCores || 0,
+ }
+ });
+
+ relationshipUserData.push({
+ type: "YarnUser",
+ id: u.username + "_" + payload.queueName,
+ })
+ });
+ }
+
+
+ var fixedPayload = {
+ id: id,
+ type: primaryModelClass.modelName, // yarn-queue
+ attributes: {
+ name: payload.queueName,
+ parent: payload.myParent,
+ children: children,
+ capacity: payload.capacity,
+ usedCapacity: payload.usedCapacity,
+ maxCapacity: payload.maxCapacity,
+ absCapacity: payload.absoluteCapacity,
+ absMaxCapacity: payload.absoluteMaxCapacity,
+ absUsedCapacity: payload.absoluteUsedCapacity,
+ state: payload.state,
+ userLimit: payload.userLimit,
+ userLimitFactor: payload.userLimitFactor,
+ preemptionDisabled: payload.preemptionDisabled,
+ numPendingApplications: payload.numPendingApplications,
+ numActiveApplications: payload.numActiveApplications,
+ },
+ // Relationships
+ relationships: {
+ users: {
+ data: relationshipUserData
+ }
+ }
+ };
+
+ return {
+ queue: this._super(store, primaryModelClass, fixedPayload, id, requestType),
+ includedData: includedData
+ }
+ },
+
+ handleQueue(store, primaryModelClass, payload, id, requestType) {
+ var data = [];
+ var includedData = []
+ var result = this.normalizeSingleResponse(store, primaryModelClass,
+ payload, id, requestType);
+
+ data.push(result.queue);
+ includedData = includedData.concat(result.includedData);
+
+ if (payload.queues) {
+ for (var i = 0; i < payload.queues.queue.length; i++) {
+ var queue = payload.queues.queue[i];
+ queue.myParent = payload.queueName;
+ var childResult = this.handleQueue(store, primaryModelClass, queue,
+ queue.queueName,
+ requestType);
+
+ data = data.concat(childResult.data);
+ includedData = includedData.concat(childResult.includedData);
+ }
+ }
+
+ return {
+ data: data,
+ includedData, includedData
+ }
+ },
+
+ normalizeArrayResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ var normalizedArrayResponse = {};
+ var result = this.handleQueue(store,
+ primaryModelClass,
+ payload.scheduler.schedulerInfo, "root", requestType);
+
+ normalizedArrayResponse.data = result.data;
+ normalizedArrayResponse.included = result.includedData;
+
+ console.log(normalizedArrayResponse);
+
+ return normalizedArrayResponse;
+
+ /*
+ // return expected is { data: [ {}, {} ] }
+ var normalizedArrayResponse = {};
+
+ // payload has apps : { app: [ {},{},{} ] }
+ // need some error handling for ex apps or app may not be defined.
+ normalizedArrayResponse.data = payload.apps.app.map(singleApp => {
+ return this.normalizeSingleResponse(store, primaryModelClass, singleApp, singleApp.id, requestType);
+ }, this);
+ return normalizedArrayResponse;
+ */
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-rm-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-rm-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-rm-node.js
new file mode 100644
index 0000000..6cb9320
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-rm-node.js
@@ -0,0 +1,77 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import DS from 'ember-data';
+import Converter from 'yarn-ui/utils/converter';
+
+export default DS.JSONAPISerializer.extend({
+ internalNormalizeSingleResponse(store, primaryModelClass, payload, id) {
+ if (payload.node) {
+ payload = payload.node;
+ }
+
+ var fixedPayload = {
+ id: id,
+ type: primaryModelClass.modelName,
+ attributes: {
+ rack: payload.rack,
+ state: payload.state,
+ nodeHostName: payload.nodeHostName,
+ nodeHTTPAddress: payload.nodeHTTPAddress,
+ lastHealthUpdate: Converter.timeStampToDate(payload.lastHealthUpdate),
+ healthReport: payload.healthReport,
+ numContainers: payload.numContainers,
+ usedMemoryMB: payload.usedMemoryMB,
+ availMemoryMB: payload.availMemoryMB,
+ usedVirtualCores: payload.usedVirtualCores,
+ availableVirtualCores: payload.availableVirtualCores,
+ version: payload.version,
+ nodeLabels: payload.nodeLabels
+ }
+ };
+ return fixedPayload;
+ },
+
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // payload is of the form {"nodeInfo":{}}
+ var p = this.internalNormalizeSingleResponse(store,
+ primaryModelClass, payload, id);
+ return { data: p };
+ },
+
+ normalizeArrayResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // expected response is of the form { data: [ {}, {} ] }
+ var normalizedArrayResponse = {};
+ if (payload.nodes) {
+ // payload is of the form { "nodes": { "node": [ {},{},{} ] } }
+ normalizedArrayResponse.data = payload.nodes.node.map(singleNode => {
+ return this.internalNormalizeSingleResponse(store, primaryModelClass,
+ singleNode, singleNode.id);
+ }, this);
+ } else {
+ normalizedArrayResponse.data = Ember.makeArray({
+ id: "dummy",
+ type: primaryModelClass.modelName,
+ attributes: {}});
+ }
+ return normalizedArrayResponse;
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.css
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.css b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.css
new file mode 100644
index 0000000..bcb6aab
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.css
@@ -0,0 +1,159 @@
+/**
+ * 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.
+ */
+
+/*
+ Over all style
+ */
+text {
+ font: 12px sans-serif;
+}
+
+text.small {
+ font: 8px sans-serif;
+}
+
+html, body
+{
+ margin: 0px;
+ padding: 0px;
+ height: 100%;
+ width: 100%;
+}
+
+/*
+ queue's style (left banner of queues)
+ */
+
+text.queue {
+ font-family : sans-serif;
+ font-size : 15px;
+ fill : gray;
+}
+
+path.queue {
+ stroke: gray;
+ fill: none;
+}
+
+circle.queue {
+ r: 10;
+ fill: Steelblue;
+}
+
+/*
+ background style
+ */
+line.grid {
+ stroke: WhiteSmoke;
+}
+
+line.chart {
+ stroke: Gray;
+}
+
+/*
+ charts styles
+ */
+text.chart-title {
+ font-size: 30px;
+ font-family: sans-serif;
+ text-anchor: middle;
+ fill: Gray;
+}
+
+text.donut-highlight-text {
+ font-size: 20px;
+ font-family: sans-serif;
+ text-anchor: middle;
+ fill: Gray;
+ vertical-align: middle;
+}
+
+rect.chart-frame {
+ fill: none;
+ stroke: gray;
+ stroke-dasharray: 10,10;
+}
+
+line.chart-leftbanner {
+ stroke-width: 2;
+ stroke: gray;
+ stroke-dasharray: 10,10;
+}
+
+text.bar-chart-text {
+ font-size: 8px;
+ font-family: sans-serif;
+ vertical-align: middle;
+ fill: Gray;;
+}
+
+div.tooltip {
+ position: absolute;
+ text-align: center;
+ /*height: 28px;*/
+ padding: 2px;
+ font: 12px sans-serif;
+ background: lightsteelblue;
+ border: 0px;
+ border-radius: 8px;
+ pointer-events: none;
+}
+
+/*
+ * Data table
+ */
+
+table.dataTable thead .sorting {
+ background-image: url("/assets/images/datatables/sort_both.png");
+}
+table.dataTable thead .sorting_asc {
+ background-image: url("/assets/images/datatables/sort_asc.png");
+}
+table.dataTable thead .sorting_desc {
+ background-image: url("/assets/images/datatables/sort_desc.png");
+}
+table.dataTable thead .sorting_asc_disabled {
+ background-image: url("/assets/images/datatables/sort_asc_disabled.png");
+}
+table.dataTable thead .sorting_desc_disabled {
+ background-image: url("/assets/images/datatables/sort_desc_disabled.png");
+}
+
+/*
+ * Queue selector
+ */
+.node {
+ cursor: pointer;
+}
+
+.node circle {
+ fill: #fff;
+ stroke: steelblue;
+ stroke-width: 3px;
+}
+
+.node text {
+ font: 12px sans-serif;
+}
+
+.link {
+ fill: none;
+ stroke: #ccc;
+ stroke-width: 2px;
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs
new file mode 100644
index 0000000..88702c4
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs
@@ -0,0 +1,41 @@
+{{!
+ * 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.
+}}
+
+<nav class="navbar navbar-default">
+ <div class="container-fluid">
+ <!-- Brand and toggle get grouped for better mobile display -->
+ <div class="navbar-header">
+ <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
+ <span class="sr-only">Toggle navigation</span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+ <a class="navbar-brand" href="#">Apache Hadoop YARN</a>
+ </div>
+
+ <!-- Collect the nav links, forms, and other content for toggling -->
+ <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
+ <ul class="nav navbar-nav">
+ {{outputMainMenu}}
+ </ul>
+ </div><!-- /.navbar-collapse -->
+ </div><!-- /.container-fluid -->
+</nav>
+
+{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/cluster-overview.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/cluster-overview.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/cluster-overview.hbs
new file mode 100644
index 0000000..2094092
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/cluster-overview.hbs
@@ -0,0 +1,74 @@
+{{!
+ * 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.
+}}
+
+<div class="row">
+ <div class="col-lg-3 container-fluid" id="finishedapps-donut-chart">
+ {{donut-chart data=model.firstObject.getFinishedAppsDataForDonutChart
+ title="Finished Apps"
+ showLabels=true
+ parentId="finishedapps-donut-chart"
+ ratio=0.55
+ maxHeight=350}}
+ </div>
+
+ <div class="col-lg-3 container-fluid" id="runningapps-donut-chart">
+ {{donut-chart data=model.firstObject.getRunningAppsDataForDonutChart
+ title="Running Apps"
+ showLabels=true
+ parentId="runningapps-donut-chart"
+ ratio=0.55
+ maxHeight=350}}
+ </div>
+</div>
+
+<hr>
+
+<div class="row">
+ <div class="col-lg-3 container-fluid" id="nodes-donut-chart">
+ {{donut-chart data=model.firstObject.getNodesDataForDonutChart
+ title="Node Managers"
+ showLabels=true
+ parentId="nodes-donut-chart"
+ ratio=0.55
+ maxHeight=350}}
+ </div>
+</div>
+
+<hr>
+
+<div class="row">
+ <div class="col-lg-3 container-fluid" id="mem-donut-chart">
+ {{donut-chart data=model.firstObject.getMemoryDataForDonutChart
+ title="Resource - Memory"
+ showLabels=true
+ parentId="mem-donut-chart"
+ ratio=0.55
+ maxHeight=350}}
+ </div>
+
+ <div class="col-lg-3 container-fluid" id="vcore-donut-chart">
+ {{donut-chart data=model.firstObject.getVCoreDataForDonutChart
+ title="Resource - VCores"
+ showLabels=true
+ parentId="vcore-donut-chart"
+ ratio=0.6
+ maxHeight=350}}
+ </div>
+</div>
+
+{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-attempt-table.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-attempt-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-attempt-table.hbs
new file mode 100644
index 0000000..722f780
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-attempt-table.hbs
@@ -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.
+}}
+
+<table id="app-attempt-table" class="table table-striped table-bordered" cellspacing="0" width="100%" height="100%">
+ <tbody>
+ <tr>
+ <td>Application Attempt Id</td>
+ <td>{{attempt.id}}</td>
+ </tr>
+ <tr>
+ <td>Start Time</td>
+ <td>{{attempt.startTime}}</td>
+ </tr>
+ <tr>
+ <td>AM Container Id</td>
+ <td>{{attempt.containerId}}</td>
+ </tr>
+ <tr>
+ <td>AM Node Web UI</td>
+ <td><a href={{attempt.nodeHttpAddress}}>{{attempt.nodeHttpAddress}}</a></td>
+ </tr>
+ <tr>
+ <td>AM Node Id</td>
+ <td>{{attempt.nodeId}}</td>
+ </tr>
+ <tr>
+ <td>Log</td>
+ <td><a href={{attempt.logsLink}}>link</a></td>
+ </tr>
+ </tbody>
+</table>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-table.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-table.hbs
new file mode 100644
index 0000000..fb0fb6f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-table.hbs
@@ -0,0 +1,80 @@
+{{!
+ * 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.
+}}
+
+<table id={{table-id}} class="display table table-striped table-bordered" cellspacing="0" width="100%">
+ <thead>
+ <tr>
+ <th>Application ID</th>
+ <th>Name</th>
+ <th>User</th>
+ <th>Queue</th>
+ <th>State</th>
+ <th>Final Status</th>
+ <th>Start Time</th>
+ <th>Elapsed Time</th> <!-- idx = 7 -->
+ <th>Finished Time</th>
+ <th>Priority</th>
+ <th>Progress</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#if arr}}
+ {{#each arr as |app|}}
+ <tr>
+ <td><a href="yarnApp/{{app.id}}">{{app.id}}</a></td>
+ <td>{{app.appName}}</td>
+ <td>{{app.user}}</td>
+ <td>{{app.queue}}</td>
+ <td>{{app.state}}</td>
+ <td><span class={{app.finalStatusStyle}}>{{app.finalStatus}}</span></td>
+ <td>{{app.startTime}}</td>
+ <td>{{app.elapsedTime}}</td>
+ <td>{{app.finishedTime}}</td>
+ <td>{{app.priority}}</td>
+ <td>
+ <div class="progress" style="margin-bottom: 0;">
+ <div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style={{app.progressStyle}}>
+ {{app.progress}}%
+ </div>
+ </div>
+ </td>
+ </tr>
+ {{/each}}
+ {{else}}
+ <tr>
+ <td><a href="yarnApp/{{app.id}}">{{app.id}}</a></td>
+ <td>{{app.appName}}</td>
+ <td>{{app.user}}</td>
+ <td>{{app.queue}}</td>
+ <td>{{app.state}}</td>
+ <td><span class={{app.finalStatusStyle}}>{{app.finalStatus}}</span></td>
+ <td>{{app.startTime}}</td>
+ <td>{{app.elapsedTime}}</td>
+ <td>{{app.finishedTime}}</td>
+ <td>{{app.priority}}</td>
+ <td>
+ <div class="progress" style="margin-bottom: 0;">
+ <div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style={{app.progressStyle}}>
+ {{app.progress}}%
+ </div>
+ </div>
+ </td>
+ </tr>
+ {{/if}}
+ </tbody>
+</table>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/container-table.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/container-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/container-table.hbs
new file mode 100644
index 0000000..dcc31da
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/container-table.hbs
@@ -0,0 +1,54 @@
+{{!
+ * 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.
+}}
+
+<table id="container-table" class="table table-striped table-bordered" cellspacing="0" width="100%" height="100%">
+ <tbody>
+ <tr>
+ <td>Start Time</td>
+ <td>{{container.startedTime}}</td>
+ </tr>
+ <tr>
+ <td>Finished Time</td>
+ <td>{{container.finishedTime}}</td>
+ </tr>
+ <tr>
+ <td>Elapsed Time</td>
+ <td>{{container.elapsedTime}}</td>
+ </tr>
+ <tr>
+ <td>Priority</td>
+ <td>{{container.priority}}</td>
+ </tr>
+ <tr>
+ <td>Log</td>
+ <td><a href={{container.logUrl}}>link</a></td>
+ </tr>
+ <tr>
+ <td>Exit Status</td>
+ <td>{{container.containerExitStatus}}</td>
+ </tr>
+ <tr>
+ <td>State</td>
+ <td>{{container.containerState}}</td>
+ </tr>
+ <tr>
+ <td>NodeManager UI</td>
+ <td>{{container.nodeHttpAddress}}</td>
+ </tr>
+ </tbody>
+</table>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/queue-configuration-table.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/queue-configuration-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/queue-configuration-table.hbs
new file mode 100644
index 0000000..9045976
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/queue-configuration-table.hbs
@@ -0,0 +1,58 @@
+{{!
+ * 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.
+}}
+
+<table id="queue-configuration-table" class="table table-striped table-bordered" cellspacing="0" width="100%" height="100%">
+ <thead>
+ <tr>
+ <td><b>Configurations</b></td>
+ <td>Value</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Queue Name</td>
+ <td>{{queue.id}}</td>
+ </tr>
+ <tr>
+ <td>Configured Capacity</td>
+ <td>{{queue.capacity}}</td>
+ </tr>
+ <tr>
+ <td>Configured Max Capacity</td>
+ <td>{{queue.maxCapacity}}</td>
+ </tr>
+ <tr>
+ <td>State</td>
+ <td>{{queue.state}}</td>
+ </tr>
+ {{#if queue.isLeafQueue}}
+ <tr>
+ <td>User Limit Percent</td>
+ <td>{{queue.userLimit}}</td>
+ </tr>
+ <tr>
+ <td>User Limit Factor</td>
+ <td>{{queue.userLimitFactor}}</td>
+ </tr>
+ <tr>
+ <td>Preemption Disabled</td>
+ <td>{{queue.preemptionDisabled}}</td>
+ </tr>
+ {{/if}}
+ </tbody>
+</table>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/queue-navigator.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/queue-navigator.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/queue-navigator.hbs
new file mode 100644
index 0000000..fb9c6c8
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/queue-navigator.hbs
@@ -0,0 +1,36 @@
+{{!
+ * 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.
+}}
+
+<div class="row">
+ <div class="col-lg-4">
+ <select class="js-example-basic-single" width="100%" id="queue-name-selector">
+ {{item-selector element-id="queue-name-selector" prefix="Queue : " model=model}}
+ </select>
+ </div>
+</div><!-- /.row -->
+
+<!-- queue selector -->
+<div class="row">
+ <div class="col-md-12 container-fluid" id="tree-selector-container">
+ {{tree-selector model=model parentId="tree-selector-container" selected=selected}}
+ </div>
+</div>
+
+<hr>
+
+{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/timeline-view.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/timeline-view.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/timeline-view.hbs
new file mode 100644
index 0000000..2eb3441
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/timeline-view.hbs
@@ -0,0 +1,53 @@
+{{!
+ * 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.
+}}
+
+<div class="col-md-12 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ {{#if attemptModel}}
+ Application Attempts
+ {{else}}
+ Containers
+ {{/if}}
+ </div>
+ <div class="panel-body">
+ <div class="col-md-8 container-fluid" id={{parent-id}}>
+ </div>
+
+ <!-- diag info -->
+ <div class="col-md-4 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ {{#if selected.link}}
+ <a href={{selected.link}}>{{selected.id}}</a>
+ {{else}}
+ {{selected.id}}
+ {{/if}}
+ </div>
+ {{#if attemptModel}}
+ {{app-attempt-table attempt=selected}}
+ {{else}}
+ {{container-table container=selected}}
+ {{/if}}
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+
+{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/error.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/error.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/error.hbs
new file mode 100644
index 0000000..c546bf7
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/error.hbs
@@ -0,0 +1,19 @@
+{{!--
+ 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.
+--}}
+
+<h3 align = "center">Sorry, Error Occured.</h3>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/notfound.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/notfound.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/notfound.hbs
new file mode 100644
index 0000000..588ea44
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/notfound.hbs
@@ -0,0 +1,20 @@
+{{!--
+ 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.
+--}}
+
+<h2 align = "center">404, Not Found</h2>
+<h4 align = "center">Please Check your URL</h4>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempt.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempt.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempt.hbs
new file mode 100644
index 0000000..a0343b5
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app-attempt.hbs
@@ -0,0 +1,30 @@
+{{!
+ * 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.
+}}
+
+<div class="container-fluid">
+ <div class="row">
+ {{app-attempt-table attempt=model.attempt}}
+ </div>
+
+ <!-- containers table -->
+ <div class="row">
+ {{timeline-view parent-id="containers-timeline-div" my-id="timeline-view" height="400" rmModel=model.rmContainers tsModel=model.tsContainers label="shortAppAttemptId" attemptModel=false}}
+ </div>
+</div>
+
+{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs
new file mode 100644
index 0000000..d306e64
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs
@@ -0,0 +1,163 @@
+{{!
+ * 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.
+}}
+
+<div class="container-fluid">
+ <!-- app table -->
+ <div class="row">
+ <div class="col-md-12 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Application Basic Information
+ </div>
+ {{app-table table-id="app-table" app=model.app}}
+ </div>
+ </div>
+ </div>
+
+ <!-- diag info and other infos -->
+ <div class="row">
+ <!-- diag info -->
+ <div class="col-md-4 container-fluid">
+ {{#if model.app.isFailed}}
+ <div class="panel panel-danger">
+ <div class="panel-heading">
+ Diagnostics
+ </div>
+ <div class="panel-body">{{model.app.diagnostics}}</div>
+ </div>
+ {{else}}
+ <div class="panel panel-default">
+ <div class="panel-body">
+ Diagnostics
+ </div>
+ <div class="panel-footer">{{model.app.diagnostics}}</div>
+ </div>
+ {{/if}}
+ </div>
+
+ <div class="col-md-5 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">Scheduling Info</div>
+ <table class="table">
+ <tbody>
+ <tr>
+ <td>Allocated Resource</td>
+ <td>{{model.app.allocatedResource}}</td>
+ </tr>
+ <tr>
+ <td>Running Containers</td>
+ <td>{{model.app.runningContainers}}</td>
+ </tr>
+ <tr>
+ <td>Preempted Resource</td>
+ <td>{{model.app.preemptedResource}}</td>
+ </tr>
+ <tr>
+ <td>Num Non-AM container preempted</td>
+ <td>{{model.app.numAMContainerPreempted}}</td>
+ </tr>
+ <tr>
+ <td>Num AM container preempted</td>
+ <td>{{model.app.numAMContainerPreempted}}</td>
+ </tr>
+ <tr>
+ <td>Aggregated Resource Usage</td>
+ <td>{{model.app.aggregatedResourceUsage}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+
+ <!-- other info -->
+ <div class="col-md-3 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">Other Info</div>
+ <table class="table">
+ <tbody>
+ <tr>
+ <td>AM Container Log</td>
+ <td><a href={{model.app.amContainerLogs}}>Link</a></td>
+ </tr>
+ <tr>
+ <td>AM Host Http Addr</td>
+ <td><a href={{model.app.amHostHttpAddress}}>Link</a></td>
+ </tr>
+ <tr>
+ <td>Log Aggregation Status</td>
+ <td>{{model.app.logAggregationStatus}}</td>
+ </tr>
+ <tr>
+ <td>Is Unmanaged AM</td>
+ <td>{{model.app.unmanagedApplication}}</td>
+ </tr>
+ <tr>
+ <td>AM Node Label Expression</td>
+ <td>{{model.app.amNodeLabelExpression}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+
+<!--
+ <div class="row">
+ <div class="col-md-12 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Application Attempts
+ </div>
+ <table id="app-attempt-table" class="table table-striped table-bordered" cellspacing="0" width="100%" height="100%">
+ <thead>
+ <tr>
+ <th>Start Time</th>
+ <th>Master ContainerId</th>
+ <th>Node Http Address</th>
+ <th>Node Id</th>
+ <th>Logs Link</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#each model.attempts as |attempt|}}
+ <tr>
+ <td>{{attempt.startTime}}</td>
+ <td>{{attempt.containerId}}</td>
+ <td><a href={{attempt.nodeHttpAddress}}>{{attempt.nodeHttpAddress}}</a></td>
+ <td>{{attempt.nodeId}}</td>
+ <td><a href={{attempt.logsLink}}>link</a></td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+-->
+ <!-- timeline view of children -->
+ <div class="row">
+ {{timeline-view parent-id="attempt-timeline-div" my-id="timeline-view" height="100%" rmModel=model.attempts label="shortAppAttemptId" attemptModel=true}}
+ </div>
+</div>
+
+<!--
+{{simple-table table-id="app-attempt-table" paging=false bFilter=false}}
+-->
+
+
+{{outlet}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps.hbs
new file mode 100644
index 0000000..98b9107
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps.hbs
@@ -0,0 +1,21 @@
+{{!
+ * 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.
+}}
+
+{{app-table table-id="apps-table" arr=model}}
+{{simple-table table-id="apps-table" bFilter=true colsOrder="0,desc" colTypes="natural elapsed-time" colTargets="0 7"}}
+{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-container-log.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-container-log.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-container-log.hbs
new file mode 100644
index 0000000..9cc3b0f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-container-log.hbs
@@ -0,0 +1,36 @@
+{{!--
+ 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.
+--}}
+
+<div class="col-md-12 container-fluid">
+ {{node-menu path="yarnContainerLog" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
+ <div class="col-md-10">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h5 align="center"><b>{{model.containerLog.logFileName}} for {{model.containerLog.containerID}}</b></h5>
+ </div>
+ <div class="panel-body">
+ {{#if model.containerLog.logs}}
+ <pre>{{model.containerLog.logs}}</pre>
+ {{else}}
+ <p>No logs were written in {{model.containerLog.logFileName}}.</p>
+ {{/if}}
+ </div>
+ </div>
+ </div>
+</div>
+{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-app.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-app.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-app.hbs
new file mode 100644
index 0000000..4da64b8
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-app.hbs
@@ -0,0 +1,60 @@
+{{!--
+ 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.
+--}}
+
+<div class="col-md-12 container-fluid">
+ <div class="row">
+ {{node-menu path="yarnNodeApp" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
+ <div class="col-md-10 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading"><b>Application Information</b></div>
+ <table class="table">
+ <tbody>
+ <tr>
+ <td>Application ID</td>
+ <td>{{model.nodeApp.appId}}</td>
+ </tr>
+ <tr>
+ <td>Application State</td>
+ <td>{{model.nodeApp.state}}</td>
+ </tr>
+ <tr>
+ <td>User</td>
+ <td>{{model.nodeApp.user}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <table id="node-app-table" class="display table table-striped table-bordered" cellspacing="0">
+ <thead>
+ <tr>
+ <th>Containers for {{model.nodeApp.appId}}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#each model.nodeApp.containers as |container|}}
+ <tr>
+ <td><a href="yarnNodeContainer/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{container}}">{{container}}</a></td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+ {{simple-table table-id="node-app-table" bFilter=true colsOrder="0,desc" colTypes="natural" colTargets="0"}}
+ </div>
+ </div>
+ </div>
+{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-apps.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-apps.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-apps.hbs
new file mode 100644
index 0000000..c195397
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-apps.hbs
@@ -0,0 +1,51 @@
+{{!--
+ 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.
+--}}
+
+<div class="col-md-12 container-fluid">
+ <div class="row">
+ {{node-menu path="yarnNodeApps" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
+ <div class="col-md-10 container-fluid">
+ <table id="node-apps-table" class="display table table-striped table-bordered" cellspacing="0" width="100%">
+ <thead>
+ <tr>
+ <th>Application ID</th>
+ <th>State</th>
+ <th>User</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#if model.apps}}
+ {{#each model.apps as |app|}}
+ {{#if app.isDummyApp}}
+ <tr><td colspan="3" align="center">No apps found on this node</td></tr>
+ {{else}}
+ <tr>
+ <td><a href="yarnNodeApp/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{app.appId}}">{{app.appId}}</a></td>
+ <td><span class={{app.appStateStyle}}>{{app.state}}</span></td>
+ <td>{{app.user}}</td>
+ </tr>
+ {{/if}}
+ {{/each}}
+ {{/if}}
+ </tbody>
+ </table>
+ {{simple-table table-id="node-apps-table" bFilter=true colsOrder="0,desc" colTypes="natural" colTargets="0"}}
+ </div>
+ </div>
+</div>
+{{outlet}}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d13f52f0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-container.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-container.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-container.hbs
new file mode 100644
index 0000000..fbbb2fc
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node-container.hbs
@@ -0,0 +1,70 @@
+{{!--
+ 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.
+--}}
+
+<div class="col-md-12 container-fluid">
+ <div class="row">
+ {{node-menu path="yarnNodeContainer" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
+ <div class="col-md-10 container-fluid">
+ <div class="panel panel-default">
+ <div class="panel-heading"><b>Container Information</b></div>
+ <table class="table">
+ <tbody>
+ <tr>
+ <td>Container ID</td>
+ <td>{{model.nodeContainer.containerId}}</td>
+ </tr>
+ <tr>
+ <td>Container State</td>
+ <td>{{model.nodeContainer.state}}</td>
+ </tr>
+ <tr>
+ <td>Exit Code</td>
+ <td>{{model.nodeContainer.exitCode}}</td>
+ </tr>
+ <tr>
+ <td>Diagnostics</td>
+ <td>{{model.nodeContainer.diagnostics}}</td>
+ </tr>
+ <tr>
+ <td>User</td>
+ <td>{{model.nodeContainer.user}}</td>
+ </tr>
+ <tr>
+ <td>Total Memory Needed</td>
+ <td>{{model.nodeContainer.totalMemoryNeeded}} MB</td>
+ </tr>
+ <tr>
+ <td>Total VCores Needed</td>
+ <td>{{model.nodeContainer.totalVCoresNeeded}}</td>
+ </tr>
+ <tr>
+ <td>Link to Logs</td>
+ <td>
+ {{log-files-comma nodeId=model.nodeInfo.id
+ nodeAddr=model.nodeInfo.addr
+ containerId=model.nodeContainer.containerId
+ logFiles=model.nodeContainer.containerLogFiles}}
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+ </div>
+{{outlet}}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[14/50] [abbrv] hadoop git commit: YARN-5470. Addedum to
differentiate exactly matching of log-files with regex in yarn log CLI.
Contributed by Xuan Gong.
Posted by wa...@apache.org.
YARN-5470. Addedum to differentiate exactly matching of log-files with regex in yarn log CLI. Contributed by Xuan Gong.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/83a2ffec
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/83a2ffec
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/83a2ffec
Branch: refs/heads/YARN-3368
Commit: 83a2ffec408fc3ebb89ab13ab4788d9f02fae33b
Parents: 58e1523
Author: Vinod Kumar Vavilapalli (I am also known as @tshooter.) <vi...@apache.org>
Authored: Mon Aug 8 14:28:07 2016 -0700
Committer: Vinod Kumar Vavilapalli (I am also known as @tshooter.) <vi...@apache.org>
Committed: Mon Aug 8 14:28:07 2016 -0700
----------------------------------------------------------------------
.../apache/hadoop/yarn/client/cli/LogsCLI.java | 62 ++++++---
.../hadoop/yarn/client/cli/TestLogsCLI.java | 129 +++++++++++--------
2 files changed, 122 insertions(+), 69 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/83a2ffec/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
index ec045b2..908d379 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
@@ -84,6 +84,8 @@ public class LogsCLI extends Configured implements Tool {
private static final String APP_OWNER_OPTION = "appOwner";
private static final String AM_CONTAINER_OPTION = "am";
private static final String PER_CONTAINER_LOG_FILES_OPTION = "log_files";
+ private static final String PER_CONTAINER_LOG_FILES_REGEX_OPTION
+ = "log_files_pattern";
private static final String LIST_NODES_OPTION = "list_nodes";
private static final String SHOW_APPLICATION_LOG_INFO
= "show_application_log_info";
@@ -91,7 +93,6 @@ public class LogsCLI extends Configured implements Tool {
= "show_container_log_info";
private static final String OUT_OPTION = "out";
private static final String SIZE_OPTION = "size";
- private static final String REGEX_OPTION = "regex";
public static final String HELP_CMD = "help";
private PrintStream outStream = System.out;
private YarnClient yarnClient = null;
@@ -130,6 +131,7 @@ public class LogsCLI extends Configured implements Tool {
boolean showContainerLogInfo = false;
boolean useRegex = false;
String[] logFiles = null;
+ String[] logFilesRegex = null;
List<String> amContainersList = new ArrayList<String>();
String localDir = null;
long bytes = Long.MAX_VALUE;
@@ -145,7 +147,6 @@ public class LogsCLI extends Configured implements Tool {
showApplicationLogInfo = commandLine.hasOption(
SHOW_APPLICATION_LOG_INFO);
showContainerLogInfo = commandLine.hasOption(SHOW_CONTAINER_LOG_INFO);
- useRegex = commandLine.hasOption(REGEX_OPTION);
if (getAMContainerLogs) {
try {
amContainersList = parseAMContainer(commandLine, printOpts);
@@ -157,6 +158,11 @@ public class LogsCLI extends Configured implements Tool {
if (commandLine.hasOption(PER_CONTAINER_LOG_FILES_OPTION)) {
logFiles = commandLine.getOptionValues(PER_CONTAINER_LOG_FILES_OPTION);
}
+ if (commandLine.hasOption(PER_CONTAINER_LOG_FILES_REGEX_OPTION)) {
+ logFilesRegex = commandLine.getOptionValues(
+ PER_CONTAINER_LOG_FILES_REGEX_OPTION);
+ useRegex = true;
+ }
if (commandLine.hasOption(SIZE_OPTION)) {
bytes = Long.parseLong(commandLine.getOptionValue(SIZE_OPTION));
}
@@ -206,6 +212,12 @@ public class LogsCLI extends Configured implements Tool {
return -1;
}
+ if (logFiles != null && logFiles.length > 0 && logFilesRegex != null
+ && logFilesRegex.length > 0) {
+ System.err.println("Invalid options. Can only accept one of "
+ + "log_files/log_files_pattern.");
+ return -1;
+ }
if (localDir != null) {
File file = new File(localDir);
if (file.exists() && file.isFile()) {
@@ -248,10 +260,12 @@ public class LogsCLI extends Configured implements Tool {
}
Set<String> logs = new HashSet<String>();
- if (fetchAllLogFiles(logFiles, useRegex)) {
+ if (fetchAllLogFiles(logFiles, logFilesRegex)) {
logs.add("ALL");
} else if (logFiles != null && logFiles.length > 0) {
logs.addAll(Arrays.asList(logFiles));
+ } else if (logFilesRegex != null && logFilesRegex.length > 0) {
+ logs.addAll(Arrays.asList(logFilesRegex));
}
ContainerLogsRequest request = new ContainerLogsRequest(appId,
@@ -366,18 +380,28 @@ public class LogsCLI extends Configured implements Tool {
return amContainersList;
}
- private boolean fetchAllLogFiles(String[] logFiles, boolean useRegex) {
+ private boolean fetchAllLogFiles(String[] logFiles, String[] logFilesRegex) {
- // If no value is specified for the PER_CONTAINER_LOG_FILES_OPTION option,
+ // If no value is specified for the PER_CONTAINER_LOG_FILES_OPTION option
+ // and PER_CONTAINER_LOG_FILES_REGEX_OPTION
// we will assume all logs.
- if (logFiles == null || logFiles.length == 0) {
+ if ((logFiles == null || logFiles.length == 0) && (
+ logFilesRegex == null || logFilesRegex.length == 0)) {
return true;
}
- List<String> logs = Arrays.asList(logFiles);
- if (logs.contains("ALL") || logs.contains("*")||
- (logs.contains(".*") && useRegex)) {
- return true;
+ if (logFiles != null && logFiles.length > 0) {
+ List<String> logs = Arrays.asList(logFiles);
+ if (logs.contains("ALL") || logs.contains("*")) {
+ return true;
+ }
+ }
+
+ if (logFilesRegex != null && logFilesRegex.length > 0) {
+ List<String> logsRegex = Arrays.asList(logFilesRegex);
+ if (logsRegex.contains(".*")) {
+ return true;
+ }
}
return false;
@@ -753,15 +777,20 @@ public class LogsCLI extends Configured implements Tool {
opts.addOption(amOption);
Option logFileOpt = new Option(PER_CONTAINER_LOG_FILES_OPTION, true,
"Specify comma-separated value "
- + "to get exact matched log files. Use \"ALL\" or \"*\"to "
- + "fetch all the log files for the container. Specific -regex "
- + "for using java regex to find matched log files.");
+ + "to get exact matched log files. Use \"ALL\" or \"*\" to "
+ + "fetch all the log files for the container.");
logFileOpt.setValueSeparator(',');
logFileOpt.setArgs(Option.UNLIMITED_VALUES);
logFileOpt.setArgName("Log File Name");
opts.addOption(logFileOpt);
- opts.addOption(REGEX_OPTION, false, "Work with -log_files to find "
- + "matched files by using java regex.");
+ Option logFileRegexOpt = new Option(PER_CONTAINER_LOG_FILES_REGEX_OPTION,
+ true, "Specify comma-separated value "
+ + "to get matched log files by using java regex. Use \".*\" to "
+ + "fetch all the log files for the container.");
+ logFileRegexOpt.setValueSeparator(',');
+ logFileRegexOpt.setArgs(Option.UNLIMITED_VALUES);
+ logFileRegexOpt.setArgName("Log File Pattern");
+ opts.addOption(logFileRegexOpt);
opts.addOption(SHOW_CONTAINER_LOG_INFO, false,
"Show the container log metadata, "
+ "including log-file names, the size of the log files. "
@@ -804,7 +833,8 @@ public class LogsCLI extends Configured implements Tool {
printOpts.addOption(commandOpts.getOption(SHOW_CONTAINER_LOG_INFO));
printOpts.addOption(commandOpts.getOption(OUT_OPTION));
printOpts.addOption(commandOpts.getOption(SIZE_OPTION));
- printOpts.addOption(commandOpts.getOption(REGEX_OPTION));
+ printOpts.addOption(commandOpts.getOption(
+ PER_CONTAINER_LOG_FILES_REGEX_OPTION));
return printOpts;
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/83a2ffec/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestLogsCLI.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestLogsCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestLogsCLI.java
index 467b204..19ddb2f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestLogsCLI.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestLogsCLI.java
@@ -189,57 +189,70 @@ public class TestLogsCLI {
pw.println("usage: yarn logs -applicationId <application ID> [OPTIONS]");
pw.println();
pw.println("general options are:");
- pw.println(" -am <AM Containers> Prints the AM Container logs for this");
- pw.println(" application. Specify comma-separated");
- pw.println(" value to get logs for related AM");
- pw.println(" Container. For example, If we specify -am");
- pw.println(" 1,2, we will get the logs for the first");
- pw.println(" AM Container as well as the second AM");
- pw.println(" Container. To get logs for all AM");
- pw.println(" Containers, use -am ALL. To get logs for");
- pw.println(" the latest AM Container, use -am -1. By");
- pw.println(" default, it will print all available");
- pw.println(" logs. Work with -log_files to get only");
- pw.println(" specific logs.");
- pw.println(" -appOwner <Application Owner> AppOwner (assumed to be current user if");
- pw.println(" not specified)");
- pw.println(" -containerId <Container ID> ContainerId. By default, it will print");
- pw.println(" all available logs. Work with -log_files");
- pw.println(" to get only specific logs. If specified,");
- pw.println(" the applicationId can be omitted");
- pw.println(" -help Displays help for all commands.");
- pw.println(" -list_nodes Show the list of nodes that successfully");
- pw.println(" aggregated logs. This option can only be");
- pw.println(" used with finished applications.");
- pw.println(" -log_files <Log File Name> Specify comma-separated value to get");
- pw.println(" exact matched log files. Use \"ALL\" or");
- pw.println(" \"*\"to fetch all the log files for the");
- pw.println(" container. Specific -regex for using java");
- pw.println(" regex to find matched log files.");
- pw.println(" -nodeAddress <Node Address> NodeAddress in the format nodename:port");
- pw.println(" -out <Local Directory> Local directory for storing individual");
- pw.println(" container logs. The container logs will");
- pw.println(" be stored based on the node the container");
- pw.println(" ran on.");
- pw.println(" -regex Work with -log_files to find matched");
- pw.println(" files by using java regex.");
- pw.println(" -show_application_log_info Show the containerIds which belong to the");
- pw.println(" specific Application. You can combine");
- pw.println(" this with --nodeAddress to get");
- pw.println(" containerIds for all the containers on");
- pw.println(" the specific NodeManager.");
- pw.println(" -show_container_log_info Show the container log metadata,");
- pw.println(" including log-file names, the size of the");
- pw.println(" log files. You can combine this with");
- pw.println(" --containerId to get log metadata for the");
- pw.println(" specific container, or with --nodeAddress");
- pw.println(" to get log metadata for all the");
- pw.println(" containers on the specific NodeManager.");
- pw.println(" -size <size> Prints the log file's first 'n' bytes or");
- pw.println(" the last 'n' bytes. Use negative values");
- pw.println(" as bytes to read from the end and");
- pw.println(" positive values as bytes to read from the");
- pw.println(" beginning.");
+ pw.println(" -am <AM Containers> Prints the AM Container logs for");
+ pw.println(" this application. Specify");
+ pw.println(" comma-separated value to get logs");
+ pw.println(" for related AM Container. For");
+ pw.println(" example, If we specify -am 1,2,");
+ pw.println(" we will get the logs for the");
+ pw.println(" first AM Container as well as the");
+ pw.println(" second AM Container. To get logs");
+ pw.println(" for all AM Containers, use -am");
+ pw.println(" ALL. To get logs for the latest");
+ pw.println(" AM Container, use -am -1. By");
+ pw.println(" default, it will print all");
+ pw.println(" available logs. Work with");
+ pw.println(" -log_files to get only specific");
+ pw.println(" logs.");
+ pw.println(" -appOwner <Application Owner> AppOwner (assumed to be current");
+ pw.println(" user if not specified)");
+ pw.println(" -containerId <Container ID> ContainerId. By default, it will");
+ pw.println(" print all available logs. Work");
+ pw.println(" with -log_files to get only");
+ pw.println(" specific logs. If specified, the");
+ pw.println(" applicationId can be omitted");
+ pw.println(" -help Displays help for all commands.");
+ pw.println(" -list_nodes Show the list of nodes that");
+ pw.println(" successfully aggregated logs.");
+ pw.println(" This option can only be used with");
+ pw.println(" finished applications.");
+ pw.println(" -log_files <Log File Name> Specify comma-separated value to");
+ pw.println(" get exact matched log files. Use");
+ pw.println(" \"ALL\" or \"*\" to fetch all the log");
+ pw.println(" files for the container.");
+ pw.println(" -log_files_pattern <Log File Pattern> Specify comma-separated value to");
+ pw.println(" get matched log files by using");
+ pw.println(" java regex. Use \".*\" to fetch all");
+ pw.println(" the log files for the container.");
+ pw.println(" -nodeAddress <Node Address> NodeAddress in the format");
+ pw.println(" nodename:port");
+ pw.println(" -out <Local Directory> Local directory for storing");
+ pw.println(" individual container logs. The");
+ pw.println(" container logs will be stored");
+ pw.println(" based on the node the container");
+ pw.println(" ran on.");
+ pw.println(" -show_application_log_info Show the containerIds which");
+ pw.println(" belong to the specific");
+ pw.println(" Application. You can combine this");
+ pw.println(" with --nodeAddress to get");
+ pw.println(" containerIds for all the");
+ pw.println(" containers on the specific");
+ pw.println(" NodeManager.");
+ pw.println(" -show_container_log_info Show the container log metadata,");
+ pw.println(" including log-file names, the");
+ pw.println(" size of the log files. You can");
+ pw.println(" combine this with --containerId");
+ pw.println(" to get log metadata for the");
+ pw.println(" specific container, or with");
+ pw.println(" --nodeAddress to get log metadata");
+ pw.println(" for all the containers on the");
+ pw.println(" specific NodeManager.");
+ pw.println(" -size <size> Prints the log file's first 'n'");
+ pw.println(" bytes or the last 'n' bytes. Use");
+ pw.println(" negative values as bytes to read");
+ pw.println(" from the end and positive values");
+ pw.println(" as bytes to read from the");
+ pw.println(" beginning.");
pw.close();
String appReportStr = baos.toString("UTF-8");
Assert.assertEquals(appReportStr, sysOutStream.toString());
@@ -346,7 +359,7 @@ public class TestLogsCLI {
sysOutStream.reset();
exitCode = cli.run(new String[] {"-applicationId", appId.toString(),
- "-log_files", ".*", "-regex"});
+ "-log_files_pattern", ".*"});
assertTrue(exitCode == 0);
assertTrue(sysOutStream.toString().contains(
logMessage(containerId1, "syslog")));
@@ -392,7 +405,7 @@ public class TestLogsCLI {
sysOutStream.reset();
exitCode = cli.run(new String[] {"-applicationId", appId.toString(),
- "-log_files", "std*", "-regex"});
+ "-log_files_pattern", "std*"});
assertTrue(exitCode == 0);
assertFalse(sysOutStream.toString().contains(
logMessage(containerId1, "syslog")));
@@ -809,6 +822,16 @@ public class TestLogsCLI {
+ "show_container_log_info."));
sysErrStream.reset();
+ // Specify log_files and log_files_pattern
+ // at the same time
+ exitCode = cli.run(new String[] {"-applicationId", appId.toString(),
+ "-log_files", "*", "-log_files_pattern", ".*"});
+ assertTrue(exitCode == -1);
+ assertTrue(sysErrStream.toString().contains("Invalid options. "
+ + "Can only accept one of log_files/"
+ + "log_files_pattern."));
+ sysErrStream.reset();
+
// Specify a file name to the option -out
try {
fs.mkdirs(localPath);
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[10/50] [abbrv] hadoop git commit: HADOOP-10823.
TestReloadingX509TrustManager is flaky. Contributed by Mingliang Liu.
Posted by wa...@apache.org.
HADOOP-10823. TestReloadingX509TrustManager is flaky. Contributed by Mingliang Liu.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/62558595
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/62558595
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/62558595
Branch: refs/heads/YARN-3368
Commit: 625585950a15461eb032e5e7ed8fdf4e1113b2bb
Parents: 37d939a
Author: Jitendra Pandey <ji...@apache.org>
Authored: Mon Aug 8 11:00:19 2016 -0700
Committer: Jitendra Pandey <ji...@apache.org>
Committed: Mon Aug 8 11:00:19 2016 -0700
----------------------------------------------------------------------
.../security/ssl/ReloadingX509TrustManager.java | 12 ++--
.../ssl/TestReloadingX509TrustManager.java | 63 ++++++++++++++------
2 files changed, 53 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/62558595/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/ReloadingX509TrustManager.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/ReloadingX509TrustManager.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/ReloadingX509TrustManager.java
index 1b24940..bb90a61 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/ReloadingX509TrustManager.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/ReloadingX509TrustManager.java
@@ -23,6 +23,8 @@ import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
+import com.google.common.annotations.VisibleForTesting;
+
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;
@@ -44,8 +46,11 @@ import java.util.concurrent.atomic.AtomicReference;
public final class ReloadingX509TrustManager
implements X509TrustManager, Runnable {
- private static final Log LOG =
- LogFactory.getLog(ReloadingX509TrustManager.class);
+ @VisibleForTesting
+ static final Log LOG = LogFactory.getLog(ReloadingX509TrustManager.class);
+ @VisibleForTesting
+ static final String RELOAD_ERROR_MESSAGE =
+ "Could not load truststore (keep using existing one) : ";
private String type;
private File file;
@@ -194,8 +199,7 @@ public final class ReloadingX509TrustManager
try {
trustManagerRef.set(loadTrustManager());
} catch (Exception ex) {
- LOG.warn("Could not load truststore (keep using existing one) : " +
- ex.toString(), ex);
+ LOG.warn(RELOAD_ERROR_MESSAGE + ex.toString(), ex);
}
}
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/62558595/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestReloadingX509TrustManager.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestReloadingX509TrustManager.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestReloadingX509TrustManager.java
index 9375da8..bf058cd 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestReloadingX509TrustManager.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestReloadingX509TrustManager.java
@@ -19,6 +19,10 @@ package org.apache.hadoop.security.ssl;
import org.apache.hadoop.fs.FileUtil;
import org.apache.hadoop.test.GenericTestUtils;
+import org.apache.hadoop.test.GenericTestUtils.LogCapturer;
+
+import com.google.common.base.Supplier;
+
import org.junit.BeforeClass;
import org.junit.Test;
@@ -30,11 +34,13 @@ import java.security.KeyPair;
import java.security.cert.X509Certificate;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.TimeoutException;
import static org.junit.Assert.assertEquals;
import static org.apache.hadoop.security.ssl.KeyStoreTestUtil.createTrustStore;
import static org.apache.hadoop.security.ssl.KeyStoreTestUtil.generateCertificate;
import static org.apache.hadoop.security.ssl.KeyStoreTestUtil.generateKeyPair;
+import static org.junit.Assert.assertFalse;
public class TestReloadingX509TrustManager {
@@ -43,6 +49,8 @@ public class TestReloadingX509TrustManager {
private X509Certificate cert1;
private X509Certificate cert2;
+ private final LogCapturer reloaderLog = LogCapturer.captureLogs(
+ ReloadingX509TrustManager.LOG);
@BeforeClass
public static void setUp() throws Exception {
@@ -80,7 +88,7 @@ public class TestReloadingX509TrustManager {
}
}
- @Test
+ @Test (timeout = 30000)
public void testReload() throws Exception {
KeyPair kp = generateKeyPair("RSA");
cert1 = generateCertificate("CN=Cert1", kp, 30, "SHA1withRSA");
@@ -88,7 +96,7 @@ public class TestReloadingX509TrustManager {
String truststoreLocation = BASEDIR + "/testreload.jks";
createTrustStore(truststoreLocation, "password", "cert1", cert1);
- ReloadingX509TrustManager tm =
+ final ReloadingX509TrustManager tm =
new ReloadingX509TrustManager("jks", truststoreLocation, "password", 10);
try {
tm.init();
@@ -103,19 +111,18 @@ public class TestReloadingX509TrustManager {
certs.put("cert2", cert2);
createTrustStore(truststoreLocation, "password", certs);
- // and wait to be sure reload has taken place
- assertEquals(10, tm.getReloadInterval());
-
- // Wait so that the file modification time is different
- Thread.sleep((tm.getReloadInterval() + 200));
-
- assertEquals(2, tm.getAcceptedIssuers().length);
+ GenericTestUtils.waitFor(new Supplier<Boolean>() {
+ @Override
+ public Boolean get() {
+ return tm.getAcceptedIssuers().length == 2;
+ }
+ }, (int) tm.getReloadInterval(), 10000);
} finally {
tm.destroy();
}
}
- @Test
+ @Test (timeout = 30000)
public void testReloadMissingTrustStore() throws Exception {
KeyPair kp = generateKeyPair("RSA");
cert1 = generateCertificate("CN=Cert1", kp, 30, "SHA1withRSA");
@@ -129,19 +136,22 @@ public class TestReloadingX509TrustManager {
tm.init();
assertEquals(1, tm.getAcceptedIssuers().length);
X509Certificate cert = tm.getAcceptedIssuers()[0];
+
+ assertFalse(reloaderLog.getOutput().contains(
+ ReloadingX509TrustManager.RELOAD_ERROR_MESSAGE));
new File(truststoreLocation).delete();
- // Wait so that the file modification time is different
- Thread.sleep((tm.getReloadInterval() + 200));
+ waitForFailedReloadAtLeastOnce((int) tm.getReloadInterval());
assertEquals(1, tm.getAcceptedIssuers().length);
assertEquals(cert, tm.getAcceptedIssuers()[0]);
} finally {
+ reloaderLog.stopCapturing();
tm.destroy();
}
}
- @Test
+ @Test (timeout = 30000)
public void testReloadCorruptTrustStore() throws Exception {
KeyPair kp = generateKeyPair("RSA");
cert1 = generateCertificate("CN=Cert1", kp, 30, "SHA1withRSA");
@@ -154,22 +164,39 @@ public class TestReloadingX509TrustManager {
try {
tm.init();
assertEquals(1, tm.getAcceptedIssuers().length);
- X509Certificate cert = tm.getAcceptedIssuers()[0];
+ final X509Certificate cert = tm.getAcceptedIssuers()[0];
+
+ // Wait so that the file modification time is different
+ Thread.sleep((tm.getReloadInterval() + 1000));
+ assertFalse(reloaderLog.getOutput().contains(
+ ReloadingX509TrustManager.RELOAD_ERROR_MESSAGE));
OutputStream os = new FileOutputStream(truststoreLocation);
os.write(1);
os.close();
- new File(truststoreLocation).setLastModified(System.currentTimeMillis() -
- 1000);
- // Wait so that the file modification time is different
- Thread.sleep((tm.getReloadInterval() + 200));
+ waitForFailedReloadAtLeastOnce((int) tm.getReloadInterval());
assertEquals(1, tm.getAcceptedIssuers().length);
assertEquals(cert, tm.getAcceptedIssuers()[0]);
} finally {
+ reloaderLog.stopCapturing();
tm.destroy();
}
}
+ /**Wait for the reloader thread to load the configurations at least once
+ * by probing the log of the thread if the reload fails.
+ */
+ private void waitForFailedReloadAtLeastOnce(int reloadInterval)
+ throws InterruptedException, TimeoutException {
+ GenericTestUtils.waitFor(new Supplier<Boolean>() {
+ @Override
+ public Boolean get() {
+ return reloaderLog.getOutput().contains(
+ ReloadingX509TrustManager.RELOAD_ERROR_MESSAGE);
+ }
+ }, reloadInterval, 10 * 1000);
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[22/50] [abbrv] hadoop git commit: MAPREDUCE-6741. Add MR support to
redact job conf properties. Contributed by Haibo Chen
Posted by wa...@apache.org.
MAPREDUCE-6741. Add MR support to redact job conf properties. Contributed by Haibo Chen
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/4aba8587
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/4aba8587
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/4aba8587
Branch: refs/heads/YARN-3368
Commit: 4aba858750900de25940c16211c21de4addd1926
Parents: 522ddbd
Author: Jason Lowe <jl...@apache.org>
Authored: Tue Aug 9 15:55:35 2016 +0000
Committer: Jason Lowe <jl...@apache.org>
Committed: Tue Aug 9 15:55:35 2016 +0000
----------------------------------------------------------------------
.../jobhistory/JobHistoryEventHandler.java | 19 +++---
.../mapreduce/v2/app/webapp/dao/ConfInfo.java | 4 +-
.../jobhistory/TestJobHistoryEventHandler.java | 71 ++++++++++++++++++++
.../mapreduce/v2/app/webapp/TestBlocks.java | 10 ++-
.../apache/hadoop/mapreduce/MRJobConfig.java | 5 ++
.../hadoop/mapreduce/util/MRJobConfUtil.java | 45 +++++++++++++
.../src/main/resources/mapred-default.xml | 8 +++
7 files changed, 149 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/4aba8587/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java
index 817cd14..53d8a36 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java
@@ -52,6 +52,7 @@ import org.apache.hadoop.mapreduce.MRJobConfig;
import org.apache.hadoop.mapreduce.TaskType;
import org.apache.hadoop.mapreduce.TypeConverter;
import org.apache.hadoop.mapreduce.util.JobHistoryEventUtils;
+import org.apache.hadoop.mapreduce.util.MRJobConfUtil;
import org.apache.hadoop.mapreduce.v2.api.records.JobId;
import org.apache.hadoop.mapreduce.v2.api.records.JobState;
import org.apache.hadoop.mapreduce.v2.app.AppContext;
@@ -507,16 +508,16 @@ public class JobHistoryEventHandler extends AbstractService
if (conf != null) {
// TODO Ideally this should be written out to the job dir
// (.staging/jobid/files - RecoveryService will need to be patched)
- FSDataOutputStream jobFileOut = null;
- try {
- if (logDirConfPath != null) {
- jobFileOut = stagingDirFS.create(logDirConfPath, true);
- conf.writeXml(jobFileOut);
- jobFileOut.close();
+ if (logDirConfPath != null) {
+ Configuration redactedConf = new Configuration(conf);
+ MRJobConfUtil.redact(redactedConf);
+ try (FSDataOutputStream jobFileOut = stagingDirFS
+ .create(logDirConfPath, true)) {
+ redactedConf.writeXml(jobFileOut);
+ } catch (IOException e) {
+ LOG.info("Failed to write the job configuration file", e);
+ throw e;
}
- } catch (IOException e) {
- LOG.info("Failed to write the job configuration file", e);
- throw e;
}
}
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/4aba8587/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/dao/ConfInfo.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/dao/ConfInfo.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/dao/ConfInfo.java
index a05c317..287ab99 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/dao/ConfInfo.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/dao/ConfInfo.java
@@ -26,8 +26,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileContext;
-import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.mapreduce.util.MRJobConfUtil;
import org.apache.hadoop.mapreduce.v2.app.job.Job;
@XmlRootElement(name = "conf")
@@ -45,6 +44,7 @@ public class ConfInfo {
this.property = new ArrayList<ConfEntryInfo>();
Configuration jobConf = job.loadConfFile();
this.path = job.getConfFile().toString();
+ MRJobConfUtil.redact(jobConf);
for (Map.Entry<String, String> entry : jobConf) {
this.property.add(new ConfEntryInfo(entry.getKey(), entry.getValue(),
jobConf.getPropertySources(entry.getKey())));
http://git-wip-us.apache.org/repos/asf/hadoop/blob/4aba8587/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/jobhistory/TestJobHistoryEventHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/jobhistory/TestJobHistoryEventHandler.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/jobhistory/TestJobHistoryEventHandler.java
index 064f9ec..bfe764d 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/jobhistory/TestJobHistoryEventHandler.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/jobhistory/TestJobHistoryEventHandler.java
@@ -29,6 +29,7 @@ import static org.mockito.Mockito.when;
import java.io.File;
import java.io.FileOutputStream;
+import java.io.InputStream;
import java.io.IOException;
import java.util.HashMap;
@@ -52,6 +53,7 @@ import org.apache.hadoop.mapreduce.TaskID;
import org.apache.hadoop.mapreduce.TaskType;
import org.apache.hadoop.mapreduce.TypeConverter;
import org.apache.hadoop.mapreduce.util.JobHistoryEventUtils;
+import org.apache.hadoop.mapreduce.util.MRJobConfUtil;
import org.apache.hadoop.mapreduce.v2.api.records.JobId;
import org.apache.hadoop.mapreduce.v2.app.AppContext;
import org.apache.hadoop.mapreduce.v2.app.MRAppMaster.RunningAppContext;
@@ -372,6 +374,74 @@ public class TestJobHistoryEventHandler {
}
}
+ @Test
+ public void testPropertyRedactionForJHS() throws Exception {
+ final Configuration conf = new Configuration();
+
+ String sensitivePropertyName = "aws.fake.credentials.name";
+ String sensitivePropertyValue = "aws.fake.credentials.val";
+ conf.set(sensitivePropertyName, sensitivePropertyValue);
+ conf.set(MRJobConfig.MR_JOB_REDACTED_PROPERTIES,
+ sensitivePropertyName);
+ conf.set(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY,
+ dfsCluster.getURI().toString());
+ final TestParams params = new TestParams();
+ conf.set(MRJobConfig.MR_AM_STAGING_DIR, params.dfsWorkDir);
+
+ final JHEvenHandlerForTest jheh =
+ new JHEvenHandlerForTest(params.mockAppContext, 0, false);
+
+ try {
+ jheh.init(conf);
+ jheh.start();
+ handleEvent(jheh, new JobHistoryEvent(params.jobId,
+ new AMStartedEvent(params.appAttemptId, 200, params.containerId,
+ "nmhost", 3000, 4000, -1)));
+ handleEvent(jheh, new JobHistoryEvent(params.jobId,
+ new JobUnsuccessfulCompletionEvent(TypeConverter.fromYarn(
+ params.jobId), 0, 0, 0, JobStateInternal.FAILED.toString())));
+
+ // verify the value of the sensitive property in job.xml is restored.
+ Assert.assertEquals(sensitivePropertyName + " is modified.",
+ conf.get(sensitivePropertyName), sensitivePropertyValue);
+
+ // load the job_conf.xml in JHS directory and verify property redaction.
+ Path jhsJobConfFile = getJobConfInIntermediateDoneDir(conf, params.jobId);
+ Assert.assertTrue("The job_conf.xml file is not in the JHS directory",
+ FileContext.getFileContext(conf).util().exists(jhsJobConfFile));
+ Configuration jhsJobConf = new Configuration();
+
+ try (InputStream input = FileSystem.get(conf).open(jhsJobConfFile)) {
+ jhsJobConf.addResource(input);
+ Assert.assertEquals(
+ sensitivePropertyName + " is not redacted in HDFS.",
+ MRJobConfUtil.REDACTION_REPLACEMENT_VAL,
+ jhsJobConf.get(sensitivePropertyName));
+ }
+ } finally {
+ jheh.stop();
+ purgeHdfsHistoryIntermediateDoneDirectory(conf);
+ }
+ }
+
+ private static Path getJobConfInIntermediateDoneDir(Configuration conf,
+ JobId jobId) throws IOException {
+ Path userDoneDir = new Path(
+ JobHistoryUtils.getHistoryIntermediateDoneDirForUser(conf));
+ Path doneDirPrefix =
+ FileContext.getFileContext(conf).makeQualified(userDoneDir);
+ return new Path(
+ doneDirPrefix, JobHistoryUtils.getIntermediateConfFileName(jobId));
+ }
+
+ private void purgeHdfsHistoryIntermediateDoneDirectory(Configuration conf)
+ throws IOException {
+ FileSystem fs = FileSystem.get(dfsCluster.getConfiguration(0));
+ String intermDoneDirPrefix =
+ JobHistoryUtils.getConfiguredHistoryIntermediateDoneDirPrefix(conf);
+ fs.delete(new Path(intermDoneDirPrefix), true);
+ }
+
@Test (timeout=50000)
public void testDefaultFsIsUsedForHistory() throws Exception {
// Create default configuration pointing to the minicluster
@@ -413,6 +483,7 @@ public class TestJobHistoryEventHandler {
localFileSystem.exists(new Path(t.dfsWorkDir)));
} finally {
jheh.stop();
+ purgeHdfsHistoryIntermediateDoneDirectory(conf);
}
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/4aba8587/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/webapp/TestBlocks.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/webapp/TestBlocks.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/webapp/TestBlocks.java
index 0e250f4..82b8a37 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/webapp/TestBlocks.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/webapp/TestBlocks.java
@@ -23,6 +23,8 @@ import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
+import org.apache.hadoop.mapreduce.MRJobConfig;
+import org.apache.hadoop.mapreduce.util.MRJobConfUtil;
import org.apache.hadoop.yarn.webapp.View;
import org.junit.Test;
import org.apache.hadoop.conf.Configuration;
@@ -65,6 +67,9 @@ public class TestBlocks {
Path path = new Path("conf");
Configuration configuration = new Configuration();
configuration.set("Key for test", "Value for test");
+ final String redactedProp = "Key for redaction";
+ configuration.set(MRJobConfig.MR_JOB_REDACTED_PROPERTIES,
+ redactedProp);
when(job.getConfFile()).thenReturn(path);
when(job.loadConfFile()).thenReturn(configuration);
@@ -85,9 +90,10 @@ public class TestBlocks {
configurationBlock.render(html);
pWriter.flush();
assertTrue(data.toString().contains("Key for test"));
-
assertTrue(data.toString().contains("Value for test"));
-
+ assertTrue(data.toString().contains(redactedProp));
+ assertTrue(data.toString().contains(
+ MRJobConfUtil.REDACTION_REPLACEMENT_VAL));
}
/**
http://git-wip-us.apache.org/repos/asf/hadoop/blob/4aba8587/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/MRJobConfig.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/MRJobConfig.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/MRJobConfig.java
index be47bfc..53e4b38 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/MRJobConfig.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/MRJobConfig.java
@@ -977,4 +977,9 @@ public interface MRJobConfig {
public static final String MR_NUM_OPPORTUNISTIC_MAPS_PER_100 =
"mapreduce.job.num-opportunistic-maps-per-100";
public static final int DEFAULT_MR_NUM_OPPORTUNISTIC_MAPS_PER_100 = 0;
+
+ /**
+ * A comma-separated list of properties whose value will be redacted.
+ */
+ String MR_JOB_REDACTED_PROPERTIES = "mapreduce.job.redacted-properties";
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/4aba8587/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/util/MRJobConfUtil.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/util/MRJobConfUtil.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/util/MRJobConfUtil.java
new file mode 100644
index 0000000..11d49a4
--- /dev/null
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/util/MRJobConfUtil.java
@@ -0,0 +1,45 @@
+/**
+ * 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.hadoop.mapreduce.util;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.mapreduce.MRJobConfig;
+
+/**
+ * A class that contains utility methods for MR Job configuration.
+ */
+public final class MRJobConfUtil {
+ public static final String REDACTION_REPLACEMENT_VAL = "*********(redacted)";
+
+ /**
+ * Redact job configuration properties.
+ * @param conf the job configuration to redact
+ */
+ public static void redact(final Configuration conf) {
+ for (String prop : conf.getTrimmedStringCollection(
+ MRJobConfig.MR_JOB_REDACTED_PROPERTIES)) {
+ conf.set(prop, REDACTION_REPLACEMENT_VAL);
+ }
+ }
+
+ /**
+ * There is no reason to instantiate this utility class.
+ */
+ private MRJobConfUtil() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/4aba8587/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml
index 1741d88..8ba0ec9 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml
@@ -1932,4 +1932,12 @@
<name>mapreduce.jobhistory.loadedjob.tasks.max</name>
<value>-1</value>
</property>
+
+<property>
+ <description>
+ The list of job configuration properties whose value will be redacted.
+ </description>
+ <name>mapreduce.job.redacted-properties</name>
+ <value></value>
+</property>
</configuration>
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[05/50] [abbrv] hadoop git commit: HADOOP-13418. Fix javadoc warnings
by JDK8 in hadoop-nfs package. Contributed by Kai Sasaki.
Posted by wa...@apache.org.
HADOOP-13418. Fix javadoc warnings by JDK8 in hadoop-nfs package. Contributed by Kai Sasaki.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/10ed06a0
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/10ed06a0
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/10ed06a0
Branch: refs/heads/YARN-3368
Commit: 10ed06a0c96cbb8b70e03deeb5bb94df700f9518
Parents: 49ba09a
Author: Masatake Iwasaki <iw...@apache.org>
Authored: Sat Aug 6 12:22:02 2016 +0900
Committer: Masatake Iwasaki <iw...@apache.org>
Committed: Sat Aug 6 12:22:02 2016 +0900
----------------------------------------------------------------------
.../org/apache/hadoop/mount/MountInterface.java | 47 +++++-
.../org/apache/hadoop/mount/MountResponse.java | 26 +++-
.../org/apache/hadoop/mount/MountdBase.java | 4 +-
.../java/org/apache/hadoop/nfs/NfsExports.java | 1 +
.../java/org/apache/hadoop/nfs/NfsTime.java | 1 +
.../org/apache/hadoop/nfs/nfs3/FileHandle.java | 1 +
.../apache/hadoop/nfs/nfs3/Nfs3Constant.java | 6 +-
.../apache/hadoop/nfs/nfs3/Nfs3Interface.java | 151 ++++++++++++++++---
.../hadoop/nfs/nfs3/request/NFS3Request.java | 1 +
.../hadoop/nfs/nfs3/response/NFS3Response.java | 4 +
.../org/apache/hadoop/oncrpc/RpcCallCache.java | 24 ++-
.../org/apache/hadoop/oncrpc/RpcProgram.java | 6 +
.../main/java/org/apache/hadoop/oncrpc/XDR.java | 20 ++-
.../hadoop/oncrpc/security/Credentials.java | 2 +
.../hadoop/oncrpc/security/RpcAuthInfo.java | 9 +-
.../hadoop/oncrpc/security/SecurityHandler.java | 34 ++++-
.../apache/hadoop/oncrpc/security/Verifier.java | 10 +-
17 files changed, 296 insertions(+), 51 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/10ed06a0/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountInterface.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountInterface.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountInterface.java
index 7002d53..9d2693d 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountInterface.java
+++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountInterface.java
@@ -43,7 +43,10 @@ public interface MountInterface {
return ordinal();
}
- /** @return the procedure corresponding to the value. */
+ /** The procedure of given value.
+ * @param value specifies the procedure index
+ * @return the procedure corresponding to the value.
+ */
public static MNTPROC fromValue(int value) {
if (value < 0 || value >= values().length) {
return null;
@@ -52,19 +55,51 @@ public interface MountInterface {
}
}
- /** MNTPROC_NULL - Do Nothing */
+ /**
+ * MNTPRC_NULL - Do Nothing.
+ * @param out XDR response used in NFS protocol
+ * @param xid transaction id
+ * @param client represents IP address
+ * @return XDR response
+ */
public XDR nullOp(XDR out, int xid, InetAddress client);
- /** MNTPROC_MNT - Add mount entry */
+ /**
+ * MNTPROC_MNT - Add mount entry.
+ * @param xdr XDR message used in NFS protocol
+ * @param out XDR response used in NFS protocol
+ * @param xid transaction id
+ * @param client represents IP address
+ * @return XDR response
+ */
public XDR mnt(XDR xdr, XDR out, int xid, InetAddress client);
- /** MNTPROC_DUMP - Return mount entries */
+ /**
+ * MNTPROC_DUMP - Return mount entries.
+ * @param out XDR response used in NFS protocol
+ * @param xid transaction id
+ * @param client represents IP address
+ * @return XDR response
+ */
public XDR dump(XDR out, int xid, InetAddress client);
- /** MNTPROC_UMNT - Remove mount entry */
+ /**
+ * MNTPROC_UMNT - Remove mount entry.
+ * @param xdr XDR message used in NFS protocol
+ * @param out XDR response used in NFS protocol
+ * @param xid transaction id
+ * @param client represents IP address
+ * @return XDR response
+ */
public XDR umnt(XDR xdr, XDR out, int xid, InetAddress client);
- /** MNTPROC_UMNTALL - Remove all mount entries */
+ /**
+ * MNTPROC_UMNTALL - Remove all mount entries.
+ * @param out XDR response used in NFS protocol
+ * @param xid transaction id
+ * @param client represents IP address
+ * @return XDR response
+ */
public XDR umntall(XDR out, int xid, InetAddress client);
/** MNTPROC_EXPORT and MNTPROC_EXPORTALL - Return export list */
http://git-wip-us.apache.org/repos/asf/hadoop/blob/10ed06a0/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountResponse.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountResponse.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountResponse.java
index a073f87..07b779e 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountResponse.java
+++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountResponse.java
@@ -36,7 +36,14 @@ public class MountResponse {
private MountResponse() {
}
- /** Response for RPC call {@link MountInterface.MNTPROC#MNT} */
+ /**
+ * Response for RPC call {@link MountInterface.MNTPROC#MNT}.
+ * @param status status of mount response
+ * @param xdr XDR message object
+ * @param xid transaction id
+ * @param handle file handle
+ * @return response XDR
+ */
public static XDR writeMNTResponse(int status, XDR xdr, int xid,
byte[] handle) {
RpcAcceptedReply.getAcceptInstance(xid, new VerifierNone()).write(xdr);
@@ -50,7 +57,13 @@ public class MountResponse {
return xdr;
}
- /** Response for RPC call {@link MountInterface.MNTPROC#DUMP} */
+ /**
+ * Response for RPC call {@link MountInterface.MNTPROC#DUMP}.
+ * @param xdr XDR message object
+ * @param xid transaction id
+ * @param mounts mount entries
+ * @return response XDR
+ */
public static XDR writeMountList(XDR xdr, int xid, List<MountEntry> mounts) {
RpcAcceptedReply.getAcceptInstance(xid, new VerifierNone()).write(xdr);
for (MountEntry mountEntry : mounts) {
@@ -62,7 +75,14 @@ public class MountResponse {
return xdr;
}
- /** Response for RPC call {@link MountInterface.MNTPROC#EXPORT} */
+ /**
+ * Response for RPC call {@link MountInterface.MNTPROC#EXPORT}.
+ * @param xdr XDR message object
+ * @param xid transaction id
+ * @param exports export list
+ * @param hostMatcher the list of export host
+ * @return response XDR
+ */
public static XDR writeExportList(XDR xdr, int xid, List<String> exports,
List<NfsExports> hostMatcher) {
assert (exports.size() == hostMatcher.size());
http://git-wip-us.apache.org/repos/asf/hadoop/blob/10ed06a0/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountdBase.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountdBase.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountdBase.java
index 92ca7ec..1ef0085 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountdBase.java
+++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountdBase.java
@@ -48,8 +48,8 @@ abstract public class MountdBase {
/**
* Constructor
- * @param program
- * @throws IOException
+ * @param program rpc server which handles mount request
+ * @throws IOException fail to construct MountdBase
*/
public MountdBase(RpcProgram program) throws IOException {
rpcProgram = program;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/10ed06a0/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/NfsExports.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/NfsExports.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/NfsExports.java
index af96565..a299ff0 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/NfsExports.java
+++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/NfsExports.java
@@ -172,6 +172,7 @@ public class NfsExports {
/**
* Return the configured group list
+ * @return host group list
*/
public String[] getHostGroupList() {
int listSize = mMatches.size();
http://git-wip-us.apache.org/repos/asf/hadoop/blob/10ed06a0/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/NfsTime.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/NfsTime.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/NfsTime.java
index 8a76667..3caf720 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/NfsTime.java
+++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/NfsTime.java
@@ -54,6 +54,7 @@ public class NfsTime {
/**
* Get the total time in milliseconds
+ * @return convert to milli seconds
*/
public long getMilliSeconds() {
return (long) (seconds) * 1000 + (long) (nseconds) / 1000000;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/10ed06a0/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/FileHandle.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/FileHandle.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/FileHandle.java
index f58c8b3..bff5eec 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/FileHandle.java
+++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/FileHandle.java
@@ -45,6 +45,7 @@ public class FileHandle {
/**
* Handle is a 32 bytes number. For HDFS, the last 8 bytes is fileId.
+ * @param v file id
*/
public FileHandle(long v) {
fileId = v;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/10ed06a0/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Constant.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Constant.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Constant.java
index 6ab6f6f..de587a6 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Constant.java
+++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Constant.java
@@ -76,7 +76,11 @@ public class Nfs3Constant {
return ordinal();
}
- /** @return the procedure corresponding to the value. */
+ /**
+ * Convert to NFS procedure.
+ * @param value specify the index of NFS procedure
+ * @return the procedure corresponding to the value.
+ */
public static NFSPROC3 fromValue(int value) {
if (value < 0 || value >= values().length) {
return null;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/10ed06a0/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Interface.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Interface.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Interface.java
index 9bca9e7..b54785d 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Interface.java
+++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Interface.java
@@ -26,69 +26,176 @@ import org.apache.hadoop.oncrpc.XDR;
*/
public interface Nfs3Interface {
- /** NULL: Do nothing */
+ /**
+ * NULL: Do nothing.
+ * @return null NFS procedure
+ */
public NFS3Response nullProcedure();
- /** GETATTR: Get file attributes */
+ /**
+ * GETATTR: Get file attributes.
+ * @param xdr XDR message
+ * @param info context of rpc message
+ * @return NFSv3 response
+ */
public NFS3Response getattr(XDR xdr, RpcInfo info);
- /** SETATTR: Set file attributes */
+ /**
+ * SETATTR: Set file attributes.
+ * @param xdr XDR message
+ * @param info context of rpc message
+ * @return NFSv3 response
+ */
public NFS3Response setattr(XDR xdr, RpcInfo info);
- /** LOOKUP: Lookup filename */
+ /**
+ * LOOKUP: Lookup filename.
+ * @param xdr XDR message
+ * @param info context of rpc message
+ * @return NFSv3 response
+ */
public NFS3Response lookup(XDR xdr, RpcInfo info);
- /** ACCESS: Check access permission */
+ /**
+ * ACCESS: Check access permission.
+ * @param xdr XDR message
+ * @param info context of rpc message
+ * @return NFSv3 response
+ */
public NFS3Response access(XDR xdr, RpcInfo info);
- /** READLINK: Read from symbolic link */
+ /** READLINK: Read from symbolic link.
+ * @param xdr XDR message
+ * @param info context of rpc message
+ * @return NFSv3 response
+ */
public NFS3Response readlink(XDR xdr, RpcInfo info);
- /** READ: Read from file */
+ /**
+ * READ: Read from file.
+ * @param xdr XDR message
+ * @param info context of rpc message
+ * @return NFSv3 response
+ */
public NFS3Response read(XDR xdr, RpcInfo info);
- /** WRITE: Write to file */
+ /**
+ * WRITE: Write to file.
+ * @param xdr XDR message
+ * @param info context of rpc message
+ * @return NFSv3 response
+ */
public NFS3Response write(XDR xdr, RpcInfo info);
- /** CREATE: Create a file */
+ /**
+ * CREATE: Create a file.
+ * @param xdr XDR message
+ * @param info context of rpc message
+ * @return NFSv3 response
+ */
public NFS3Response create(XDR xdr, RpcInfo info);
- /** MKDIR: Create a directory */
+ /**
+ * MKDIR: Create a directory.
+ * @param xdr XDR message
+ * @param info context of rpc message
+ * @return NFSv3 response
+ */
public NFS3Response mkdir(XDR xdr, RpcInfo info);
- /** SYMLINK: Create a symbolic link */
+ /**
+ * SYMLINK: Create a symbolic link.
+ * @param xdr XDR message
+ * @param info context of rpc message
+ * @return NFSv3 response
+ */
public NFS3Response symlink(XDR xdr, RpcInfo info);
- /** MKNOD: Create a special device */
+ /**
+ * MKNOD: Create a special device.
+ * @param xdr XDR message
+ * @param info context of rpc message
+ * @return NFSv3 response
+ */
public NFS3Response mknod(XDR xdr, RpcInfo info);
- /** REMOVE: Remove a file */
+ /**
+ * REMOVE: Remove a file.
+ * @param xdr XDR message
+ * @param info context of rpc message
+ * @return NFSv3 response
+ */
public NFS3Response remove(XDR xdr, RpcInfo info);
- /** RMDIR: Remove a directory */
+ /**
+ * RMDIR: Remove a directory.
+ * @param xdr XDR message
+ * @param info context of rpc message
+ * @return NFSv3 response
+ */
public NFS3Response rmdir(XDR xdr, RpcInfo info);
- /** RENAME: Rename a file or directory */
+ /**
+ * RENAME: Rename a file or directory.
+ * @param xdr XDR message
+ * @param info context of rpc message
+ * @return NFSv3 response
+ */
public NFS3Response rename(XDR xdr, RpcInfo info);
- /** LINK: create link to an object */
+ /**
+ * LINK: create link to an object.
+ * @param xdr XDR message
+ * @param info context of rpc message
+ * @return NFSv3 response
+ */
public NFS3Response link(XDR xdr, RpcInfo info);
- /** READDIR: Read From directory */
+ /**
+ * READDIR: Read From directory.
+ * @param xdr XDR message
+ * @param info context of rpc message
+ * @return NFSv3 response
+ */
public NFS3Response readdir(XDR xdr, RpcInfo info);
- /** READDIRPLUS: Extended read from directory */
+ /**
+ * READDIRPLUS: Extended read from directory.
+ * @param xdr XDR message
+ * @param info context of rpc message
+ * @return NFSv3 response
+ */
public NFS3Response readdirplus(XDR xdr, RpcInfo info);
- /** FSSTAT: Get dynamic file system information */
+ /**
+ * FSSTAT: Get dynamic file system information.
+ * @param xdr XDR message
+ * @param info context of rpc message
+ * @return NFSv3 response
+ */
public NFS3Response fsstat(XDR xdr, RpcInfo info);
- /** FSINFO: Get static file system information */
+ /**
+ * FSINFO: Get static file system information.
+ * @param xdr XDR message
+ * @param info context of rpc message
+ * @return NFSv3 response
+ */
public NFS3Response fsinfo(XDR xdr, RpcInfo info);
- /** PATHCONF: Retrieve POSIX information */
+ /**
+ * PATHCONF: Retrieve POSIX information.
+ * @param xdr XDR message
+ * @param info context of rpc message
+ * @return NFSv3 response
+ */
public NFS3Response pathconf(XDR xdr, RpcInfo info);
- /** COMMIT: Commit cached data on a server to stable storage */
+ /**
+ * COMMIT: Commit cached data on a server to stable storage.
+ * @param xdr XDR message
+ * @param info context of rpc message
+ * @return NFSv3 response
+ */
public NFS3Response commit(XDR xdr, RpcInfo info);
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/10ed06a0/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/request/NFS3Request.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/request/NFS3Request.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/request/NFS3Request.java
index cffa215..b8e7a9b 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/request/NFS3Request.java
+++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/request/NFS3Request.java
@@ -40,6 +40,7 @@ public abstract class NFS3Request {
/**
* Subclass should implement. Usually handle is the first to be serialized
+ * @param xdr XDR message
*/
public abstract void serialize(XDR xdr);
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/10ed06a0/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/response/NFS3Response.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/response/NFS3Response.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/response/NFS3Response.java
index 2a2a1e4..98a9db3 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/response/NFS3Response.java
+++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/response/NFS3Response.java
@@ -43,6 +43,10 @@ public class NFS3Response {
/**
* Write the response, along with the rpc header (including verifier), to the
* XDR.
+ * @param out XDR output message
+ * @param xid transaction id
+ * @param verifier verifies reply
+ * @return XDR response
*/
public XDR serialize(XDR out, int xid, Verifier verifier) {
RpcAcceptedReply reply = RpcAcceptedReply.getAcceptInstance(xid, verifier);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/10ed06a0/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcCallCache.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcCallCache.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcCallCache.java
index 0c857be..2d6f30e 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcCallCache.java
+++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcCallCache.java
@@ -122,12 +122,20 @@ public class RpcCallCache {
};
}
- /** Return the program name */
+ /**
+ * Return the program name.
+ * @return RPC program name
+ */
public String getProgram() {
return program;
}
- /** Mark a request as completed and add corresponding response to the cache */
+ /**
+ * Mark a request as completed and add corresponding response to the cache.
+ * @param clientId client IP address
+ * @param xid transaction id
+ * @param response RPC response
+ */
public void callCompleted(InetAddress clientId, int xid, RpcResponse response) {
ClientRequest req = new ClientRequest(clientId, xid);
CacheEntry e;
@@ -140,6 +148,9 @@ public class RpcCallCache {
/**
* Check the cache for an entry. If it does not exist, add the request
* as in progress.
+ * @param clientId client IP address
+ * @param xid transaction id
+ * @return cached entry
*/
public CacheEntry checkOrAddToCache(InetAddress clientId, int xid) {
ClientRequest req = new ClientRequest(clientId, xid);
@@ -154,14 +165,17 @@ public class RpcCallCache {
return e;
}
- /** Return number of cached entries */
+ /**
+ * Return number of cached entries.
+ * @return cache size
+ */
public int size() {
return map.size();
}
/**
- * Iterator to the cache entries
- * @return iterator
+ * Iterator to the cache entries.
+ * @return iterator cache iterator
*/
@VisibleForTesting
public Iterator<Entry<ClientRequest, CacheEntry>> iterator() {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/10ed06a0/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcProgram.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcProgram.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcProgram.java
index b782ae5..cebfcfa 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcProgram.java
+++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcProgram.java
@@ -87,6 +87,8 @@ public abstract class RpcProgram extends SimpleChannelUpstreamHandler {
/**
* Register this program with the local portmapper.
+ * @param transport transport layer for port map
+ * @param boundPort port number of bounded RPC program
*/
public void register(int transport, int boundPort) {
if (boundPort != port) {
@@ -104,6 +106,8 @@ public abstract class RpcProgram extends SimpleChannelUpstreamHandler {
/**
* Unregister this program with the local portmapper.
+ * @param transport transport layer for port map
+ * @param boundPort port number of bounded RPC program
*/
public void unregister(int transport, int boundPort) {
if (boundPort != port) {
@@ -121,6 +125,8 @@ public abstract class RpcProgram extends SimpleChannelUpstreamHandler {
/**
* Register the program with Portmap or Rpcbind
+ * @param mapEntry port map entries
+ * @param set specifies registration or not
*/
protected void register(PortmapMapping mapEntry, boolean set) {
XDR mappingRequest = PortmapRequest.create(mapEntry, set);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/10ed06a0/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/XDR.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/XDR.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/XDR.java
index b135388..acdc51c 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/XDR.java
+++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/XDR.java
@@ -219,7 +219,12 @@ public final class XDR {
}
}
- /** check if the rest of data has more than len bytes */
+ /**
+ * check if the rest of data has more than len bytes.
+ * @param xdr XDR message
+ * @param len minimum remaining length
+ * @return specify remaining length is enough or not
+ */
public static boolean verifyLength(XDR xdr, int len) {
return xdr.buf.remaining() >= len;
}
@@ -231,7 +236,12 @@ public final class XDR {
return b;
}
- /** Write an XDR message to a TCP ChannelBuffer */
+ /**
+ * Write an XDR message to a TCP ChannelBuffer.
+ * @param request XDR request
+ * @param last specifies last request or not
+ * @return TCP buffer
+ */
public static ChannelBuffer writeMessageTcp(XDR request, boolean last) {
Preconditions.checkState(request.state == XDR.State.WRITING);
ByteBuffer b = request.buf.duplicate();
@@ -243,7 +253,11 @@ public final class XDR {
return ChannelBuffers.copiedBuffer(headerBuf, b);
}
- /** Write an XDR message to a UDP ChannelBuffer */
+ /**
+ * Write an XDR message to a UDP ChannelBuffer.
+ * @param response XDR response
+ * @return UDP buffer
+ */
public static ChannelBuffer writeMessageUdp(XDR response) {
Preconditions.checkState(response.state == XDR.State.READING);
// TODO: Investigate whether making a copy of the buffer is necessary.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/10ed06a0/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/Credentials.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/Credentials.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/Credentials.java
index 639a1e5..fe4350b 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/Credentials.java
+++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/Credentials.java
@@ -48,6 +48,8 @@ public abstract class Credentials extends RpcAuthInfo {
/**
* Write AuthFlavor and the credentials to the XDR
+ * @param cred credentials
+ * @param xdr XDR message
*/
public static void writeFlavorAndCredentials(Credentials cred, XDR xdr) {
if (cred instanceof CredentialsNone) {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/10ed06a0/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/RpcAuthInfo.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/RpcAuthInfo.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/RpcAuthInfo.java
index 65ebd30..5244272 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/RpcAuthInfo.java
+++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/RpcAuthInfo.java
@@ -57,10 +57,15 @@ public abstract class RpcAuthInfo {
this.flavor = flavor;
}
- /** Load auth info */
+ /**
+ * Load auth info.
+ * @param xdr XDR message
+ */
public abstract void read(XDR xdr);
- /** Write auth info */
+ /** Write auth info.
+ * @param xdr XDR message
+ */
public abstract void write(XDR xdr);
public AuthFlavor getFlavor() {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/10ed06a0/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/SecurityHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/SecurityHandler.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/SecurityHandler.java
index 063082e..93efba8 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/SecurityHandler.java
+++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/SecurityHandler.java
@@ -41,27 +41,51 @@ public abstract class SecurityHandler {
return false;
}
- /** Used by GSS */
+ /**
+ * Used by GSS.
+ * @param request RPC request
+ * @param data request data
+ * @throws IOException fail to unwrap RPC call
+ * @return XDR response
+ */
public XDR unwrap(RpcCall request, byte[] data ) throws IOException {
throw new UnsupportedOperationException();
}
- /** Used by GSS */
+ /**
+ * Used by GSS.
+ * @param request RPC request
+ * @param response RPC response
+ * @throws IOException fail to wrap RPC call
+ * @return response byte buffer
+ */
public byte[] wrap(RpcCall request, XDR response) throws IOException {
throw new UnsupportedOperationException();
}
- /** Used by AUTH_SYS */
+ /**
+ * Used by AUTH_SYS.
+ * Return the uid of the NFS user credential.
+ * @return uid
+ */
public int getUid() {
throw new UnsupportedOperationException();
}
- /** Used by AUTH_SYS */
+ /**
+ * Used by AUTH_SYS.
+ * Return the gid of the NFS user credential.
+ * @return gid
+ */
public int getGid() {
throw new UnsupportedOperationException();
}
- /** Used by AUTH_SYS */
+ /**
+ * Used by AUTH_SYS.
+ * Return the auxiliary gids of the NFS user credential.
+ * @return auxiliary gids
+ */
public int[] getAuxGids() {
throw new UnsupportedOperationException();
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/10ed06a0/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/Verifier.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/Verifier.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/Verifier.java
index e60db97..f3202a1 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/Verifier.java
+++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/Verifier.java
@@ -33,7 +33,11 @@ public abstract class Verifier extends RpcAuthInfo {
super(flavor);
}
- /** Read both AuthFlavor and the verifier from the XDR */
+ /**
+ * Read both AuthFlavor and the verifier from the XDR.
+ * @param xdr XDR message
+ * @return verifier
+ */
public static Verifier readFlavorAndVerifier(XDR xdr) {
AuthFlavor flavor = AuthFlavor.fromValue(xdr.readInt());
final Verifier verifer;
@@ -50,7 +54,9 @@ public abstract class Verifier extends RpcAuthInfo {
}
/**
- * Write AuthFlavor and the verifier to the XDR
+ * Write AuthFlavor and the verifier to the XDR.
+ * @param verifier written to XDR
+ * @param xdr XDR message
*/
public static void writeFlavorAndVerifier(Verifier verifier, XDR xdr) {
if (verifier instanceof VerifierNone) {
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org