简体   繁体   中英

Python Version of WordCount is failing on Flink

On CentOS (CentOS 8.0.1905 (64bit)) I tried to run Python(3.6.8) Version of WordCount program on Flink(1.9) as described here . I got error as below. The same environment works fine with Java version of WordCount program. What is that I am missing here? Any help is greatly appreciated. Error

$ ./bin/flink run -py examples/python/table/batch/word_count.py
Starting execution of program
org.apache.flink.client.program.OptimizerPlanEnvironment$ProgramAbortException
    at org.apache.flink.client.python.PythonDriver.main(PythonDriver.java:83)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:576)
    at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:438)
    at org.apache.flink.client.program.ClusterClient.run(ClusterClient.java:274)
    at org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:746)
    at org.apache.flink.client.cli.CliFrontend.runProgram(CliFrontend.java:273)
    at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:205)
    at org.apache.flink.client.cli.CliFrontend.parseParameters(CliFrontend.java:1010)
    at org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:1083)
    at org.apache.flink.runtime.security.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:30)
    at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1083)

I think the information you provided does not show root cause. Generally speaking,we have two ways to run the example in Flink 1.9, one is the answer 1 provided earlier, which is to install the PyFlink from source, and the other is to download the binary package. as follows:

  1. Check the Python python --version It's better to use Python 2.7.6+ for Flink 1.9.

  2. Download curl -O http://mirrors.gigenet.com/apache/flink/flink-1.9.1/flink-1.9.1-bin-scala_2.11.tgz tar -zxvf flink-1.9.1-bin-scala_2.11.tgz

  3. Config(Optional) vi flink-1.9.1/conf/flink-conf.yaml -> rest.port: 4000

  4. Start cluster cd flink-1.9.1; bin/start-cluster.sh

  5. Run word count example ./bin/flink run -py examples/python/table/batch/word_count.py

More detail can be found here: https://enjoyment.cool/2020/01/19/Three-Min-Series-Run-the-Example-of-WordCount-in-PyFlink-1-9/#more

Hoping it is helpful to you!

Thanks to Jincheng Sun for your encouragement and support

I moved $FLINK_HOME/opt/python/__MACOSX to one level above. Program ran without any errors. As I am running on Linux, I do not need __MACOSX. I will simply delete it

在运行测试之前,您应该使用 pip 构建源代码并安装 PyFlink,详细信息可以在这里找到: https ://ci.apache.org/projects/flink/flink-docs-release-1.9/flinkDev/building 。 html#build-pyflink

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM