Skip to content

Commit d663cc4

Browse files
committed
[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 apache#111 from dongjoon-hyun/SPARK-49404. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 671c33b commit d663cc4

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

spark-operator/src/main/java/org/apache/spark/k8s/operator/probe/HealthProbe.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,10 @@ private boolean checkInformersHealth(RuntimeInfo operatorRuntimeInfo) {
100100
} else {
101101
if (log.isErrorEnabled()) {
102102
log.error(
103-
"Controller: {}, Event Source: {}, Informer: {} is not in a healthy state",
103+
"Controller: {}, Event Source: {}, Informer: {} is in {}, not a healthy state",
104104
controllerEntry.getKey(),
105105
eventSourceEntry.getKey(),
106+
informerEntry.getValue().getStatus(),
106107
informerEntry.getKey());
107108
}
108109
informersHealthList.add(false);

spark-operator/src/main/java/org/apache/spark/k8s/operator/reconciler/SparkAppReconciler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public UpdateControl<SparkApplication> reconcile(
9393
sparkApplication, context.getClient())) {
9494
return UpdateControl.noUpdate();
9595
}
96-
log.debug("Start reconciliation.");
96+
log.debug("Start application reconciliation.");
9797
sparkAppStatusRecorder.updateStatusFromCache(sparkApplication);
9898
SparkAppContext ctx = new SparkAppContext(sparkApplication, context, submissionWorker);
9999
List<AppReconcileStep> reconcileSteps = getReconcileSteps(sparkApplication);

spark-operator/src/main/java/org/apache/spark/k8s/operator/reconciler/SparkAppResourceSpecFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ private static void deleteLocalFileFromPathKey(
113113
log.warn("Local temp file not found at {}", pathKey);
114114
}
115115
} catch (Throwable t) {
116-
log.error("Failed to delete temp file. Attempting delete upon exit.", t);
116+
log.warn("Failed to delete temp file. Attempting delete upon exit.", t);
117117
} finally {
118118
if (!deleted && localFile.isPresent() && localFile.get().exists()) {
119119
localFile.get().deleteOnExit();

spark-operator/src/main/java/org/apache/spark/k8s/operator/reconciler/SparkClusterReconciler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public UpdateControl<SparkCluster> reconcile(
7878
if (sentinelManager.handleSentinelResourceReconciliation(sparkCluster, context.getClient())) {
7979
return UpdateControl.noUpdate();
8080
}
81-
log.error("Start SparkClusterReconciler.");
81+
log.debug("Start cluster reconciliation.");
8282
sparkClusterStatusRecorder.updateStatusFromCache(sparkCluster);
8383
SparkClusterContext ctx = new SparkClusterContext(sparkCluster, context, submissionWorker);
8484
List<ClusterReconcileStep> reconcileSteps = getReconcileSteps(sparkCluster);
@@ -90,7 +90,7 @@ public UpdateControl<SparkCluster> reconcile(
9090
}
9191
return ReconcilerUtils.toUpdateControl(sparkCluster, completeAndDefaultRequeue());
9292
} finally {
93-
log.error("Reconciliation completed.");
93+
log.debug("Reconciliation completed.");
9494
trackedMDC.reset();
9595
}
9696
}

spark-operator/src/main/java/org/apache/spark/k8s/operator/utils/StatusRecorder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,14 @@ private void patchAndStatusWithVersionLocked(CR resource, KubernetesClient clien
9797
resource.getMetadata().setResourceVersion(updated.getMetadata().getResourceVersion());
9898
err = null;
9999
} catch (KubernetesClientException e) {
100-
log.error("Error while patching status, retrying {}/{}...", i + 1, maxRetry, e);
100+
log.warn("Error while patching status, retrying {}/{}...", i + 1, maxRetry, e);
101101
Thread.sleep(TimeUnit.SECONDS.toMillis(API_RETRY_ATTEMPT_AFTER_SECONDS.getValue()));
102102
err = e;
103103
}
104104
}
105105

106106
if (err != null) {
107+
log.error("Fail to patch status.", err);
107108
throw err;
108109
}
109110

0 commit comments

Comments
 (0)