You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by di...@apache.org on 2023/02/13 08:38:08 UTC
[flink] branch release-1.17 updated: [FLINK-31031][python] Disable the output buffer of Python process
This is an automated email from the ASF dual-hosted git repository.
dianfu pushed a commit to branch release-1.17
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.17 by this push:
new 5344b8a59af [FLINK-31031][python] Disable the output buffer of Python process
5344b8a59af is described below
commit 5344b8a59afbb17740ee363f22fe79fe0d5d50b2
Author: Dian Fu <di...@apache.org>
AuthorDate: Mon Feb 13 16:22:56 2023 +0800
[FLINK-31031][python] Disable the output buffer of Python process
---
.../src/main/java/org/apache/flink/client/python/PythonDriver.java | 2 ++
.../test/java/org/apache/flink/client/python/PythonDriverTest.java | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/flink-python/src/main/java/org/apache/flink/client/python/PythonDriver.java b/flink-python/src/main/java/org/apache/flink/client/python/PythonDriver.java
index 57b1eb2f32d..ed439415418 100644
--- a/flink-python/src/main/java/org/apache/flink/client/python/PythonDriver.java
+++ b/flink-python/src/main/java/org/apache/flink/client/python/PythonDriver.java
@@ -154,6 +154,8 @@ public final class PythonDriver {
*/
static List<String> constructPythonCommands(final PythonDriverOptions pythonDriverOptions) {
final List<String> commands = new ArrayList<>();
+ // disable output buffer
+ commands.add("-u");
if (pythonDriverOptions.getEntryPointScript().isPresent()) {
commands.add(pythonDriverOptions.getEntryPointScript().get());
} else {
diff --git a/flink-python/src/test/java/org/apache/flink/client/python/PythonDriverTest.java b/flink-python/src/test/java/org/apache/flink/client/python/PythonDriverTest.java
index 6579ce0d9d5..d8b174e7f3b 100644
--- a/flink-python/src/test/java/org/apache/flink/client/python/PythonDriverTest.java
+++ b/flink-python/src/test/java/org/apache/flink/client/python/PythonDriverTest.java
@@ -53,7 +53,7 @@ class PythonDriverTest {
PythonDriverOptions pythonDriverOptions = new PythonDriverOptions("xxx", null, args);
List<String> commands = PythonDriver.constructPythonCommands(pythonDriverOptions);
// verify the generated commands
- assertThat(commands).containsExactly("-m", "xxx", "--input", "in.txt");
+ assertThat(commands).containsExactly("-u", "-m", "xxx", "--input", "in.txt");
}
@Test
@@ -64,6 +64,6 @@ class PythonDriverTest {
PythonDriverOptions pythonDriverOptions = new PythonDriverOptions(null, "xxx.py", args);
List<String> commands = PythonDriver.constructPythonCommands(pythonDriverOptions);
- assertThat(commands).containsExactly("xxx.py", "--input", "in.txt");
+ assertThat(commands).containsExactly("-u", "xxx.py", "--input", "in.txt");
}
}