summaryrefslogtreecommitdiffstats
path: root/node-repository
diff options
context:
space:
mode:
authorOla Aunronning <olaa@yahooinc.com>2024-01-24 15:50:11 +0100
committerOla Aunronning <olaa@yahooinc.com>2024-01-24 15:50:11 +0100
commit9b1818fa5e19138309356387e3726b87b10e05a1 (patch)
tree2c09172025cc3e2c7b5dedfdab610816862ce829 /node-repository
parente6f30b96ad5e1d32be4aa29db4c526f5ece50625 (diff)
Added comment, TODO, and better naming
Diffstat (limited to 'node-repository')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java4
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainer.java6
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/ApplicationSerializer.java1
3 files changed, 6 insertions, 5 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java
index 1c160beadf4..ae12ca13318 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java
@@ -47,8 +47,8 @@ public class AllocationOptimizer {
* Searches the space of possible allocations given a target relative load
* and (optionally) cluster limits and returns the best alternative.
*
- * @return the best allocations sorted by preference, if there are any possible legal allocations, fulfilling the target
- * fully or partially, within the limits
+ * @return the best allocations, if there are any possible legal allocations, fulfilling the target
+ * fully or partially, within the limits. The list contains the three best allocations, sorted from most to least preferred.
*/
public List<AllocatableResources> findBestAllocations(Load loadAdjustment,
ClusterModel model,
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainer.java
index c2199de247c..fa1be83dbcf 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainer.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainer.java
@@ -64,13 +64,13 @@ public class ScalingSuggestionsMaintainer extends NodeRepositoryMaintainer {
Application application = applications().get(applicationId).orElse(Application.empty(applicationId));
Optional<Cluster> cluster = application.cluster(clusterId);
if (cluster.isEmpty()) return true;
- var suggestion = autoscaler.suggest(application, cluster.get(), clusterNodes);
+ var suggestions = autoscaler.suggest(application, cluster.get(), clusterNodes);
- if ( ! shouldUpdateSuggestion(cluster.get().suggestions(), suggestion))
+ if ( ! shouldUpdateSuggestion(cluster.get().suggestions(), suggestions))
return true;
// Wait only a short time for the lock to avoid interfering with change deployments
try (Mutex lock = nodeRepository().applications().lock(applicationId, Duration.ofSeconds(1))) {
- applications().get(applicationId).ifPresent(a -> updateSuggestion(suggestion, clusterId, a, lock));
+ applications().get(applicationId).ifPresent(a -> updateSuggestion(suggestions, clusterId, a, lock));
return true;
}
catch (ApplicationLockException e) {
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/ApplicationSerializer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/ApplicationSerializer.java
index 7aee0610051..2dea70825ee 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/ApplicationSerializer.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/ApplicationSerializer.java
@@ -141,6 +141,7 @@ public class ApplicationSerializer {
toSlime(cluster.maxResources(), clusterObject.setObject(maxResourcesKey));
toSlime(cluster.groupSize(), clusterObject.setObject(groupSizeKey));
clusterObject.setBool(requiredKey, cluster.required());
+ // TODO(olaa): Remove 'suggested' once API clients migrate to suggestion list
toSlime(cluster.suggested(), clusterObject.setObject(suggestedKey));
toSlime(cluster.suggestions(), clusterObject.setArray(suggestionsKey));
toSlime(cluster.target(), clusterObject.setObject(targetKey));