nzw921rx commented on code in PR #11495:
URL: https://github.com/apache/seatunnel/pull/11495#discussion_r3631704158
##########
seatunnel-engine/seatunnel-engine-server/src/test/java/org/apache/seatunnel/engine/server/dag/physical/StateTransitionCleanupTest.java:
##########
@@ -97,6 +105,57 @@ void
testPhysicalPlanIgnoresLateTransitionWhenJobStateAlreadyTerminal() throws E
Assertions.assertEquals(JobStatus.FAILED,
planWithStateMaps.runningJobState.get(jobId));
}
+ @Test
+ void testPipelineRestoreClearsMetricsFromTheFailedAttempt() throws
Exception {
+ long jobId =
instance.getFlakeIdGenerator(Constant.SEATUNNEL_ID_GENERATOR_NAME).newId();
+ JobImmutableInformation jobImmutableInformation =
mock(JobImmutableInformation.class);
+ JobConfig jobConfig = mock(JobConfig.class);
+ Map<String, Object> envOptions = new HashMap<>();
+ envOptions.put("job.retry.times", "1");
+ envOptions.put("job.retry.interval.seconds", "0");
+ when(jobImmutableInformation.getJobId()).thenReturn(jobId);
+ when(jobImmutableInformation.getJobConfig()).thenReturn(jobConfig);
+ when(jobConfig.getEnvOptions()).thenReturn(envOptions);
+
+ IMap<Object, Object> runningJobState =
+
nodeEngine.getHazelcastInstance().getMap("restoreMetricsState-" + jobId);
+ IMap<Object, Long[]> runningJobStateTimestamps =
+
nodeEngine.getHazelcastInstance().getMap("restoreMetricsStateTimestamps-" +
jobId);
+ PipelineLocation pipelineLocation = new PipelineLocation(jobId, 1);
+ runningJobState.put(pipelineLocation, PipelineStatus.FAILED);
+
+ ExecutorService executorService = Executors.newSingleThreadExecutor();
+ try {
+ SubPlan subPlan =
+ new SubPlan(
+ 1,
+ 1,
+ System.currentTimeMillis(),
+ Collections.emptyList(),
+ Collections.emptyList(),
+ jobImmutableInformation,
+ executorService,
+ runningJobState,
+ runningJobStateTimestamps,
+ Collections.emptyMap());
+ JobMaster jobMaster = mock(JobMaster.class);
+ CheckpointManager checkpointManager =
mock(CheckpointManager.class);
+ PhysicalPlan physicalPlan = mock(PhysicalPlan.class);
+
when(jobMaster.getCheckpointManager()).thenReturn(checkpointManager);
+ when(jobMaster.getPhysicalPlan()).thenReturn(physicalPlan);
+ subPlan.setJobMaster(jobMaster);
+
+ java.lang.reflect.Method restore =
Review Comment:
please use `import java.lang.reflect.Method `
--
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]