Skip to content

Commit

Permalink
[FLINK-31031][python] Disable the output buffer of Python process
Browse files Browse the repository at this point in the history
  • Loading branch information
dianfu committed Feb 13, 2023
1 parent c096c03 commit e22f061
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ public static void main(String[] args) throws Throwable {
*/
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void testConstructCommandsWithEntryPointModule() {
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
Expand All @@ -64,6 +64,6 @@ void testConstructCommandsWithEntryPointScript() {

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");
}
}

0 comments on commit e22f061

Please sign in to comment.