You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "gaborgsomogyi (via GitHub)" <gi...@apache.org> on 2024/04/11 08:24:09 UTC

Re: [PR] [FLINK-34574] Add CPU and memory size autoscaler quota [flink-kubernetes-operator]

gaborgsomogyi commented on code in PR #789:
URL: https://github.com/apache/flink-kubernetes-operator/pull/789#discussion_r1560631310


##########
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/ScalingExecutor.java:
##########
@@ -199,6 +214,85 @@ protected static boolean allVerticesWithinUtilizationTarget(
         return true;
     }
 
+    protected static boolean resourceQuotaReached(
+            Configuration conf,
+            EvaluatedMetrics evaluatedMetrics,
+            Map<JobVertexID, ScalingSummary> scalingSummaries,
+            JobAutoScalerContext<?> ctx) {
+
+        if (evaluatedMetrics.getJobTopology() == null
+                || evaluatedMetrics.getJobTopology().getSlotSharingGroupMapping().isEmpty()) {
+            return false;
+        }
+
+        var cpuQuota = conf.getOptional(AutoScalerOptions.CPU_QUOTA);
+        var memoryQuota = conf.getOptional(AutoScalerOptions.MEMORY_QUOTA);
+        var tmMemory = ctx.getTaskManagerMemory();
+        var tmCpu = ctx.getTaskManagerCpu();
+
+        if (cpuQuota.isPresent() || memoryQuota.isPresent()) {
+            var currentSlotSharingGroupMaxParallelisms = new HashMap<SlotSharingGroupId, Integer>();
+            var newSlotSharingGroupMaxParallelisms = new HashMap<SlotSharingGroupId, Integer>();
+            for (var e :
+                    evaluatedMetrics.getJobTopology().getSlotSharingGroupMapping().entrySet()) {

Review Comment:
   Such case Job topology is null so it's handled: https://github.com/apache/flink-kubernetes-operator/pull/789/files#diff-7fdb929157b6a94cc180c67b8dddb6722d26a7b8ea8259eb7cb9ef84b9a418a3R224-R227



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org