Pyflink 提交 Batch 任务后报错 “Failed to execute sql”

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Pyflink 提交 Batch 任务后报错 “Failed to execute sql”

YueKun
This post was updated on .
Hi, 请教一个问题:
近期在使用Pyflink,有个问题经常会出现,就是在提交Batch任务的时候,经常会报 “Failed to execute sql” 的错误,终端输出的具体错误信息如下:
Traceback (most recent call last):
  File "/opt/flink/ha_store/test/device_status_statistics.py", line 90, in <module>
    device_status_statistics()
  File "/opt/flink/ha_store/test/device_status_statistics.py", line 86, in device_status_statistics
    """)
  File "/opt/flink/opt/python/pyflink.zip/pyflink/table/table_environment.py", line 766, in execute_sql
  File "/opt/flink/opt/python/py4j-0.10.8.1-src.zip/py4j/java_gateway.py", line 1286, in __call__
  File "/opt/flink/opt/python/pyflink.zip/pyflink/util/exceptions.py", line 162, in deco
pyflink.util.exceptions.TableException: Failed to execute sql
     at org.apache.flink.table.api.internal.TableEnvironmentImpl.executeInternal(TableEnvironmentImpl.java:696)
     at org.apache.flink.table.api.internal.TableEnvironmentImpl.executeOperation(TableEnvironmentImpl.java:759)
     at org.apache.flink.table.api.internal.TableEnvironmentImpl.executeSql(TableEnvironmentImpl.java:665)
     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
     at java.base/java.lang.reflect.Method.invoke(Unknown Source)
     at org.apache.flink.api.python.shaded.py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
     at org.apache.flink.api.python.shaded.py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
     at org.apache.flink.api.python.shaded.py4j.Gateway.invoke(Gateway.java:282)
     at org.apache.flink.api.python.shaded.py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
     at org.apache.flink.api.python.shaded.py4j.commands.CallCommand.execute(CallCommand.java:79)
     at org.apache.flink.api.python.shaded.py4j.GatewayConnection.run(GatewayConnection.java:238)
     at java.base/java.lang.Thread.run(Unknown Source)
org.apache.flink.client.program.ProgramAbortException
    at org.apache.flink.client.python.PythonDriver.main(PythonDriver.java:113)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:316)
    at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:198)
    at org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:114)
    at org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:743)
    at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:242)
    at org.apache.flink.client.cli.CliFrontend.parseAndRun(CliFrontend.java:971)
    at org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:1047)
    at org.apache.flink.runtime.security.contexts.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:30)
    at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1047)

从这个错误信息中我看不出来是什么原因导致的执行失败,同样的任务,我重试提交执行,有时候却可以执行成功。当报这个错的时候,我在Job Manager的日志里也没有看到有相关日志信息打印,看起来像是没有提交到Job Manager。

我使用的Flink版本是1.12版本,使用的Docker部署,镜像文件是我自己根据官方教程编译的(暂时还没找到官方发布的)。
我的Batch任务的source是mysql,pyflink任务引用了flink-connector-jdbc_2.11-1.12.0.jar,mysql-connector-java-5.1.49.jar包。任务内容比较简单,就是插叙下Mysql的表,然后统计个数据。

希望能得到你们的帮助和回复,非常感谢,如有其他需要提供的信息我可以随时提供

Reply | Threaded
Open this post in threaded view
|

Re: Pyflink 提交 Batch 任务后报错 “Failed to execute sql”

YueKun
结束这个问题,目前没有再出现,可能是以下两个原因的一个:
1. 更新了 Flink 版本,从 1.12.0 更新至 1.12.1
2. 扩大了Task Off-Heap 空间



--
Sent from: http://apache-flink.147419.n8.nabble.com/