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

[Bug][flink-runtime][connectors-v2] Flink register table Environment The running mode is set tojob.mode #4826

Merged
merged 13 commits into from
Aug 14, 2023
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
@@ -123,8 +123,10 @@ public int currentUnassignedSplitSize() {

@Override
public void registerReader(int subtaskId) {
Set<Integer> readers = context.registeredReaders();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change it?

I just reconfirmed that there is no such problem, I have restored it

pendingSplit = getFileSplit();
assignSplit(subtaskId);
readers.forEach(context::signalNoMoreSplits);
}

@Override
Original file line number Diff line number Diff line change
@@ -26,13 +26,15 @@
import org.apache.seatunnel.common.Constants;
import org.apache.seatunnel.common.config.Common;
import org.apache.seatunnel.common.config.TypesafeConfigUtils;
import org.apache.seatunnel.common.constants.JobMode;
import org.apache.seatunnel.common.utils.SeaTunnelException;
import org.apache.seatunnel.core.starter.exception.TaskExecuteException;
import org.apache.seatunnel.core.starter.execution.PluginExecuteProcessor;
import org.apache.seatunnel.core.starter.execution.RuntimeEnvironment;
import org.apache.seatunnel.core.starter.execution.TaskExecution;
import org.apache.seatunnel.core.starter.flink.FlinkStarter;

import org.apache.flink.api.common.RuntimeExecutionMode;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.types.Row;

@@ -111,6 +113,12 @@ public void execute() throws TaskExecuteException {
"Flink Execution Plan: {}",
flinkRuntimeEnvironment.getStreamExecutionEnvironment().getExecutionPlan());
log.info("Flink job name: {}", flinkRuntimeEnvironment.getJobName());
if (!flinkRuntimeEnvironment.isStreaming()) {
flinkRuntimeEnvironment
.getStreamExecutionEnvironment()
.setRuntimeMode(RuntimeExecutionMode.BATCH);
log.info("Flink job Mode: {}", JobMode.BATCH);
}
try {
flinkRuntimeEnvironment
.getStreamExecutionEnvironment()
Original file line number Diff line number Diff line change
@@ -71,13 +71,17 @@ public List<DataStream<Row>> execute(List<DataStream<Row>> upstreamDataStreams)
} else {
sourceFunction = new SeaTunnelParallelSource(internalSource);
}
boolean bounded =
internalSource.getBoundedness()
== org.apache.seatunnel.api.source.Boundedness.BOUNDED
? true
: false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
boolean bounded =
internalSource.getBoundedness()
== org.apache.seatunnel.api.source.Boundedness.BOUNDED
? true
: false;
boolean bounded = internalSource.getBoundedness() == org.apache.seatunnel.api.source.Boundedness.BOUNDED

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

DataStreamSource<Row> sourceStream =
addSource(
executionEnvironment,
sourceFunction,
"SeaTunnel " + internalSource.getClass().getSimpleName(),
internalSource.getBoundedness()
== org.apache.seatunnel.api.source.Boundedness.BOUNDED);
bounded);
Config pluginConfig = pluginConfigs.get(i);
if (pluginConfig.hasPath(CommonOptions.PARALLELISM.key())) {
int parallelism = pluginConfig.getInt(CommonOptions.PARALLELISM.key());