forked from apache/seatunnel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] [api env] Add job-level configuration for checkpoint timeou…
…t. (apache#5222)
- Loading branch information
Showing
13 changed files
with
236 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
...er/src/test/java/org/apache/seatunnel/engine/server/checkpoint/CheckpointTimeOutTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.seatunnel.engine.server.checkpoint; | ||
|
||
import org.apache.seatunnel.engine.common.utils.PassiveCompletableFuture; | ||
import org.apache.seatunnel.engine.core.dag.logical.LogicalDag; | ||
import org.apache.seatunnel.engine.core.job.JobImmutableInformation; | ||
import org.apache.seatunnel.engine.core.job.JobStatus; | ||
import org.apache.seatunnel.engine.server.AbstractSeaTunnelServerTest; | ||
import org.apache.seatunnel.engine.server.TestUtils; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import com.hazelcast.internal.serialization.Data; | ||
|
||
import java.util.Collections; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
import static org.awaitility.Awaitility.await; | ||
|
||
public class CheckpointTimeOutTest extends AbstractSeaTunnelServerTest { | ||
|
||
public static String CONF_PATH = "stream_fake_to_console_checkpointTimeOut.conf"; | ||
public static long JOB_ID = System.currentTimeMillis(); | ||
|
||
@Test | ||
public void testJobLevelCheckpointTimeOut() { | ||
startJob(JOB_ID, CONF_PATH); | ||
|
||
await().atMost(120000, TimeUnit.MILLISECONDS) | ||
.untilAsserted( | ||
() -> { | ||
Assertions.assertTrue( | ||
server.getCoordinatorService() | ||
.getJobStatus(JOB_ID) | ||
.equals(JobStatus.RUNNING)); | ||
}); | ||
|
||
await().atMost(120000, TimeUnit.MILLISECONDS) | ||
.untilAsserted( | ||
() -> { | ||
Assertions.assertTrue( | ||
server.getCoordinatorService() | ||
.getJobStatus(JOB_ID) | ||
.equals(JobStatus.FAILED)); | ||
}); | ||
} | ||
|
||
private void startJob(Long jobid, String path) { | ||
LogicalDag testLogicalDag = TestUtils.createTestLogicalPlan(path, jobid.toString(), jobid); | ||
|
||
JobImmutableInformation jobImmutableInformation = | ||
new JobImmutableInformation( | ||
jobid, | ||
"Test", | ||
false, | ||
nodeEngine.getSerializationService().toData(testLogicalDag), | ||
testLogicalDag.getJobConfig(), | ||
Collections.emptyList()); | ||
|
||
Data data = nodeEngine.getSerializationService().toData(jobImmutableInformation); | ||
|
||
PassiveCompletableFuture<Void> voidPassiveCompletableFuture = | ||
server.getCoordinatorService().submitJob(jobid, data); | ||
voidPassiveCompletableFuture.join(); | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
.../seatunnel-engine-server/src/test/resources/stream_fake_to_console_checkpointTimeOut.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
###### | ||
###### This config file is a demonstration of streaming processing in seatunnel config | ||
###### | ||
|
||
env { | ||
# You can set flink configuration here | ||
execution.parallelism = 1 | ||
job.mode = "STREAMING" | ||
checkpoint.interval = 1000 | ||
checkpoint.timeout = 100 | ||
} | ||
|
||
source { | ||
# This is a example source plugin **only for test and demonstrate the feature source plugin** | ||
FakeSource { | ||
result_table_name = "fake1" | ||
row.num = 1000 | ||
split.num = 100 | ||
split.read-interval = 3000 | ||
parallelism = 1 | ||
schema = { | ||
fields { | ||
name = "string" | ||
age = "int" | ||
} | ||
} | ||
parallelism = 1 | ||
} | ||
} | ||
|
||
transform { | ||
} | ||
|
||
sink { | ||
console { | ||
log.print.delay.ms=5000 | ||
} | ||
} |