Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[MINOR] fix(core): Increase the timeout to fix the flaky test (#7878)

Jerry Shaoff4bb56f0cdd
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));