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

yuqi4733 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/main by this push:
     new ff4bb56f0c [MINOR] fix(core): Increase the timeout to fix the flaky 
test (#7878)
ff4bb56f0c is described below

commit ff4bb56f0cdd7d079a942dd96d6b74d5519ba0f1
Author: Jerry Shao <[email protected]>
AuthorDate: Mon Aug 4 17:38:57 2025 +0800

    [MINOR] fix(core): Increase the timeout to fix the flaky test (#7878)
    
    ### What changes were proposed in this pull request?
    
    Increase the timeout in LocalJobExecutor test to increase the stability.
    
    ### Why are the changes needed?
    
    To fix the flaky test.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Rerun test tests.
---
 .../org/apache/gravitino/job/local/LocalJobExecutor.java     | 10 +++++++---
 .../org/apache/gravitino/job/local/TestLocalJobExecutor.java | 12 ++++++------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git 
a/core/src/main/java/org/apache/gravitino/job/local/LocalJobExecutor.java 
b/core/src/main/java/org/apache/gravitino/job/local/LocalJobExecutor.java
index 8674903f8c..b8e41b851e 100644
--- a/core/src/main/java/org/apache/gravitino/job/local/LocalJobExecutor.java
+++ b/core/src/main/java/org/apache/gravitino/job/local/LocalJobExecutor.java
@@ -174,7 +174,11 @@ public class LocalJobExecutor implements JobExecutor {
       if (!jobStatus.containsKey(jobId)) {
         throw new NoSuchJobException("No job found with ID: %s", jobId);
       }
-
+      LOG.trace(
+          "Get status {} and finished time {} for job {}",
+          jobStatus.get(jobId).getLeft(),
+          jobStatus.get(jobId).getRight(),
+          jobId);
       return jobStatus.get(jobId).getLeft();
     }
   }
@@ -274,8 +278,6 @@ public class LocalJobExecutor implements JobExecutor {
         }
       }
 
-      runningProcesses.remove(jobId);
-
     } catch (Exception e) {
       LOG.error("Error while executing job", e);
       // If an error occurs, we should mark the job as failed
@@ -284,6 +286,8 @@ public class LocalJobExecutor implements JobExecutor {
         jobStatus.put(jobId, Pair.of(JobHandle.Status.FAILED, 
System.currentTimeMillis()));
       }
     }
+
+    runningProcesses.remove(jobPair.getLeft());
   }
 
   public void pollJob() {
diff --git 
a/core/src/test/java/org/apache/gravitino/job/local/TestLocalJobExecutor.java 
b/core/src/test/java/org/apache/gravitino/job/local/TestLocalJobExecutor.java
index c88c0811df..fae19ad422 100644
--- 
a/core/src/test/java/org/apache/gravitino/job/local/TestLocalJobExecutor.java
+++ 
b/core/src/test/java/org/apache/gravitino/job/local/TestLocalJobExecutor.java
@@ -118,7 +118,7 @@ public class TestLocalJobExecutor {
     Assertions.assertNotNull(jobId);
 
     Awaitility.await()
-        .atMost(10, TimeUnit.SECONDS)
+        .atMost(3, TimeUnit.MINUTES)
         .until(() -> jobExecutor.getJobStatus(jobId) == 
JobHandle.Status.SUCCEEDED);
 
     String output = FileUtils.readFileToString(new File(workingDir, 
"output.log"), "UTF-8");
@@ -145,7 +145,7 @@ public class TestLocalJobExecutor {
     Assertions.assertNotNull(jobId);
 
     Awaitility.await()
-        .atMost(10, TimeUnit.SECONDS)
+        .atMost(3, TimeUnit.MINUTES)
         .until(() -> jobExecutor.getJobStatus(jobId) == 
JobHandle.Status.FAILED);
 
     String output = FileUtils.readFileToString(new File(workingDir, 
"output.log"), "UTF-8");
@@ -171,12 +171,12 @@ public class TestLocalJobExecutor {
     String jobId = jobExecutor.submitJob(template);
     Assertions.assertNotNull(jobId);
     // sleep a while to ensure the job is running.
-    Thread.sleep(100);
+    Thread.sleep(1000);
 
     jobExecutor.cancelJob(jobId);
 
     Awaitility.await()
-        .atMost(10, TimeUnit.SECONDS)
+        .atMost(3, TimeUnit.MINUTES)
         .until(() -> jobExecutor.getJobStatus(jobId) == 
JobHandle.Status.CANCELLED);
 
     Assertions.assertEquals(JobHandle.Status.CANCELLED, 
jobExecutor.getJobStatus(jobId));
@@ -199,7 +199,7 @@ public class TestLocalJobExecutor {
         JobManager.createRuntimeJobTemplate(jobTemplateEntity, successJobConf, 
workingDir);
     String successJobId = jobExecutor.submitJob(successTemplate);
     Awaitility.await()
-        .atMost(10, TimeUnit.SECONDS)
+        .atMost(3, TimeUnit.MINUTES)
         .until(() -> jobExecutor.getJobStatus(successJobId) == 
JobHandle.Status.SUCCEEDED);
 
     Assertions.assertDoesNotThrow(() -> jobExecutor.cancelJob(successJobId));
@@ -219,7 +219,7 @@ public class TestLocalJobExecutor {
         JobManager.createRuntimeJobTemplate(jobTemplateEntity, failJobConf, 
workingDir);
     String failJobId = jobExecutor.submitJob(failTemplate);
     Awaitility.await()
-        .atMost(10, TimeUnit.SECONDS)
+        .atMost(3, TimeUnit.MINUTES)
         .until(() -> jobExecutor.getJobStatus(failJobId) == 
JobHandle.Status.FAILED);
 
     Assertions.assertDoesNotThrow(() -> jobExecutor.cancelJob(failJobId));

Reply via email to