diff options
author | Jon Bratseth <bratseth@oath.com> | 2020-06-23 16:46:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-23 16:46:27 +0200 |
commit | c1313421e3f7ec8b10c61d8e317e190edcd2be8c (patch) | |
tree | 2f7d39b9a6a0722cfbb9f896279e35a36d878366 | |
parent | d7b5964ed9d54346e4f1b6166e02e70265c8b70a (diff) | |
parent | 8c520148a6953414759e702586075754aaf88222 (diff) |
Merge pull request #13672 from vespa-engine/bratseth/skip-empty-clusters
Skip empty clusters
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationSerializer.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationSerializer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationSerializer.java index a4161a318ab..9433b89ddc4 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationSerializer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationSerializer.java @@ -35,16 +35,17 @@ public class ApplicationSerializer { } private static void clustersToSlime(Collection<Cluster> clusters, List<Node> applicationNodes, Cursor clustersObject) { - clusters.forEach(cluster -> toSlime(cluster, applicationNodes, clustersObject.setObject(cluster.id().value()))); + clusters.forEach(cluster -> toSlime(cluster, applicationNodes, clustersObject)); } - private static void toSlime(Cluster cluster, List<Node> applicationNodes, Cursor clusterObject) { + private static void toSlime(Cluster cluster, List<Node> applicationNodes, Cursor clustersObject) { List<Node> nodes = NodeList.copyOf(applicationNodes).not().retired().cluster(cluster.id()).asList(); if (nodes.isEmpty()) return; int groups = (int)nodes.stream().map(node -> node.allocation().get().membership().cluster().group()).distinct().count(); ClusterResources currentResources = new ClusterResources(nodes.size(), groups, nodes.get(0).resources()); + Cursor clusterObject = clustersObject.setObject(cluster.id().value()); toSlime(cluster.minResources(), clusterObject.setObject("min")); toSlime(cluster.maxResources(), clusterObject.setObject("max")); toSlime(currentResources, clusterObject.setObject("current")); |