This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/spark-kubernetes-operator.git


The following commit(s) were added to refs/heads/main by this push:
     new d663cc4  [SPARK-49404] Adjust `ERROR`-level log messages
d663cc4 is described below

commit d663cc46dac832f0cd9ee0dc00ef39faac3f4faa
Author: Dongjoon Hyun <[email protected]>
AuthorDate: Tue Aug 27 07:45:13 2024 -0700

    [SPARK-49404] Adjust `ERROR`-level log messages
    
    ### What changes were proposed in this pull request?
    
    This PR aims to audit and adjust `ERROR`-level log messages.
    
    ### Why are the changes needed?
    
    To be consistent on the log-level and avoid misleading error messages.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Manual review.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #111 from dongjoon-hyun/SPARK-49404.
    
    Authored-by: Dongjoon Hyun <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 .../main/java/org/apache/spark/k8s/operator/probe/HealthProbe.java    | 3 ++-
 .../org/apache/spark/k8s/operator/reconciler/SparkAppReconciler.java  | 2 +-
 .../spark/k8s/operator/reconciler/SparkAppResourceSpecFactory.java    | 2 +-
 .../apache/spark/k8s/operator/reconciler/SparkClusterReconciler.java  | 4 ++--
 .../main/java/org/apache/spark/k8s/operator/utils/StatusRecorder.java | 3 ++-
 5 files changed, 8 insertions(+), 6 deletions(-)

diff --git 
a/spark-operator/src/main/java/org/apache/spark/k8s/operator/probe/HealthProbe.java
 
b/spark-operator/src/main/java/org/apache/spark/k8s/operator/probe/HealthProbe.java
index 739791a..4df568a 100644
--- 
a/spark-operator/src/main/java/org/apache/spark/k8s/operator/probe/HealthProbe.java
+++ 
b/spark-operator/src/main/java/org/apache/spark/k8s/operator/probe/HealthProbe.java
@@ -100,9 +100,10 @@ public class HealthProbe implements HttpHandler {
           } else {
             if (log.isErrorEnabled()) {
               log.error(
-                  "Controller: {}, Event Source: {}, Informer: {} is not in a 
healthy state",
+                  "Controller: {}, Event Source: {}, Informer: {} is in {}, 
not a healthy state",
                   controllerEntry.getKey(),
                   eventSourceEntry.getKey(),
+                  informerEntry.getValue().getStatus(),
                   informerEntry.getKey());
             }
             informersHealthList.add(false);
diff --git 
a/spark-operator/src/main/java/org/apache/spark/k8s/operator/reconciler/SparkAppReconciler.java
 
b/spark-operator/src/main/java/org/apache/spark/k8s/operator/reconciler/SparkAppReconciler.java
index eb6f86c..89c5213 100644
--- 
a/spark-operator/src/main/java/org/apache/spark/k8s/operator/reconciler/SparkAppReconciler.java
+++ 
b/spark-operator/src/main/java/org/apache/spark/k8s/operator/reconciler/SparkAppReconciler.java
@@ -93,7 +93,7 @@ public class SparkAppReconciler
           sparkApplication, context.getClient())) {
         return UpdateControl.noUpdate();
       }
-      log.debug("Start reconciliation.");
+      log.debug("Start application reconciliation.");
       sparkAppStatusRecorder.updateStatusFromCache(sparkApplication);
       SparkAppContext ctx = new SparkAppContext(sparkApplication, context, 
submissionWorker);
       List<AppReconcileStep> reconcileSteps = 
getReconcileSteps(sparkApplication);
diff --git 
a/spark-operator/src/main/java/org/apache/spark/k8s/operator/reconciler/SparkAppResourceSpecFactory.java
 
b/spark-operator/src/main/java/org/apache/spark/k8s/operator/reconciler/SparkAppResourceSpecFactory.java
index c3272b0..35871fa 100644
--- 
a/spark-operator/src/main/java/org/apache/spark/k8s/operator/reconciler/SparkAppResourceSpecFactory.java
+++ 
b/spark-operator/src/main/java/org/apache/spark/k8s/operator/reconciler/SparkAppResourceSpecFactory.java
@@ -113,7 +113,7 @@ public final class SparkAppResourceSpecFactory {
         log.warn("Local temp file not found at {}", pathKey);
       }
     } catch (Throwable t) {
-      log.error("Failed to delete temp file. Attempting delete upon exit.", t);
+      log.warn("Failed to delete temp file. Attempting delete upon exit.", t);
     } finally {
       if (!deleted && localFile.isPresent() && localFile.get().exists()) {
         localFile.get().deleteOnExit();
diff --git 
a/spark-operator/src/main/java/org/apache/spark/k8s/operator/reconciler/SparkClusterReconciler.java
 
b/spark-operator/src/main/java/org/apache/spark/k8s/operator/reconciler/SparkClusterReconciler.java
index a6e0ab9..fde1a98 100644
--- 
a/spark-operator/src/main/java/org/apache/spark/k8s/operator/reconciler/SparkClusterReconciler.java
+++ 
b/spark-operator/src/main/java/org/apache/spark/k8s/operator/reconciler/SparkClusterReconciler.java
@@ -78,7 +78,7 @@ public class SparkClusterReconciler
       if (sentinelManager.handleSentinelResourceReconciliation(sparkCluster, 
context.getClient())) {
         return UpdateControl.noUpdate();
       }
-      log.error("Start SparkClusterReconciler.");
+      log.debug("Start cluster reconciliation.");
       sparkClusterStatusRecorder.updateStatusFromCache(sparkCluster);
       SparkClusterContext ctx = new SparkClusterContext(sparkCluster, context, 
submissionWorker);
       List<ClusterReconcileStep> reconcileSteps = 
getReconcileSteps(sparkCluster);
@@ -90,7 +90,7 @@ public class SparkClusterReconciler
       }
       return ReconcilerUtils.toUpdateControl(sparkCluster, 
completeAndDefaultRequeue());
     } finally {
-      log.error("Reconciliation completed.");
+      log.debug("Reconciliation completed.");
       trackedMDC.reset();
     }
   }
diff --git 
a/spark-operator/src/main/java/org/apache/spark/k8s/operator/utils/StatusRecorder.java
 
b/spark-operator/src/main/java/org/apache/spark/k8s/operator/utils/StatusRecorder.java
index f03187c..3ecf16e 100644
--- 
a/spark-operator/src/main/java/org/apache/spark/k8s/operator/utils/StatusRecorder.java
+++ 
b/spark-operator/src/main/java/org/apache/spark/k8s/operator/utils/StatusRecorder.java
@@ -97,13 +97,14 @@ public class StatusRecorder<
         
resource.getMetadata().setResourceVersion(updated.getMetadata().getResourceVersion());
         err = null;
       } catch (KubernetesClientException e) {
-        log.error("Error while patching status, retrying {}/{}...", i + 1, 
maxRetry, e);
+        log.warn("Error while patching status, retrying {}/{}...", i + 1, 
maxRetry, e);
         
Thread.sleep(TimeUnit.SECONDS.toMillis(API_RETRY_ATTEMPT_AFTER_SECONDS.getValue()));
         err = e;
       }
     }
 
     if (err != null) {
+      log.error("Fail to patch status.", err);
       throw err;
     }
 


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

Reply via email to