Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API-DRAFT] [MERGE] Fix obvious bugs that don't work properly before merge #2082

Merged
merged 1 commit into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions config/flink.batch.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ env {

source {
# This is a example input plugin **only for test and demonstrate the feature input plugin**
FileSource {
path = "hdfs://localhost:9000/output/text"
format.type = "text"
schema = "string"
result_table_name = "test"
}
FakeSource {
result_table_name = "test"
field_name = "name,age"
}


# If you would like to get more information about how to configure seatunnel and see full list of input plugins,
# please go to https://seatunnel.apache.org/docs/flink/configuration/source-plugins/Fake
Expand Down
2 changes: 1 addition & 1 deletion config/spark.streaming.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ env {

source {
# This is a example input plugin **only for test and demonstrate the feature input plugin**
fakeStream {
FakeStream {
content = ["Hello World, SeaTunnel"]
}

Expand Down
1 change: 1 addition & 0 deletions plugin-mapping.properties
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ flink.sink.Kafka = seatunnel-connector-flink-kafka

spark.source.ElasticSearch = seatunnel-connector-spark-elasticsearch
spark.source.Fake = seatunnel-connector-spark-fake
spark.source.FakeStream = seatunnel-connector-spark-fake
spark.source.FeishuSheet = seatunnel-connector-spark-feishu
spark.source.File = seatunnel-connector-spark-file
spark.source.Hbase = seatunnel-connector-spark-hbase
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@
<module>seatunnel-core</module>
<module>seatunnel-transforms</module>
<module>seatunnel-connectors</module>
<module>seatunnel-dist</module>
<module>seatunnel-connectors-v2</module>
<module>seatunnel-connectors-v2-dist</module>
<module>seatunnel-examples</module>
<module>seatunnel-e2e</module>
<module>seatunnel-api</module>
<module>seatunnel-translation</module>
<module>seatunnel-plugin-discovery</module>
<module>seatunnel-formats</module>
<module>seatunnel-connectors-v2</module>
<module>seatunnel-connectors-v2-dist</module>
<module>seatunnel-dist</module>
</modules>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,13 @@ public JobMode getJobMode() {

@SuppressWarnings("checkstyle:Indentation")
protected List<PluginIdentifier> getPluginIdentifiers(PluginType... pluginTypes) {
return Arrays.stream(pluginTypes).flatMap(new Function<PluginType, Stream<PluginIdentifier>>() {
@Override
public Stream<PluginIdentifier> apply(PluginType pluginType) {
List<? extends Config> configList = config.getConfigList(pluginType.getType());
return configList.stream()
.map(pluginConfig -> PluginIdentifier
.of(engine.getEngine(),
pluginType.getType(),
pluginConfig.getString("plugin_name")));
}
return Arrays.stream(pluginTypes).flatMap((Function<PluginType, Stream<PluginIdentifier>>) pluginType -> {
List<? extends Config> configList = config.getConfigList(pluginType.getType());
return configList.stream()
.map(pluginConfig -> PluginIdentifier
.of(engine.getEngine(),
pluginType.getType(),
pluginConfig.getString("plugin_name")));
}).collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@
import org.apache.seatunnel.common.Constants;
import org.apache.seatunnel.common.config.Common;
import org.apache.seatunnel.common.config.DeployMode;
import org.apache.seatunnel.common.constants.PluginType;
import org.apache.seatunnel.core.base.Starter;
import org.apache.seatunnel.core.base.config.ConfigBuilder;
import org.apache.seatunnel.core.base.config.EngineType;
import org.apache.seatunnel.core.base.utils.CompressionUtils;
import org.apache.seatunnel.core.spark.args.SparkCommandArgs;
import org.apache.seatunnel.core.spark.config.SparkExecutionContext;
import org.apache.seatunnel.plugin.discovery.PluginIdentifier;
import org.apache.seatunnel.plugin.discovery.spark.SparkSinkPluginDiscovery;
import org.apache.seatunnel.plugin.discovery.spark.SparkSourcePluginDiscovery;

import org.apache.seatunnel.shade.com.typesafe.config.Config;
import org.apache.seatunnel.shade.com.typesafe.config.ConfigFactory;
Expand All @@ -40,6 +43,7 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand All @@ -50,6 +54,7 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

Expand Down Expand Up @@ -220,8 +225,12 @@ private List<Path> getConnectorJarDependencies() {
return Collections.emptyList();
}
Config config = new ConfigBuilder(Paths.get(commandArgs.getConfigFile())).getConfig();
SparkExecutionContext sparkExecutionContext = new SparkExecutionContext(config, EngineType.SPARK);
return sparkExecutionContext.getPluginJars().stream().map(url -> new File(url.getPath()).toPath()).collect(Collectors.toList());
List<URL> pluginJars = new ArrayList<>();
SparkSourcePluginDiscovery sparkSourcePluginDiscovery = new SparkSourcePluginDiscovery();
SparkSinkPluginDiscovery sparkSinkPluginDiscovery = new SparkSinkPluginDiscovery();
pluginJars.addAll(sparkSourcePluginDiscovery.getPluginJarPaths(getPluginIdentifiers(config, PluginType.SOURCE)));
pluginJars.addAll(sparkSinkPluginDiscovery.getPluginJarPaths(getPluginIdentifiers(config, PluginType.SINK)));
return pluginJars.stream().map(url -> new File(url.getPath()).toPath()).collect(Collectors.toList());
}

/**
Expand Down Expand Up @@ -313,6 +322,18 @@ protected void appendAppJar(List<String> commands) {
commands.add(Common.appLibDir().resolve("seatunnel-core-spark.jar").toString());
}

@SuppressWarnings("checkstyle:Indentation")
private List<PluginIdentifier> getPluginIdentifiers(Config config, PluginType... pluginTypes) {
return Arrays.stream(pluginTypes).flatMap((Function<PluginType, Stream<PluginIdentifier>>) pluginType -> {
List<? extends Config> configList = config.getConfigList(pluginType.getType());
return configList.stream()
.map(pluginConfig -> PluginIdentifier
.of(EngineType.SPARK.getEngine(),
pluginType.getType(),
pluginConfig.getString("plugin_name")));
}).collect(Collectors.toList());
}

/**
* a Starter for building spark-submit commands with client mode options
*/
Expand Down
1 change: 1 addition & 0 deletions seatunnel-dist/src/main/assembly/assembly-bin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
</includes>
<excludes>
<exclude>%regex[.*((javadoc)|(sources))\.jar]</exclude>
<exclude>connector-common*.jar</exclude>
</excludes>
<outputDirectory>/connectors/seatunnel</outputDirectory>
</fileSet>
Expand Down