peter-toth commented on code in PR #405:
URL: 
https://github.com/apache/spark-kubernetes-operator/pull/405#discussion_r2472039532


##########
spark-operator-api/src/main/java/org/apache/spark/k8s/operator/status/ApplicationStatus.java:
##########
@@ -163,6 +180,44 @@ public ApplicationStatus terminateOrRestart(
     }
   }
 
+  /**
+   * Finds the first state of the current application attempt.
+   *
+   * <p>This method traverses the state transition history in reverse order to 
find the most recent
+   * initializing state (e.g., Submitted or ScheduledToRestart), which marks 
the beginning of the
+   * current attempt. If no initializing state is found, it returns the first 
entry in the history.
+   *
+   * @return The ApplicationState representing the start of the current 
attempt.
+   */
+  protected ApplicationState findFirstStateOfCurrentAttempt() {
+    List<Map.Entry<Long, ApplicationState>> entries =

Review Comment:
   This is a bit ugly, but I don't have a better idea. I think Java 21 will 
offer new ways to find an entry in a reversed sorted map.



##########
spark-operator-api/build.gradle:
##########
@@ -89,8 +89,31 @@ tasks.register("assertGeneratedCRDMatchesHelmChart") {
         "${stagedCRDFileBase}sparkclusters.spark.apache.org-v1.yaml"
     ].execute().text.trim()
     if (generatedAppCRD != stagedAppCRD || generatedClusterCRD != 
stagedClusterCRD) {
-      throw new GradleException("Generated CRD yaml does not match the staged 
version in " +
-          "Helm Chart, please keep the chart updated.")
+      def errorMessage = new StringBuilder("Generated CRD yaml does not match 
the staged " +

Review Comment:
   This is a nice improvement, but not related to this PR. Shall we move it to 
a separate ticket/PR?



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to