为 Python 中的单个操作设置并行度

Set degree of parallelism for a single operation in Python

我用 dop > 1 执行我的程序,但我不想要多个输出文件。 Java myDataSet.writeAsText(outputFilePath, WriteMode.OVERWRITE).setParallelism(1); 正在按预期工作。

但是当我在 Python 中尝试相同的方法时,它不起作用。这是我的代码:myDataSet.write_text(output_file, write_mode=WriteMode.OVERWRITE).set_degree_of_parallelism(1)

是否有可能在 Python 中实现此行为?

这不是错误,而是不受支持的功能。目前无法为单个算子设置并行度,只能为整个作业设置。

我为此打开了一个 JIRA:https://issues.apache.org/jira/browse/FLINK-3275

对于不知道的用户,Apache Flink 在几个月前添加了此功能。

这是来自 Flink 的简短文档:-

The default parallelism can be overwriten for an entire job by calling setParallelism(int parallelism) on the ExecutionEnvironment or by passing -p to the Flink Command-line frontend. It can be overwritten for single transformations by calling setParallelism(int parallelism) on an operator.