From 3f4b45163d67240f74219ea5df4d5cc2d6e08e10 Mon Sep 17 00:00:00 2001 From: Roc Marshal Date: Tue, 10 Oct 2023 21:00:38 +0800 Subject: [PATCH] [ISSUE-3114][Improve] Improve streampark-testcontainer module based on [3.7 Code Comments Rule] --- .../streampark/testcontainer/flink/FlinkComponent.java | 2 ++ .../streampark/testcontainer/flink/FlinkContainer.java | 4 ++++ .../testcontainer/flink/FlinkStandaloneSessionCluster.java | 7 ++++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/streampark-tests/streampark-testcontainer/src/main/java/org/apache/streampark/testcontainer/flink/FlinkComponent.java b/streampark-tests/streampark-testcontainer/src/main/java/org/apache/streampark/testcontainer/flink/FlinkComponent.java index 13a62e01fc..ebb907690a 100644 --- a/streampark-tests/streampark-testcontainer/src/main/java/org/apache/streampark/testcontainer/flink/FlinkComponent.java +++ b/streampark-tests/streampark-testcontainer/src/main/java/org/apache/streampark/testcontainer/flink/FlinkComponent.java @@ -19,8 +19,10 @@ import javax.annotation.Nonnull; +/** The enum is used to represent the type of the flink component. */ enum FlinkComponent { JOBMANAGER("jobmanager"), + TASKMANAGER("taskmanager"); private final String name; diff --git a/streampark-tests/streampark-testcontainer/src/main/java/org/apache/streampark/testcontainer/flink/FlinkContainer.java b/streampark-tests/streampark-testcontainer/src/main/java/org/apache/streampark/testcontainer/flink/FlinkContainer.java index 2c85b86c8f..c10eba56e2 100644 --- a/streampark-tests/streampark-testcontainer/src/main/java/org/apache/streampark/testcontainer/flink/FlinkContainer.java +++ b/streampark-tests/streampark-testcontainer/src/main/java/org/apache/streampark/testcontainer/flink/FlinkContainer.java @@ -31,6 +31,10 @@ import static org.apache.streampark.testcontainer.flink.FlinkComponent.JOBMANAGER; import static org.apache.streampark.testcontainer.flink.FlinkComponent.TASKMANAGER; +/** + * The Flink container class. It would be created as a flink jobmanager container or a taskmanaager + * container. Note: It's an internal class to construct a flink session cluster. + */ class FlinkContainer extends GenericContainer { public static final AtomicInteger TM_INDEX_SUFFIX = new AtomicInteger(0); diff --git a/streampark-tests/streampark-testcontainer/src/main/java/org/apache/streampark/testcontainer/flink/FlinkStandaloneSessionCluster.java b/streampark-tests/streampark-testcontainer/src/main/java/org/apache/streampark/testcontainer/flink/FlinkStandaloneSessionCluster.java index c238675d5b..6977b89c24 100644 --- a/streampark-tests/streampark-testcontainer/src/main/java/org/apache/streampark/testcontainer/flink/FlinkStandaloneSessionCluster.java +++ b/streampark-tests/streampark-testcontainer/src/main/java/org/apache/streampark/testcontainer/flink/FlinkStandaloneSessionCluster.java @@ -37,9 +37,9 @@ import static org.apache.streampark.testcontainer.flink.FlinkComponent.TASKMANAGER; /** - * Class to start a couple of flink 1-jobmanager & n-taskmanagers. The priority of flinkYamlConfStr - * is the highest. But: The 'jobmanager.rpc.address' is always 'jobmanager'. The 'rest.port' always - * is 8081. + * Class to start a couple of flink 1-jobmanager & n-taskmanagers. The priority of + * flinkYamlConfContent is the highest. But: The 'jobmanager.rpc.address' is always 'jobmanager'. + * The 'rest.port' always is 8081. */ public class FlinkStandaloneSessionCluster implements Startable { @@ -135,6 +135,7 @@ private void renderJmRpcConfIfNeeded(@Nullable String yamlConfStr) { : String.format("%s\n%s\n", this.yamlConfContent, yamlConfStr)); } + /** A tool class to create a flink standalone session cluster quickly. */ public static class Builder { private DockerImageName dockerImageName =