Dennis-Mircea commented on code in PR #1149:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/1149#discussion_r3529594433


##########
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/JobAutoScalerContext.java:
##########
@@ -58,14 +68,61 @@ public class JobAutoScalerContext<KEY> {
     /**
      * The configuration based on the latest user-provided spec. This is not 
the already deployed /
      * observed configuration.
+     *
+     * <p>For a plugin context this is the effective configuration: the job 
configuration with that
+     * plugin's prefix-stripped per-plugin overrides merged on top.
      */
     @Getter private final Configuration configuration;
 
+    /** The metric group for the current job, used to register autoscaler and 
plugin metrics. */
     @Getter private final MetricGroup metricGroup;
 
+    /** Supplier of a Flink REST client for the current job, invoked lazily on 
first use. */
     @ToString.Exclude
     private final SupplierWithException<RestClusterClient<String>, Exception> 
restClientSupplier;
 
+    /**
+     * Internal scratch space populated by the autoscaler pipeline within a 
single scaling cycle. It
+     * is lazily initialized on first access and excluded from {@code 
toString}, and is not part of
+     * the externally-provided context (callers should not set it).
+     */
+    @ToString.Exclude private ScalingCycleState scalingCycleState;
+
+    @Builder(toBuilder = true)
+    public JobAutoScalerContext(
+            KEY jobKey,
+            @Nullable JobID jobID,
+            @Nullable JobStatus jobStatus,
+            Configuration configuration,
+            MetricGroup metricGroup,
+            SupplierWithException<RestClusterClient<String>, Exception> 
restClientSupplier) {
+        this.jobKey = jobKey;
+        this.jobID = jobID;
+        this.jobStatus = jobStatus;
+        this.configuration = configuration;
+        this.metricGroup = metricGroup;
+        this.restClientSupplier = restClientSupplier;
+    }
+
+    /**
+     * Copy constructor used by plugin context subclasses. It copies all 
fields from the given
+     * context except the configuration, which is replaced by the provided 
one, so a plugin context
+     * exposes its effective per-plugin configuration through {@link 
#getConfiguration()}. It also
+     * shares the {@link ScalingCycleState}, so the derived context exposes 
the same per-cycle data
+     * (collected / evaluated metrics, topology, restart time) through the 
inherited accessors
+     * rather than duplicating it.
+     */
+    protected JobAutoScalerContext(
+            JobAutoScalerContext<KEY> autoScalerContext, Configuration 
configuration) {

Review Comment:
   Addressed!



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to