简体   繁体   English

flink run -py 和 python run 的区别

[英]Difference between flink run -py and python run

I recently working on learning pyflink, but I was a little bit confused.我最近在学习pyflink,但我有点困惑。 We know that pyflink table API convert stream/batch into table and do some work on it and finally sink to where u want.我们知道 pyflink 表 API 将流/批处理转换为表并对其进行一些工作,最后下沉到您想要的位置。 However, there are several ways to create table env:但是,有几种方法可以创建表环境:

For batch example:对于批处理示例:

t_config = TableConfig()
env = ExecutionEnvironment.get_execution_environment()
t_env = BatchTableEnvironment.create(env, t_config)

and

env_settings = EnvironmentSettings.new_instance().in_batch_mode().use_blink_planner().build()
t_env = BatchTableEnvironment.create(evnironment_settings = env_settings)

but I found one of them only work for flink run -py batch.py, some other styles can be run as python batch.py for local run.但我发现其中一个仅适用于 flink run -py batch.py,其他一些 styles 可以作为 python batch.py 运行以进行本地运行。

My question is what the difference of executionEnvironment and BatchTableEnvironment/StreamTableEnvironment, and when can use flink run -py and when can run by python interpreter with pyflink installed?我的问题是 executionEnvironment 和 BatchTableEnvironment/StreamTableEnvironment 的区别,什么时候可以使用 flink run -py 以及什么时候可以通过安装了 pyflink 的 python 解释器运行?

Thx谢谢

with flink run there is some configuration to set in .sh , you could consider the flink run is some bash scripts plus to the python xx itself.使用flink run.sh中设置一些配置,您可以认为flink run是一些 bash 脚本加上python xx本身。

for more information you could go to $FLINK_HOME/bin/flink or flink-dist/src/flink-bin/flink有关更多信息,您可以 go 到$FLINK_HOME/bin/flinkflink-dist/src/flink-bin/flink

The flink run way is used to submit jobs to run on the cluster. flink run方式用于提交作业在集群上运行。 And the way of python xxx.py is to run the job directly in the local memorypython xxx.py的方式是直接在本地运行作业memory

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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