jerryshao commented on code in PR #14230:
URL: https://github.com/apache/gravitino/pull/14230#discussion_r4377118623


##########
plugins/k8s-job-executor/src/main/java/org/apache/gravitino/job/k8s/K8sJobExecutor.java:
##########
@@ -129,17 +139,13 @@ void initialize(K8sJobExecutorConfigs configs, 
KubernetesClient client) {
     this.sparkApplicationCache =
         new NamespacedResourceCache<>(
             configs.statusCacheTtlMs(),
-            namespace ->
-                getSparkApplicationClient(namespace)
-                    .withLabel(
-                        K8sJobResourceUtils.LABEL_MANAGED_BY,
-                        K8sJobResourceUtils.MANAGED_BY_GRAVITINO)
-                    .list()
-                    .getItems(),
-            // Getting the SparkApplication itself couldn't reach the API 
server either.
+            this::listSparkApplications,
+            // Getting the SparkApplication itself couldn't reach the API 
server either. A listing
+            // that the API server is too slow to answer isn't, it gets the 
jobs one by one instead.
             e ->
                 e instanceof KubernetesClientException
-                    && isUnreachable((KubernetesClientException) e),
+                    && isUnreachable((KubernetesClientException) e)
+                    && !isResponseTimedOut((KubernetesClientException) e),

Review Comment:
   Both parts addressed in da419bb3b8.
   
   1. Confirmed: with retries (backoff limit 2) fabric8 still throws 
`KubernetesClientException` caused by `IOException` caused by 
`HttpTimeoutException` after the last attempt, so `isResponseTimedOut` holds. 
`testSlowListingFallsBackToGet` now uses a client that retries, like the 
executor's, instead of `clientWithoutRetries`.
   2. Agreed, ~30 s per 5 s window was too much. A failed listing is now cached 
for 10 minutes (`NamespacedResourceCache.FAILED_LIST_TTL_MS`, at least the 
TTL), during which the jobs are got one by one with the same results, so a 
namespace whose listing times out costs one slow listing per 10 minutes.
   
   _🤖 Addressed by [Claude Code](https://claude.com/claude-code)_



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