You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by st...@apache.org on 2015/11/01 12:49:18 UTC
[06/14] incubator-slider git commit: SLIDER-947 build node map from
yarn update reports; serve via REST/IPC. API done;
now trying to make sure RM notifies AM of state, which is being checked via
new metrics
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3aeab9ca/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java b/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
index 7425c2d..115405c 100644
--- a/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
+++ b/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
@@ -23,6 +23,8 @@ import org.apache.commons.io.IOUtils;
import org.apache.slider.api.types.ApplicationLivenessInformation;
import org.apache.slider.api.types.ComponentInformation;
import org.apache.slider.api.types.ContainerInformation;
+import org.apache.slider.api.types.NodeEntryInformation;
+import org.apache.slider.api.types.NodeInformation;
import org.apache.slider.core.conf.AggregateConf;
import org.apache.slider.core.conf.ConfTree;
import org.apache.slider.core.conf.ConfTreeOperations;
@@ -137,6 +139,79 @@ public class RestTypeMarshalling {
return builder.build();
}
+ public static Messages.NodeInformationProto marshall(NodeInformation info) {
+
+ Messages.NodeInformationProto.Builder builder =
+ Messages.NodeInformationProto.newBuilder();
+ builder.setHostname(info.hostname);
+ builder.setLastUpdated(info.lastUpdated);
+ if (info.state != null) {
+ builder.setState(info.state);
+ }
+ if (info.rackName != null) {
+ builder.setRackName(info.rackName);
+ }
+ if (info.healthReport != null) {
+ builder.setHealthReport(info.healthReport);
+ }
+ if (info.httpAddress != null) {
+ builder.setHttpAddress(info.httpAddress);
+ }
+ if (info.labels != null) {
+ builder.setLabels(info.labels);
+ }
+
+ List<NodeEntryInformation> entries = info.entries;
+ if (entries != null) {
+ for (NodeEntryInformation entry : entries) {
+ Messages.NodeEntryInformationProto.Builder node =
+ Messages.NodeEntryInformationProto.newBuilder();
+ node.setFailed(entry.failed);
+ node.setFailedRecently(entry.failedRecently);
+ node.setLive(entry.live);
+ node.setLastUsed(entry.lastUsed);
+ node.setPreempted(entry.preempted);
+ node.setPriority(entry.priority);
+ node.setRequested(entry.requested);
+ node.setReleasing(entry.releasing);
+ node.setStartFailed(entry.startFailed);
+ node.setStarting(entry.starting);
+ builder.addEntries(node.build());
+ }
+ }
+ return builder.build();
+ }
+
+ public static NodeInformation unmarshall(Messages.NodeInformationProto wire) {
+ NodeInformation info = new NodeInformation();
+ info.healthReport = wire.getHealthReport();
+ info.hostname = wire.getHostname();
+ info.httpAddress = wire.getHttpAddress();
+ info.labels = wire.getLabels();
+ info.lastUpdated = wire.getLastUpdated();
+ info.rackName = wire.getRackName();
+ info.state = wire.getState();
+ List<Messages.NodeEntryInformationProto> entriesList = wire.getEntriesList();
+ if (entriesList != null) {
+ info.entries = new ArrayList<>(entriesList.size());
+ for (Messages.NodeEntryInformationProto entry : entriesList) {
+ NodeEntryInformation nei = new NodeEntryInformation();
+ nei.failed = entry.getFailed();
+ nei.failedRecently = entry.getFailedRecently();
+ nei.lastUsed = entry.getLastUsed();
+ nei.live = entry.getLive();
+ nei.preempted = entry.getPreempted();
+ nei.priority = entry.getPriority();
+ nei.requested = entry.getRequested();
+ nei.releasing = entry.getReleasing();
+ nei.startFailed = entry.getStartFailed();
+ nei.starting = entry.getStarting();
+ info.entries.add(nei);
+ }
+ }
+ return info;
+ }
+
public static ContainerInformation unmarshall(Messages.ContainerInformationProto wire) {
ContainerInformation info = new ContainerInformation();
info.containerId = wire.getContainerId();
@@ -169,19 +244,15 @@ public class RestTypeMarshalling {
return info;
}
- public static List<ContainerInformation> unmarshall(
- Messages.GetLiveContainersResponseProto wire) {
- List<ContainerInformation> infoList = new ArrayList<ContainerInformation>(
- wire.getContainersList().size());
- for (Messages.ContainerInformationProto container : wire
- .getContainersList()) {
+ public static List<ContainerInformation> unmarshall(Messages.GetLiveContainersResponseProto wire) {
+ List<ContainerInformation> infoList = new ArrayList<>(wire.getContainersList().size());
+ for (Messages.ContainerInformationProto container : wire.getContainersList()) {
infoList.add(unmarshall(container));
}
return infoList;
}
- public static Messages.ContainerInformationProto
- marshall(ContainerInformation info) {
+ public static Messages.ContainerInformationProto marshall(ContainerInformation info) {
Messages.ContainerInformationProto.Builder builder =
Messages.ContainerInformationProto.newBuilder();
@@ -218,8 +289,7 @@ public class RestTypeMarshalling {
return builder.build();
}
- public static String
- unmarshall(Messages.WrappedJsonProto wire) {
+ public static String unmarshall(Messages.WrappedJsonProto wire) {
return wire.getJson();
}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3aeab9ca/slider-core/src/main/java/org/apache/slider/api/proto/SliderClusterAPI.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/proto/SliderClusterAPI.java b/slider-core/src/main/java/org/apache/slider/api/proto/SliderClusterAPI.java
index 702c762..081b7fa 100644
--- a/slider-core/src/main/java/org/apache/slider/api/proto/SliderClusterAPI.java
+++ b/slider-core/src/main/java/org/apache/slider/api/proto/SliderClusterAPI.java
@@ -203,6 +203,22 @@ public final class SliderClusterAPI {
com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ComponentInformationProto> done);
/**
+ * <code>rpc getLiveNodes(.org.apache.slider.api.GetLiveNodesRequestProto) returns (.org.apache.slider.api.GetLiveNodesResponseProto);</code>
+ */
+ public abstract void getLiveNodes(
+ com.google.protobuf.RpcController controller,
+ org.apache.slider.api.proto.Messages.GetLiveNodesRequestProto request,
+ com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto> done);
+
+ /**
+ * <code>rpc getLiveNode(.org.apache.slider.api.GetLiveNodeRequestProto) returns (.org.apache.slider.api.NodeInformationProto);</code>
+ */
+ public abstract void getLiveNode(
+ com.google.protobuf.RpcController controller,
+ org.apache.slider.api.proto.Messages.GetLiveNodeRequestProto request,
+ com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.NodeInformationProto> done);
+
+ /**
* <code>rpc getModelDesired(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
*
* <pre>
@@ -428,6 +444,22 @@ public final class SliderClusterAPI {
}
@java.lang.Override
+ public void getLiveNodes(
+ com.google.protobuf.RpcController controller,
+ org.apache.slider.api.proto.Messages.GetLiveNodesRequestProto request,
+ com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto> done) {
+ impl.getLiveNodes(controller, request, done);
+ }
+
+ @java.lang.Override
+ public void getLiveNode(
+ com.google.protobuf.RpcController controller,
+ org.apache.slider.api.proto.Messages.GetLiveNodeRequestProto request,
+ com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.NodeInformationProto> done) {
+ impl.getLiveNode(controller, request, done);
+ }
+
+ @java.lang.Override
public void getModelDesired(
com.google.protobuf.RpcController controller,
org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
@@ -546,20 +578,24 @@ public final class SliderClusterAPI {
case 15:
return impl.getLiveComponent(controller, (org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto)request);
case 16:
- return impl.getModelDesired(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
+ return impl.getLiveNodes(controller, (org.apache.slider.api.proto.Messages.GetLiveNodesRequestProto)request);
case 17:
- return impl.getModelDesiredAppconf(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
+ return impl.getLiveNode(controller, (org.apache.slider.api.proto.Messages.GetLiveNodeRequestProto)request);
case 18:
- return impl.getModelDesiredResources(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
+ return impl.getModelDesired(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
case 19:
- return impl.getModelResolved(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
+ return impl.getModelDesiredAppconf(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
case 20:
- return impl.getModelResolvedAppconf(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
+ return impl.getModelDesiredResources(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
case 21:
- return impl.getModelResolvedResources(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
+ return impl.getModelResolved(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
case 22:
- return impl.getLiveResources(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
+ return impl.getModelResolvedAppconf(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
case 23:
+ return impl.getModelResolvedResources(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
+ case 24:
+ return impl.getLiveResources(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
+ case 25:
return impl.getClientCertificateStore(controller, (org.apache.slider.api.proto.Messages.GetCertificateStoreRequestProto)request);
default:
throw new java.lang.AssertionError("Can't get here.");
@@ -608,9 +644,9 @@ public final class SliderClusterAPI {
case 15:
return org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto.getDefaultInstance();
case 16:
- return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
+ return org.apache.slider.api.proto.Messages.GetLiveNodesRequestProto.getDefaultInstance();
case 17:
- return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
+ return org.apache.slider.api.proto.Messages.GetLiveNodeRequestProto.getDefaultInstance();
case 18:
return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
case 19:
@@ -622,6 +658,10 @@ public final class SliderClusterAPI {
case 22:
return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
case 23:
+ return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
+ case 24:
+ return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
+ case 25:
return org.apache.slider.api.proto.Messages.GetCertificateStoreRequestProto.getDefaultInstance();
default:
throw new java.lang.AssertionError("Can't get here.");
@@ -670,9 +710,9 @@ public final class SliderClusterAPI {
case 15:
return org.apache.slider.api.proto.Messages.ComponentInformationProto.getDefaultInstance();
case 16:
- return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
+ return org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto.getDefaultInstance();
case 17:
- return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
+ return org.apache.slider.api.proto.Messages.NodeInformationProto.getDefaultInstance();
case 18:
return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
case 19:
@@ -684,6 +724,10 @@ public final class SliderClusterAPI {
case 22:
return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
case 23:
+ return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
+ case 24:
+ return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
+ case 25:
return org.apache.slider.api.proto.Messages.GetCertificateStoreResponseProto.getDefaultInstance();
default:
throw new java.lang.AssertionError("Can't get here.");
@@ -875,6 +919,22 @@ public final class SliderClusterAPI {
com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ComponentInformationProto> done);
/**
+ * <code>rpc getLiveNodes(.org.apache.slider.api.GetLiveNodesRequestProto) returns (.org.apache.slider.api.GetLiveNodesResponseProto);</code>
+ */
+ public abstract void getLiveNodes(
+ com.google.protobuf.RpcController controller,
+ org.apache.slider.api.proto.Messages.GetLiveNodesRequestProto request,
+ com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto> done);
+
+ /**
+ * <code>rpc getLiveNode(.org.apache.slider.api.GetLiveNodeRequestProto) returns (.org.apache.slider.api.NodeInformationProto);</code>
+ */
+ public abstract void getLiveNode(
+ com.google.protobuf.RpcController controller,
+ org.apache.slider.api.proto.Messages.GetLiveNodeRequestProto request,
+ com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.NodeInformationProto> done);
+
+ /**
* <code>rpc getModelDesired(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
*
* <pre>
@@ -1069,41 +1129,51 @@ public final class SliderClusterAPI {
done));
return;
case 16:
+ this.getLiveNodes(controller, (org.apache.slider.api.proto.Messages.GetLiveNodesRequestProto)request,
+ com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto>specializeCallback(
+ done));
+ return;
+ case 17:
+ this.getLiveNode(controller, (org.apache.slider.api.proto.Messages.GetLiveNodeRequestProto)request,
+ com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.NodeInformationProto>specializeCallback(
+ done));
+ return;
+ case 18:
this.getModelDesired(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request,
com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.WrappedJsonProto>specializeCallback(
done));
return;
- case 17:
+ case 19:
this.getModelDesiredAppconf(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request,
com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.WrappedJsonProto>specializeCallback(
done));
return;
- case 18:
+ case 20:
this.getModelDesiredResources(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request,
com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.WrappedJsonProto>specializeCallback(
done));
return;
- case 19:
+ case 21:
this.getModelResolved(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request,
com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.WrappedJsonProto>specializeCallback(
done));
return;
- case 20:
+ case 22:
this.getModelResolvedAppconf(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request,
com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.WrappedJsonProto>specializeCallback(
done));
return;
- case 21:
+ case 23:
this.getModelResolvedResources(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request,
com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.WrappedJsonProto>specializeCallback(
done));
return;
- case 22:
+ case 24:
this.getLiveResources(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request,
com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.WrappedJsonProto>specializeCallback(
done));
return;
- case 23:
+ case 25:
this.getClientCertificateStore(controller, (org.apache.slider.api.proto.Messages.GetCertificateStoreRequestProto)request,
com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.GetCertificateStoreResponseProto>specializeCallback(
done));
@@ -1155,9 +1225,9 @@ public final class SliderClusterAPI {
case 15:
return org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto.getDefaultInstance();
case 16:
- return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
+ return org.apache.slider.api.proto.Messages.GetLiveNodesRequestProto.getDefaultInstance();
case 17:
- return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
+ return org.apache.slider.api.proto.Messages.GetLiveNodeRequestProto.getDefaultInstance();
case 18:
return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
case 19:
@@ -1169,6 +1239,10 @@ public final class SliderClusterAPI {
case 22:
return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
case 23:
+ return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
+ case 24:
+ return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
+ case 25:
return org.apache.slider.api.proto.Messages.GetCertificateStoreRequestProto.getDefaultInstance();
default:
throw new java.lang.AssertionError("Can't get here.");
@@ -1217,9 +1291,9 @@ public final class SliderClusterAPI {
case 15:
return org.apache.slider.api.proto.Messages.ComponentInformationProto.getDefaultInstance();
case 16:
- return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
+ return org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto.getDefaultInstance();
case 17:
- return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
+ return org.apache.slider.api.proto.Messages.NodeInformationProto.getDefaultInstance();
case 18:
return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
case 19:
@@ -1231,6 +1305,10 @@ public final class SliderClusterAPI {
case 22:
return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
case 23:
+ return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
+ case 24:
+ return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
+ case 25:
return org.apache.slider.api.proto.Messages.GetCertificateStoreResponseProto.getDefaultInstance();
default:
throw new java.lang.AssertionError("Can't get here.");
@@ -1493,12 +1571,42 @@ public final class SliderClusterAPI {
org.apache.slider.api.proto.Messages.ComponentInformationProto.getDefaultInstance()));
}
+ public void getLiveNodes(
+ com.google.protobuf.RpcController controller,
+ org.apache.slider.api.proto.Messages.GetLiveNodesRequestProto request,
+ com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto> done) {
+ channel.callMethod(
+ getDescriptor().getMethods().get(16),
+ controller,
+ request,
+ org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto.getDefaultInstance(),
+ com.google.protobuf.RpcUtil.generalizeCallback(
+ done,
+ org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto.class,
+ org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto.getDefaultInstance()));
+ }
+
+ public void getLiveNode(
+ com.google.protobuf.RpcController controller,
+ org.apache.slider.api.proto.Messages.GetLiveNodeRequestProto request,
+ com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.NodeInformationProto> done) {
+ channel.callMethod(
+ getDescriptor().getMethods().get(17),
+ controller,
+ request,
+ org.apache.slider.api.proto.Messages.NodeInformationProto.getDefaultInstance(),
+ com.google.protobuf.RpcUtil.generalizeCallback(
+ done,
+ org.apache.slider.api.proto.Messages.NodeInformationProto.class,
+ org.apache.slider.api.proto.Messages.NodeInformationProto.getDefaultInstance()));
+ }
+
public void getModelDesired(
com.google.protobuf.RpcController controller,
org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
channel.callMethod(
- getDescriptor().getMethods().get(16),
+ getDescriptor().getMethods().get(18),
controller,
request,
org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance(),
@@ -1513,7 +1621,7 @@ public final class SliderClusterAPI {
org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
channel.callMethod(
- getDescriptor().getMethods().get(17),
+ getDescriptor().getMethods().get(19),
controller,
request,
org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance(),
@@ -1528,7 +1636,7 @@ public final class SliderClusterAPI {
org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
channel.callMethod(
- getDescriptor().getMethods().get(18),
+ getDescriptor().getMethods().get(20),
controller,
request,
org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance(),
@@ -1543,7 +1651,7 @@ public final class SliderClusterAPI {
org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
channel.callMethod(
- getDescriptor().getMethods().get(19),
+ getDescriptor().getMethods().get(21),
controller,
request,
org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance(),
@@ -1558,7 +1666,7 @@ public final class SliderClusterAPI {
org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
channel.callMethod(
- getDescriptor().getMethods().get(20),
+ getDescriptor().getMethods().get(22),
controller,
request,
org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance(),
@@ -1573,7 +1681,7 @@ public final class SliderClusterAPI {
org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
channel.callMethod(
- getDescriptor().getMethods().get(21),
+ getDescriptor().getMethods().get(23),
controller,
request,
org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance(),
@@ -1588,7 +1696,7 @@ public final class SliderClusterAPI {
org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
channel.callMethod(
- getDescriptor().getMethods().get(22),
+ getDescriptor().getMethods().get(24),
controller,
request,
org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance(),
@@ -1603,7 +1711,7 @@ public final class SliderClusterAPI {
org.apache.slider.api.proto.Messages.GetCertificateStoreRequestProto request,
com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetCertificateStoreResponseProto> done) {
channel.callMethod(
- getDescriptor().getMethods().get(23),
+ getDescriptor().getMethods().get(25),
controller,
request,
org.apache.slider.api.proto.Messages.GetCertificateStoreResponseProto.getDefaultInstance(),
@@ -1700,6 +1808,16 @@ public final class SliderClusterAPI {
org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto request)
throws com.google.protobuf.ServiceException;
+ public org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto getLiveNodes(
+ com.google.protobuf.RpcController controller,
+ org.apache.slider.api.proto.Messages.GetLiveNodesRequestProto request)
+ throws com.google.protobuf.ServiceException;
+
+ public org.apache.slider.api.proto.Messages.NodeInformationProto getLiveNode(
+ com.google.protobuf.RpcController controller,
+ org.apache.slider.api.proto.Messages.GetLiveNodeRequestProto request)
+ throws com.google.protobuf.ServiceException;
+
public org.apache.slider.api.proto.Messages.WrappedJsonProto getModelDesired(
com.google.protobuf.RpcController controller,
org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
@@ -1940,12 +2058,36 @@ public final class SliderClusterAPI {
}
+ public org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto getLiveNodes(
+ com.google.protobuf.RpcController controller,
+ org.apache.slider.api.proto.Messages.GetLiveNodesRequestProto request)
+ throws com.google.protobuf.ServiceException {
+ return (org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto) channel.callBlockingMethod(
+ getDescriptor().getMethods().get(16),
+ controller,
+ request,
+ org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto.getDefaultInstance());
+ }
+
+
+ public org.apache.slider.api.proto.Messages.NodeInformationProto getLiveNode(
+ com.google.protobuf.RpcController controller,
+ org.apache.slider.api.proto.Messages.GetLiveNodeRequestProto request)
+ throws com.google.protobuf.ServiceException {
+ return (org.apache.slider.api.proto.Messages.NodeInformationProto) channel.callBlockingMethod(
+ getDescriptor().getMethods().get(17),
+ controller,
+ request,
+ org.apache.slider.api.proto.Messages.NodeInformationProto.getDefaultInstance());
+ }
+
+
public org.apache.slider.api.proto.Messages.WrappedJsonProto getModelDesired(
com.google.protobuf.RpcController controller,
org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
throws com.google.protobuf.ServiceException {
return (org.apache.slider.api.proto.Messages.WrappedJsonProto) channel.callBlockingMethod(
- getDescriptor().getMethods().get(16),
+ getDescriptor().getMethods().get(18),
controller,
request,
org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance());
@@ -1957,7 +2099,7 @@ public final class SliderClusterAPI {
org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
throws com.google.protobuf.ServiceException {
return (org.apache.slider.api.proto.Messages.WrappedJsonProto) channel.callBlockingMethod(
- getDescriptor().getMethods().get(17),
+ getDescriptor().getMethods().get(19),
controller,
request,
org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance());
@@ -1969,7 +2111,7 @@ public final class SliderClusterAPI {
org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
throws com.google.protobuf.ServiceException {
return (org.apache.slider.api.proto.Messages.WrappedJsonProto) channel.callBlockingMethod(
- getDescriptor().getMethods().get(18),
+ getDescriptor().getMethods().get(20),
controller,
request,
org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance());
@@ -1981,7 +2123,7 @@ public final class SliderClusterAPI {
org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
throws com.google.protobuf.ServiceException {
return (org.apache.slider.api.proto.Messages.WrappedJsonProto) channel.callBlockingMethod(
- getDescriptor().getMethods().get(19),
+ getDescriptor().getMethods().get(21),
controller,
request,
org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance());
@@ -1993,7 +2135,7 @@ public final class SliderClusterAPI {
org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
throws com.google.protobuf.ServiceException {
return (org.apache.slider.api.proto.Messages.WrappedJsonProto) channel.callBlockingMethod(
- getDescriptor().getMethods().get(20),
+ getDescriptor().getMethods().get(22),
controller,
request,
org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance());
@@ -2005,7 +2147,7 @@ public final class SliderClusterAPI {
org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
throws com.google.protobuf.ServiceException {
return (org.apache.slider.api.proto.Messages.WrappedJsonProto) channel.callBlockingMethod(
- getDescriptor().getMethods().get(21),
+ getDescriptor().getMethods().get(23),
controller,
request,
org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance());
@@ -2017,7 +2159,7 @@ public final class SliderClusterAPI {
org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
throws com.google.protobuf.ServiceException {
return (org.apache.slider.api.proto.Messages.WrappedJsonProto) channel.callBlockingMethod(
- getDescriptor().getMethods().get(22),
+ getDescriptor().getMethods().get(24),
controller,
request,
org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance());
@@ -2029,7 +2171,7 @@ public final class SliderClusterAPI {
org.apache.slider.api.proto.Messages.GetCertificateStoreRequestProto request)
throws com.google.protobuf.ServiceException {
return (org.apache.slider.api.proto.Messages.GetCertificateStoreResponseProto) channel.callBlockingMethod(
- getDescriptor().getMethods().get(23),
+ getDescriptor().getMethods().get(25),
controller,
request,
org.apache.slider.api.proto.Messages.GetCertificateStoreResponseProto.getDefaultInstance());
@@ -2051,7 +2193,7 @@ public final class SliderClusterAPI {
java.lang.String[] descriptorData = {
"\n\033SliderClusterProtocol.proto\022\025org.apach" +
"e.slider.api\032\033SliderClusterMessages.prot" +
- "o2\306\026\n\027SliderClusterProtocolPB\022n\n\013stopClu" +
+ "o2\245\030\n\027SliderClusterProtocolPB\022n\n\013stopClu" +
"ster\022..org.apache.slider.api.StopCluster" +
"RequestProto\032/.org.apache.slider.api.Sto" +
"pClusterResponseProto\022\200\001\n\021upgradeContain" +
@@ -2100,31 +2242,37 @@ public final class SliderClusterAPI {
"api.GetLiveComponentsResponseProto\022y\n\020ge" +
"tLiveComponent\0223.org.apache.slider.api.G",
"etLiveComponentRequestProto\0320.org.apache" +
- ".slider.api.ComponentInformationProto\022d\n" +
- "\017getModelDesired\022(.org.apache.slider.api" +
- ".EmptyPayloadProto\032\'.org.apache.slider.a" +
- "pi.WrappedJsonProto\022k\n\026getModelDesiredAp" +
- "pconf\022(.org.apache.slider.api.EmptyPaylo" +
- "adProto\032\'.org.apache.slider.api.WrappedJ" +
- "sonProto\022m\n\030getModelDesiredResources\022(.o" +
- "rg.apache.slider.api.EmptyPayloadProto\032\'" +
- ".org.apache.slider.api.WrappedJsonProto\022",
- "e\n\020getModelResolved\022(.org.apache.slider." +
+ ".slider.api.ComponentInformationProto\022q\n" +
+ "\014getLiveNodes\022/.org.apache.slider.api.Ge" +
+ "tLiveNodesRequestProto\0320.org.apache.slid" +
+ "er.api.GetLiveNodesResponseProto\022j\n\013getL" +
+ "iveNode\022..org.apache.slider.api.GetLiveN" +
+ "odeRequestProto\032+.org.apache.slider.api." +
+ "NodeInformationProto\022d\n\017getModelDesired\022" +
+ "(.org.apache.slider.api.EmptyPayloadProt" +
+ "o\032\'.org.apache.slider.api.WrappedJsonPro",
+ "to\022k\n\026getModelDesiredAppconf\022(.org.apach" +
+ "e.slider.api.EmptyPayloadProto\032\'.org.apa" +
+ "che.slider.api.WrappedJsonProto\022m\n\030getMo" +
+ "delDesiredResources\022(.org.apache.slider." +
"api.EmptyPayloadProto\032\'.org.apache.slide" +
- "r.api.WrappedJsonProto\022l\n\027getModelResolv" +
- "edAppconf\022(.org.apache.slider.api.EmptyP" +
- "ayloadProto\032\'.org.apache.slider.api.Wrap" +
- "pedJsonProto\022n\n\031getModelResolvedResource" +
- "s\022(.org.apache.slider.api.EmptyPayloadPr" +
- "oto\032\'.org.apache.slider.api.WrappedJsonP" +
- "roto\022e\n\020getLiveResources\022(.org.apache.sl" +
- "ider.api.EmptyPayloadProto\032\'.org.apache.",
- "slider.api.WrappedJsonProto\022\214\001\n\031getClien" +
- "tCertificateStore\0226.org.apache.slider.ap" +
- "i.GetCertificateStoreRequestProto\0327.org." +
- "apache.slider.api.GetCertificateStoreRes" +
- "ponseProtoB5\n\033org.apache.slider.api.prot" +
- "oB\020SliderClusterAPI\210\001\001\240\001\001"
+ "r.api.WrappedJsonProto\022e\n\020getModelResolv" +
+ "ed\022(.org.apache.slider.api.EmptyPayloadP" +
+ "roto\032\'.org.apache.slider.api.WrappedJson" +
+ "Proto\022l\n\027getModelResolvedAppconf\022(.org.a" +
+ "pache.slider.api.EmptyPayloadProto\032\'.org",
+ ".apache.slider.api.WrappedJsonProto\022n\n\031g" +
+ "etModelResolvedResources\022(.org.apache.sl" +
+ "ider.api.EmptyPayloadProto\032\'.org.apache." +
+ "slider.api.WrappedJsonProto\022e\n\020getLiveRe" +
+ "sources\022(.org.apache.slider.api.EmptyPay" +
+ "loadProto\032\'.org.apache.slider.api.Wrappe" +
+ "dJsonProto\022\214\001\n\031getClientCertificateStore" +
+ "\0226.org.apache.slider.api.GetCertificateS" +
+ "toreRequestProto\0327.org.apache.slider.api" +
+ ".GetCertificateStoreResponseProtoB5\n\033org",
+ ".apache.slider.api.protoB\020SliderClusterA" +
+ "PI\210\001\001\240\001\001"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3aeab9ca/slider-core/src/main/java/org/apache/slider/api/types/NodeEntryInformation.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/types/NodeEntryInformation.java b/slider-core/src/main/java/org/apache/slider/api/types/NodeEntryInformation.java
index 33a875e..482b0c7 100644
--- a/slider-core/src/main/java/org/apache/slider/api/types/NodeEntryInformation.java
+++ b/slider-core/src/main/java/org/apache/slider/api/types/NodeEntryInformation.java
@@ -28,41 +28,34 @@ import org.codehaus.jackson.map.annotate.JsonSerialize;
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class NodeEntryInformation {
- public int priority;
-
- /**
- * instance explicitly requested on this node: it's OK if an allocation
- * comes in that has not been (and when that happens, this count should
- * not drop).
- */
- public int requested;
-
- /** number of starting instances */
- public int starting;
-
- /** incrementing counter of instances that failed to start */
- public int startFailed;
/** incrementing counter of instances that failed */
public int failed;
- /**
- * Counter of "failed recently" events. These are all failures
- * which have happened since it was last reset.
- */
+ /** Counter of "failed recently" events. */
public int failedRecently;
+ /** timestamp of last use */
+ public long lastUsed;
+
+ /** Number of live nodes. */
+ public int live;
+
/** incrementing counter of instances that have been pre-empted. */
public int preempted;
- /**
- * Number of live nodes.
- */
- public int live;
+ /** Priority */
+ public int priority;
+
+ /** instance explicitly requested on this node */
+ public int requested;
/** number of containers being released off this node */
public int releasing;
- /** timestamp of last use */
- public long lastUsed;
+ /** incrementing counter of instances that failed to start */
+ public int startFailed;
+
+ /** number of starting instances */
+ public int starting;
}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3aeab9ca/slider-core/src/main/java/org/apache/slider/api/types/NodeInformation.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/types/NodeInformation.java b/slider-core/src/main/java/org/apache/slider/api/types/NodeInformation.java
index 842db14..049ee52 100644
--- a/slider-core/src/main/java/org/apache/slider/api/types/NodeInformation.java
+++ b/slider-core/src/main/java/org/apache/slider/api/types/NodeInformation.java
@@ -31,14 +31,12 @@ import java.util.List;
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class NodeInformation {
+ public String healthReport;
public String hostname;
- public String state;
public String httpAddress;
- public String rackName;
public String labels;
- public String healthReport;
public long lastUpdated;
+ public String rackName;
+ public String state;
public List<NodeEntryInformation> entries = new ArrayList<>();
-
-
}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3aeab9ca/slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java b/slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java
index bab451f..3627687 100644
--- a/slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java
+++ b/slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java
@@ -99,7 +99,7 @@ public interface SliderClientAPI extends Service {
* @throws YarnException Yarn problems
* @throws IOException other problems
* @throws BadCommandArgumentsException bad arguments.
- * @deperecated use #actionKeytab
+ * @deprecated use #actionKeytab
*/
int actionInstallKeytab(ActionInstallKeytabArgs installKeytabInfo)
throws YarnException, IOException;
@@ -111,7 +111,7 @@ public interface SliderClientAPI extends Service {
* @throws YarnException Yarn problems
* @throws IOException other problems
* @throws BadCommandArgumentsException bad arguments.
- * @deperecated use #actionKeytab
+ * @deprecated use #actionKeytab
*/
int actionKeytab(ActionKeytabArgs keytabInfo)
throws YarnException, IOException;
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3aeab9ca/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java b/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
index bada24e..291583d 100644
--- a/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
+++ b/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
@@ -23,6 +23,7 @@ import org.apache.slider.api.SliderClusterProtocol;
import org.apache.slider.api.types.ApplicationLivenessInformation;
import org.apache.slider.api.types.ComponentInformation;
import org.apache.slider.api.types.ContainerInformation;
+import org.apache.slider.api.types.NodeInformation;
import org.apache.slider.api.types.PingInformation;
import org.apache.slider.api.SliderApplicationApi;
import org.apache.slider.core.conf.AggregateConf;
@@ -186,8 +187,7 @@ public class SliderApplicationIpcClient implements SliderApplicationApi {
}
@Override
- public ComponentInformation getComponent(String componentName) throws
- IOException {
+ public ComponentInformation getComponent(String componentName) throws IOException {
try {
return operations.getComponent(componentName);
} catch (IOException e) {
@@ -196,6 +196,24 @@ public class SliderApplicationIpcClient implements SliderApplicationApi {
}
@Override
+ public Map<String, NodeInformation> getLiveNodes() throws IOException {
+ try {
+ return operations.getLiveNodes();
+ } catch (IOException e) {
+ throw convert(e);
+ }
+ }
+
+ @Override
+ public NodeInformation getLiveNode(String hostname) throws IOException {
+ try {
+ return operations.getLiveNode(hostname);
+ } catch (IOException e) {
+ throw convert(e);
+ }
+ }
+
+ @Override
public PingInformation ping(String text) throws IOException {
return null;
}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3aeab9ca/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java b/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
index 69dcb3b..e1ec971 100644
--- a/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
+++ b/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
@@ -30,6 +30,7 @@ import static org.apache.slider.api.proto.RestTypeMarshalling.*;
import org.apache.slider.api.types.ApplicationLivenessInformation;
import org.apache.slider.api.types.ComponentInformation;
import org.apache.slider.api.types.ContainerInformation;
+import org.apache.slider.api.types.NodeInformation;
import org.apache.slider.api.types.PingInformation;
import org.apache.slider.common.tools.Duration;
import org.apache.slider.core.conf.AggregateConf;
@@ -102,7 +103,7 @@ public class SliderClusterOperations {
*/
public List<ClusterNode> convertNodeWireToClusterNodes(List<Messages.RoleInstanceState> nodes)
throws IOException {
- List<ClusterNode> nodeList = new ArrayList<ClusterNode>(nodes.size());
+ List<ClusterNode> nodeList = new ArrayList<>(nodes.size());
for (Messages.RoleInstanceState node : nodes) {
nodeList.add(ClusterNode.fromProtobuf(node));
}
@@ -116,16 +117,12 @@ public class SliderClusterOperations {
* @throws YarnException
* @throws IOException
*/
- public String echo(String text) throws
- YarnException,
- IOException {
+ public String echo(String text) throws YarnException, IOException {
Messages.EchoRequestProto.Builder builder =
Messages.EchoRequestProto.newBuilder();
builder.setText(text);
- Messages.EchoRequestProto req =
- builder.build();
- Messages.EchoResponseProto response =
- appMaster.echo(req);
+ Messages.EchoRequestProto req = builder.build();
+ Messages.EchoResponseProto response = appMaster.echo(req);
return response.getText();
}
@@ -145,9 +142,7 @@ public class SliderClusterOperations {
try {
return ClusterDescription.fromJson(statusJson);
} catch (JsonParseException e) {
- log.error(
- "Exception " + e + " parsing:\n" + statusJson,
- e);
+ log.error("Exception " + e + " parsing:\n" + statusJson, e);
throw e;
}
}
@@ -191,10 +186,8 @@ public class SliderClusterOperations {
Messages.KillContainerRequestProto.Builder builder =
Messages.KillContainerRequestProto.newBuilder();
builder.setId(id);
- Messages.KillContainerRequestProto req =
- builder.build();
- Messages.KillContainerResponseProto response =
- appMaster.killContainer(req);
+ Messages.KillContainerRequestProto req = builder.build();
+ Messages.KillContainerResponseProto response = appMaster.killContainer(req);
return response.getSuccess();
}
@@ -205,24 +198,19 @@ public class SliderClusterOperations {
* @throws IOException
* @throws YarnException
*/
- public String[] listNodeUUIDsByRole(String role) throws
- IOException,
- YarnException {
+ public String[] listNodeUUIDsByRole(String role) throws IOException, YarnException {
Collection<String> uuidList = innerListNodeUUIDSByRole(role);
String[] uuids = new String[uuidList.size()];
return uuidList.toArray(uuids);
}
- public List<String> innerListNodeUUIDSByRole(String role) throws
- IOException,
- YarnException {
+ public List<String> innerListNodeUUIDSByRole(String role) throws IOException, YarnException {
Messages.ListNodeUUIDsByRoleRequestProto req =
Messages.ListNodeUUIDsByRoleRequestProto
.newBuilder()
.setRole(role)
.build();
- Messages.ListNodeUUIDsByRoleResponseProto resp =
- appMaster.listNodeUUIDsByRole(req);
+ Messages.ListNodeUUIDsByRoleResponseProto resp = appMaster.listNodeUUIDsByRole(req);
return resp.getUuidList();
}
@@ -234,9 +222,8 @@ public class SliderClusterOperations {
* @throws IOException
* @throws YarnException
*/
- public List<ClusterNode> listClusterNodesInRole(String role) throws
- IOException,
- YarnException {
+ public List<ClusterNode> listClusterNodesInRole(String role)
+ throws IOException, YarnException {
Collection<String> uuidList = innerListNodeUUIDSByRole(role);
Messages.GetClusterNodesRequestProto req =
@@ -256,9 +243,8 @@ public class SliderClusterOperations {
* @throws YarnException
*/
@VisibleForTesting
- public List<ClusterNode> listClusterNodes(String[] uuids) throws
- IOException,
- YarnException {
+ public List<ClusterNode> listClusterNodes(String[] uuids)
+ throws IOException, YarnException {
Messages.GetClusterNodesRequestProto req =
Messages.GetClusterNodesRequestProto
@@ -341,8 +327,7 @@ public class SliderClusterOperations {
Messages.FlexClusterRequestProto.newBuilder()
.setClusterSpec(resources.toJson())
.build();
- Messages.FlexClusterResponseProto response =
- appMaster.flexCluster(request);
+ Messages.FlexClusterResponseProto response = appMaster.flexCluster(request);
return response.getResponse();
}
@@ -365,10 +350,8 @@ public class SliderClusterOperations {
}
builder.setSignal(signal);
builder.setDelay(delay);
- Messages.AMSuicideRequestProto req =
- builder.build();
- Messages.AMSuicideResponseProto response =
- appMaster.amSuicide(req);
+ Messages.AMSuicideRequestProto req = builder.build();
+ appMaster.amSuicide(req);
}
/**
@@ -385,45 +368,38 @@ public class SliderClusterOperations {
}
-
public AggregateConf getModelDesired() throws IOException {
return unmarshallToAggregateConf(appMaster.getModelDesired(EMPTY));
}
public ConfTreeOperations getModelDesiredAppconf() throws IOException {
- return unmarshallToCTO(
- appMaster.getModelDesiredAppconf(EMPTY));
+ return unmarshallToCTO(appMaster.getModelDesiredAppconf(EMPTY));
}
public ConfTreeOperations getModelDesiredResources() throws IOException {
- return unmarshallToCTO(
- appMaster.getModelDesiredResources(EMPTY));
+ return unmarshallToCTO(appMaster.getModelDesiredResources(EMPTY));
}
public AggregateConf getModelResolved() throws IOException {
- return unmarshallToAggregateConf(
- appMaster.getModelResolved(EMPTY));
+ return unmarshallToAggregateConf(appMaster.getModelResolved(EMPTY));
}
public ConfTreeOperations getModelResolvedAppconf() throws IOException {
- return unmarshallToCTO(
- appMaster.getModelResolvedAppconf(EMPTY));
+ return unmarshallToCTO(appMaster.getModelResolvedAppconf(EMPTY));
}
public ConfTreeOperations getModelResolvedResources() throws IOException {
- return unmarshallToCTO(
- appMaster.getModelDesiredResources(EMPTY));
+ return unmarshallToCTO(appMaster.getModelDesiredResources(EMPTY));
}
public ConfTreeOperations getLiveResources() throws IOException {
- return unmarshallToCTO(
- appMaster.getLiveResources(EMPTY));
+ return unmarshallToCTO(appMaster.getLiveResources(EMPTY));
}
@@ -439,8 +415,7 @@ public class SliderClusterOperations {
+ ") does not match the number of records returned: "
+ records);
}
- Map<String, ContainerInformation> map =
- new HashMap<String, ContainerInformation>(namesCount);
+ Map<String, ContainerInformation> map = new HashMap<>(namesCount);
for (int i = 0; i < namesCount; i++) {
map.put(response.getNames(i), unmarshall(response.getContainers(i)));
}
@@ -473,42 +448,59 @@ public class SliderClusterOperations {
int namesCount = response.getNamesCount();
int records = response.getComponentsCount();
if (namesCount != records) {
- throw new IOException("Number of names returned (" + namesCount
- +
- ") does not match the number of records returned: "
- + records);
+ throw new IOException(
+ "Number of names returned (" + namesCount + ")" +
+ " does not match the number of records returned: " + records);
}
- Map<String, ComponentInformation> map =
- new HashMap<String, ComponentInformation>(namesCount);
+ Map<String, ComponentInformation> map = new HashMap<>(namesCount);
for (int i = 0; i < namesCount; i++) {
map.put(response.getNames(i), unmarshall(response.getComponents(i)));
}
return map;
}
-
public ComponentInformation getComponent(String componentName)
throws IOException {
Messages.GetLiveComponentRequestProto.Builder builder =
Messages.GetLiveComponentRequestProto.newBuilder();
builder.setName(componentName);
- Messages.ComponentInformationProto proto =
- appMaster.getLiveComponent(builder.build());
-
+ Messages.ComponentInformationProto proto = appMaster.getLiveComponent(builder.build());
return unmarshall(proto);
}
-
+ public Map<String, NodeInformation> getLiveNodes() throws IOException {
+ Messages.GetLiveNodesResponseProto response =
+ appMaster.getLiveNodes(Messages.GetLiveNodesRequestProto.newBuilder().build());
+
+ int namesCount = response.getNamesCount();
+ int records = response.getNodesCount();
+ if (namesCount != records) {
+ throw new IOException(
+ "Number of names returned (" + namesCount + ")" +
+ " does not match the number of records returned: " + records);
+ }
+ Map<String, NodeInformation> map = new HashMap<>(namesCount);
+ for (int i = 0; i < namesCount; i++) {
+ map.put(response.getNames(i), unmarshall(response.getNodes(i)));
+ }
+ return map;
+ }
+
+ public NodeInformation getLiveNode(String hostname) throws IOException {
+ Messages.GetLiveNodeRequestProto.Builder builder =
+ Messages.GetLiveNodeRequestProto.newBuilder();
+ builder.setName(hostname);
+ return unmarshall(appMaster.getLiveNode(builder.build()));
+ }
+
public PingInformation ping(String text) throws IOException {
return null;
}
-
public void stop(String text) throws IOException {
amSuicide(text, 3, 0);
}
-
public ApplicationLivenessInformation getApplicationLiveness() throws
IOException {
Messages.ApplicationLivenessInformationProto proto =
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3aeab9ca/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java b/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
index b1aa633..ce2817a 100644
--- a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
+++ b/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
@@ -31,6 +31,7 @@ import org.apache.slider.api.types.ApplicationLivenessInformation;
import org.apache.slider.api.types.ComponentInformation;
import org.apache.slider.api.types.ContainerInformation;
import org.apache.slider.api.SliderApplicationApi;
+import org.apache.slider.api.types.NodeInformation;
import org.apache.slider.core.conf.AggregateConf;
import org.apache.slider.core.conf.ConfTree;
import org.apache.slider.core.conf.ConfTreeOperations;
@@ -232,8 +233,7 @@ public class SliderApplicationApiRestClient extends BaseRestClient
public Map<String, ComponentInformation> enumComponents() throws
IOException {
return getApplicationResource(LIVE_COMPONENTS,
- new GenericType<Map<String, ComponentInformation>>() {
- });
+ new GenericType<Map<String, ComponentInformation>>() { });
}
@Override
@@ -244,6 +244,18 @@ public class SliderApplicationApiRestClient extends BaseRestClient
}
@Override
+ public Map<String, NodeInformation> getLiveNodes() throws IOException {
+ return getApplicationResource(LIVE_NODES,
+ new GenericType<Map<String, NodeInformation>>() { });
+ }
+
+ @Override
+ public NodeInformation getLiveNode(String hostname) throws IOException {
+ return getApplicationResource(LIVE_COMPONENTS + "/" + hostname,
+ NodeInformation.class);
+ }
+
+ @Override
public PingInformation ping(String text) throws IOException {
return pingPost(text);
}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3aeab9ca/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
index 0e7e295..92b602f 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
@@ -20,6 +20,9 @@ package org.apache.slider.server.appmaster;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.health.HealthCheckRegistry;
+import com.codahale.metrics.jvm.GarbageCollectorMetricSet;
+import com.codahale.metrics.jvm.MemoryUsageGaugeSet;
+import com.codahale.metrics.jvm.ThreadStatesGaugeSet;
import com.google.common.base.Preconditions;
import com.google.protobuf.BlockingService;
@@ -221,10 +224,13 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
* Deployed in {@link #serviceInit(Configuration)}
*/
private final MetricsAndMonitoring metricsAndMonitoring = new MetricsAndMonitoring();
+
/**
* metrics registry
*/
public MetricRegistry metrics;
+
+ /** Error string on chaos monkey launch failure action: {@value} */
public static final String E_TRIGGERED_LAUNCH_FAILURE =
"Chaos monkey triggered launch failure";
@@ -244,7 +250,6 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
@SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
public NMClientAsync nmClientAsync;
-// YarnConfiguration conf;
/**
* token blob
*/
@@ -484,16 +489,19 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
false);
SliderUtils.validateSliderServerEnvironment(log, dependencyChecks);
- // create app state and monitoring
+ // create and register monitoring services
addService(metricsAndMonitoring);
metrics = metricsAndMonitoring.getMetrics();
+/*
+ metrics.registerAll(new ThreadStatesGaugeSet());
+ metrics.registerAll(new MemoryUsageGaugeSet());
+ metrics.registerAll(new GarbageCollectorMetricSet());
-
+*/
contentCache = ApplicationResouceContentCacheFactory.createContentCache(
stateForProviders);
-
- executorService = new WorkflowExecutorService<ExecutorService>("AmExecutor",
+ executorService = new WorkflowExecutorService<>("AmExecutor",
Executors.newFixedThreadPool(2,
new ServiceThreadFactory("AmExecutor", true)));
addService(executorService);
@@ -1647,7 +1655,7 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
// If components are specified as well, then grab all the containers of
// each of the components (roles)
if (CollectionUtils.isNotEmpty(components)) {
- Map<ContainerId, RoleInstance> liveContainers = appState.getLiveNodes();
+ Map<ContainerId, RoleInstance> liveContainers = appState.getLiveContainers();
if (CollectionUtils.isNotEmpty(liveContainers.keySet())) {
Map<String, Set<String>> roleContainerMap = prepareRoleContainerMap(liveContainers);
for (String component : components) {
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3aeab9ca/slider-core/src/main/java/org/apache/slider/server/appmaster/management/BoolMetric.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/BoolMetric.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/BoolMetric.java
new file mode 100644
index 0000000..23ea61d
--- /dev/null
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/BoolMetric.java
@@ -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.
+ */
+
+package org.apache.slider.server.appmaster.management;
+
+import com.codahale.metrics.Counting;
+import com.codahale.metrics.Gauge;
+import com.codahale.metrics.Metric;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+/**
+ * A bool metric, mapped to an integer. true maps to 1, false to zero,
+ */
+public class BoolMetric implements Metric, Gauge<Integer> {
+
+ private final AtomicBoolean value;
+
+ public BoolMetric(boolean b) {
+ value = new AtomicBoolean(b);
+ }
+
+ public void set(boolean b) {
+ value.set(b);
+ }
+
+ public boolean get() {
+ return value.get();
+ }
+
+ @Override
+ public Integer getValue() {
+ return value.get() ? 1 : 0;
+ }
+
+ /**
+ * Evaluate from a string. Returns true if the string is considered to match 'true',
+ * false otherwise.
+ * @param s source
+ * @return true if the input parses to an integer other than 0. False if it doesn't parse
+ * or parses to 0.
+ */
+ public boolean fromString(String s) {
+ try {
+ return Integer.valueOf(s) != 0;
+ } catch (NumberFormatException e) {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return value.toString();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ BoolMetric that = (BoolMetric) o;
+ return get() == that.get();
+ }
+
+ @Override
+ public int hashCode() {
+ return value.hashCode();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3aeab9ca/slider-core/src/main/java/org/apache/slider/server/appmaster/management/LongGauge.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/LongGauge.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/LongGauge.java
new file mode 100644
index 0000000..08f61ec
--- /dev/null
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/LongGauge.java
@@ -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.
+ */
+
+package org.apache.slider.server.appmaster.management;
+
+import com.codahale.metrics.Gauge;
+import com.codahale.metrics.Metric;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * This is a long which acts as a gauge
+ */
+public class LongGauge implements Metric, Gauge<Long> {
+
+ private final AtomicLong value;
+
+ /**
+ * Instantiate
+ * @param val current value
+ */
+ public LongGauge(long val) {
+ this.value = new AtomicLong(val);
+ }
+
+ public LongGauge() {
+ this(0);
+ }
+
+ /**
+ * Set to a new value.
+ * @param val value
+ */
+ public synchronized void set(long val) {
+ value.set(val);
+ }
+
+ public void inc() {
+ inc(1);
+ }
+
+ public void dec() {
+ dec(1);
+ }
+
+ public synchronized void inc(int delta) {
+ set(value.get() + delta);
+ }
+
+ public synchronized void dec(int delta) {
+ set(value.get() - delta);
+ }
+
+ public long get() {
+ return value.get();
+ }
+
+ @Override
+ public Long getValue() {
+ return get();
+ }
+
+ @Override
+ public String toString() {
+ return value.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ return value.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return value.equals(obj);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3aeab9ca/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MeterAndCounter.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MeterAndCounter.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MeterAndCounter.java
index 58d9eb3..02ab7bc 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MeterAndCounter.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MeterAndCounter.java
@@ -74,6 +74,11 @@ public class MeterAndCounter {
meter.mark();
}
+ public void inc() {
+ mark();
+ }
+
+
@Override
public boolean equals(Object o) {
if (this == o) {
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3aeab9ca/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MetricsAndMonitoring.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MetricsAndMonitoring.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MetricsAndMonitoring.java
index 8de27e7..cced42a 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MetricsAndMonitoring.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MetricsAndMonitoring.java
@@ -18,14 +18,13 @@
package org.apache.slider.server.appmaster.management;
+import com.codahale.metrics.Metric;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.health.HealthCheckRegistry;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.service.AbstractService;
import org.apache.hadoop.service.CompositeService;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -100,7 +99,7 @@ public class MetricsAndMonitoring extends CompositeService {
}
/**
- * Get a specific meter and mark it
+ * Get a specific meter and mark it. This will create and register it on demand.
* @param name name of meter/counter
*/
public void markMeterAndCounter(String name) {
@@ -109,6 +108,25 @@ public class MetricsAndMonitoring extends CompositeService {
}
/**
+ * Given a {@link Metric}, registers it under the given name.
+ *
+ * @param name the name of the metric
+ * @param metric the metric
+ * @param <T> the type of the metric
+ * @return {@code metric}
+ * @throws IllegalArgumentException if the name is already registered
+ */
+ public <T extends Metric> T register(String name, T metric) throws IllegalArgumentException {
+ return metrics.register(name, metric);
+ }
+
+ public <T extends Metric> T register(Class<?> klass, T metric, String... names)
+ throws IllegalArgumentException {
+ return register(MetricRegistry.name(klass, names), metric);
+ }
+
+
+ /**
* Add an event (synchronized)
* @param event event
*/
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3aeab9ca/slider-core/src/main/java/org/apache/slider/server/appmaster/management/RangeLimitedCounter.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/RangeLimitedCounter.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/RangeLimitedCounter.java
new file mode 100644
index 0000000..80e88fc
--- /dev/null
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/RangeLimitedCounter.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.slider.server.appmaster.management;
+
+import com.codahale.metrics.Counter;
+import com.codahale.metrics.Counting;
+import com.codahale.metrics.Metric;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * This is a counter whose range can be given a min and a max
+ */
+public class RangeLimitedCounter implements Metric, Counting {
+
+ private final AtomicLong value;
+ private final long min, max;
+
+ /**
+ * Instantiate
+ * @param val current value
+ * @param min minimum value
+ * @param max max value (or 0 for no max)
+ */
+ public RangeLimitedCounter(long val, long min, long max) {
+ this.value = new AtomicLong(val);
+ this.min = min;
+ this.max = max;
+ }
+
+ /**
+ * Set to a new value. If below the min, set to the minimum. If the max is non
+ * zero and the value is above that maximum, set it to the maximum instead.
+ * @param val value
+ */
+ public synchronized void set(long val) {
+ if (val < min) {
+ val = min;
+ } else if (max > 0 && val > max) {
+ val = max;
+ }
+ value.set(val);
+ }
+
+ public void inc() {
+ inc(1);
+ }
+
+ public void dec() {
+ dec(1);
+ }
+
+ public synchronized void inc(int delta) {
+ set(value.get() + delta);
+ }
+
+ public synchronized void dec(int delta) {
+ set(value.get() - delta);
+ }
+
+ public long get() {
+ return value.get();
+ }
+
+ @Override
+ public long getCount() {
+ return value.get();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3aeab9ca/slider-core/src/main/java/org/apache/slider/server/appmaster/management/Timestamp.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/Timestamp.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/Timestamp.java
new file mode 100644
index 0000000..c30e749
--- /dev/null
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/Timestamp.java
@@ -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.
+ */
+
+package org.apache.slider.server.appmaster.management;
+
+/**
+ * A timestamp metric
+ */
+public class Timestamp extends LongGauge {
+
+ public Timestamp(long val) {
+ super(val);
+ }
+
+ public Timestamp() {
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3aeab9ca/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java
index 50534d2..f0d9063 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java
@@ -216,6 +216,26 @@ public class SliderClusterProtocolPBImpl implements SliderClusterProtocolPB {
}
@Override
+ public Messages.GetLiveNodesResponseProto getLiveNodes(RpcController controller,
+ Messages.GetLiveNodesRequestProto request) throws ServiceException {
+ try {
+ return real.getLiveNodes(request);
+ } catch (Exception e) {
+ throw wrap(e);
+ }
+ }
+
+ @Override
+ public Messages.NodeInformationProto getLiveNode(RpcController controller,
+ Messages.GetLiveNodeRequestProto request) throws ServiceException {
+ try {
+ return real.getLiveNode(request);
+ } catch (Exception e) {
+ throw wrap(e);
+ }
+ }
+
+ @Override
public Messages.WrappedJsonProto getModelDesired(RpcController controller,
Messages.EmptyPayloadProto request) throws ServiceException {
try {
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3aeab9ca/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
index 2d927c6..b230816 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
@@ -263,6 +263,26 @@ public class SliderClusterProtocolProxy implements SliderClusterProtocol {
}
@Override
+ public Messages.GetLiveNodesResponseProto getLiveNodes(Messages.GetLiveNodesRequestProto request)
+ throws IOException {
+ try {
+ return endpoint.getLiveNodes(NULL_CONTROLLER, request);
+ } catch (ServiceException e) {
+ throw convert(e);
+ }
+ }
+
+ @Override
+ public Messages.NodeInformationProto getLiveNode(Messages.GetLiveNodeRequestProto request)
+ throws IOException {
+ try {
+ return endpoint.getLiveNode(NULL_CONTROLLER, request);
+ } catch (ServiceException e) {
+ throw convert(e);
+ }
+ }
+
+ @Override
public Messages.WrappedJsonProto getModelDesired(Messages.EmptyPayloadProto request) throws IOException {
try {
return endpoint.getModelDesired(NULL_CONTROLLER, request);
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3aeab9ca/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
index 1581482..bb8f512 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
@@ -30,9 +30,9 @@ import org.apache.slider.api.proto.Messages;
import org.apache.slider.api.types.ApplicationLivenessInformation;
import org.apache.slider.api.types.ComponentInformation;
import org.apache.slider.api.types.ContainerInformation;
+import org.apache.slider.api.types.NodeInformation;
import org.apache.slider.core.conf.AggregateConf;
import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.core.exceptions.NoSuchNodeException;
import org.apache.slider.core.exceptions.ServiceNotReadyException;
import org.apache.slider.core.exceptions.SliderException;
import org.apache.slider.core.main.LauncherExitCodes;
@@ -51,7 +51,6 @@ import org.apache.slider.server.appmaster.state.RoleInstance;
import org.apache.slider.server.appmaster.state.StateAccessForProviders;
import org.apache.slider.server.appmaster.web.rest.application.resources.ContentCache;
import org.apache.slider.server.services.security.CertificateManager;
-import org.apache.slider.server.services.security.KeystoreGenerator;
import org.apache.slider.server.services.security.SecurityStore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -65,6 +64,7 @@ import java.util.concurrent.TimeUnit;
import static org.apache.slider.api.proto.RestTypeMarshalling.marshall;
import static org.apache.slider.server.appmaster.web.rest.RestPaths.LIVE_COMPONENTS;
import static org.apache.slider.server.appmaster.web.rest.RestPaths.LIVE_CONTAINERS;
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.LIVE_NODES;
import static org.apache.slider.server.appmaster.web.rest.RestPaths.LIVE_RESOURCES;
import static org.apache.slider.server.appmaster.web.rest.RestPaths.MODEL_DESIRED;
import static org.apache.slider.server.appmaster.web.rest.RestPaths.MODEL_DESIRED_APPCONF;
@@ -273,7 +273,7 @@ public class SliderIPCService extends AbstractService
String role = request.getRole();
Messages.ListNodeUUIDsByRoleResponseProto.Builder builder =
Messages.ListNodeUUIDsByRoleResponseProto.newBuilder();
- List<RoleInstance> nodes = state.enumLiveNodesInRole(role);
+ List<RoleInstance> nodes = state.enumLiveInstancesInRole(role);
for (RoleInstance node : nodes) {
builder.addUuid(node.id);
}
@@ -373,13 +373,11 @@ public class SliderIPCService extends AbstractService
Messages.GetLiveContainersRequestProto request)
throws IOException {
Map<String, ContainerInformation> infoMap =
- (Map<String, ContainerInformation>) cache.lookupWithIOE(
- LIVE_CONTAINERS);
+ (Map<String, ContainerInformation>) cache.lookupWithIOE(LIVE_CONTAINERS);
Messages.GetLiveContainersResponseProto.Builder builder =
Messages.GetLiveContainersResponseProto.newBuilder();
- for (Map.Entry<String, ContainerInformation> entry : infoMap
- .entrySet()) {
+ for (Map.Entry<String, ContainerInformation> entry : infoMap.entrySet()) {
builder.addNames(entry.getKey());
builder.addContainers(marshall(entry.getValue()));
}
@@ -387,8 +385,8 @@ public class SliderIPCService extends AbstractService
}
@Override
- public Messages.ContainerInformationProto getLiveContainer(Messages.GetLiveContainerRequestProto request) throws
- IOException {
+ public Messages.ContainerInformationProto getLiveContainer(Messages.GetLiveContainerRequestProto request)
+ throws IOException {
String containerId = request.getContainerId();
RoleInstance id = state.getLiveInstanceByContainerID(containerId);
ContainerInformation containerInformation = id.serialize();
@@ -396,22 +394,61 @@ public class SliderIPCService extends AbstractService
}
@Override
- public Messages.GetLiveComponentsResponseProto getLiveComponents(Messages.GetLiveComponentsRequestProto request) throws
- IOException {
+ public Messages.GetLiveComponentsResponseProto getLiveComponents(Messages.GetLiveComponentsRequestProto request)
+ throws IOException {
Map<String, ComponentInformation> infoMap =
- (Map<String, ComponentInformation>) cache.lookupWithIOE(
- LIVE_COMPONENTS);
+ (Map<String, ComponentInformation>) cache.lookupWithIOE(LIVE_COMPONENTS);
Messages.GetLiveComponentsResponseProto.Builder builder =
Messages.GetLiveComponentsResponseProto.newBuilder();
- for (Map.Entry<String, ComponentInformation> entry : infoMap
- .entrySet()) {
+ for (Map.Entry<String, ComponentInformation> entry : infoMap.entrySet()) {
builder.addNames(entry.getKey());
builder.addComponents(marshall(entry.getValue()));
}
return builder.build();
}
+
+ @Override
+ public Messages.ComponentInformationProto getLiveComponent(Messages.GetLiveComponentRequestProto request)
+ throws IOException {
+ String name = request.getName();
+ try {
+ return marshall(state.getComponentInformation(name));
+ } catch (YarnRuntimeException e) {
+ throw new FileNotFoundException("Unknown component: " + name);
+ }
+ }
+
+ @Override
+ public Messages.GetLiveNodesResponseProto getLiveNodes(Messages.GetLiveNodesRequestProto request)
+ throws IOException {
+ Map<String, NodeInformation> infoMap =
+ (Map<String, NodeInformation>) cache.lookupWithIOE(LIVE_NODES);
+ Messages.GetLiveNodesResponseProto.Builder builder =
+ Messages.GetLiveNodesResponseProto.newBuilder();
+
+ for (Map.Entry<String, NodeInformation> entry : infoMap.entrySet()) {
+ builder.addNames(entry.getKey());
+ builder.addNodes(marshall(entry.getValue()));
+ }
+ return builder.build();
+ }
+
+
+ @Override
+ public Messages.NodeInformationProto getLiveNode(Messages.GetLiveNodeRequestProto request)
+ throws IOException {
+ String name = request.getName();
+ NodeInformation nodeInformation = state.getNodeInformation(name);
+ if (nodeInformation != null) {
+ return marshall(nodeInformation);
+ } else {
+ throw new FileNotFoundException("Unknown host: " + name);
+ }
+ }
+
+
@Override
public Messages.WrappedJsonProto getModelDesired(Messages.EmptyPayloadProto request) throws IOException {
return lookupAggregateConf(MODEL_DESIRED);
@@ -447,17 +484,6 @@ public class SliderIPCService extends AbstractService
return lookupConfTree(LIVE_RESOURCES);
}
- @Override
- public Messages.ComponentInformationProto getLiveComponent(Messages.GetLiveComponentRequestProto request) throws
- IOException {
- String name = request.getName();
- try {
- return marshall(state.getComponentInformation(name));
- } catch (YarnRuntimeException e) {
- throw new FileNotFoundException("Unknown component: " + name);
- }
- }
-
/**
* Helper method; look up an aggregate configuration in the cache from
* a key, or raise an exception