Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-18598][python][docs] Add instructions for asynchronous execute in PyFlink doc. #13295

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/dev/python/faq.md
Expand Up @@ -52,6 +52,21 @@ $ source venv/bin/activate
$ python xxx.py
{% endhighlight %}

**Note:** When executing jobs in mini-cluster asynchronously (e.g. TableEnvironment.execute_sql, StatementSet.execute,
etc in the Python Table API; StreamExecutionEnvironment.execute_async in the Python DataStream API), remember to get a
`JobClient` to wait for the execution to be finished, or the program will exit directly before the submitted job is
finished. Please refer to the code snippet bellow:

{% highlight python %}
# execute SQL / Table API query asynchronously
t_result = table_env.execute_sql(...)
t_result.get_job_client().get_job_execution_result().result()

# execute DataStream Job asynchronously
job_client = stream_execution_env.execute_async('My DataStream Job')
job_client.get_job_execution_result().result()
{% endhighlight %}

#### Cluster

{% highlight shell %}
Expand Down
14 changes: 14 additions & 0 deletions docs/dev/python/faq.zh.md
Expand Up @@ -51,6 +51,20 @@ $ source venv/bin/activate
$ python xxx.py
{% endhighlight %}

**注意:** 当在 mini-cluster 环境异步执行作业的时 (如 Python Table API 的 TableEnvironment.execute_sql, StatementSet.execute,
和 Python DataStream API 的 StreamExecutionEnvironment.execute_async),记得用返回的 `JobClient` 等待作业结束,否则程序会在已提
交的作业执行完之前就结束退出,以致无法观测到已提交作业的执行结果。请参考如下代码:

{% highlight python %}
# 异步执行 SQL / Table API 查询
t_result = table_env.execute_sql(...)
t_result.get_job_client().get_job_execution_result().result()

# 异步提交 DataStream 作业
job_client = stream_execution_env.execute_async('My DataStream Job')
job_client.get_job_execution_result().result()
{% endhighlight %}

#### 集群(Cluster)

{% highlight shell %}
Expand Down