This is an automated email from the ASF dual-hosted git repository.
dianfu pushed a commit to branch release-1.13
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.13 by this push:
new 2245a01 [hotfix][python][docs] Add documentation about how to set
config options in Python DataStream API program
2245a01 is described below
commit 2245a016ddfeab8d268058267419b951d3663302
Author: Dian Fu <[email protected]>
AuthorDate: Mon May 24 12:07:44 2021 +0800
[hotfix][python][docs] Add documentation about how to set config options in
Python DataStream API program
---
docs/content.zh/docs/dev/python/python_config.md | 31 +++++++++++++++++++++---
docs/content.zh/docs/dev/table/config.md | 8 +++---
docs/content/docs/dev/python/python_config.md | 31 +++++++++++++++++++++---
docs/content/docs/dev/table/config.md | 8 +++---
4 files changed, 62 insertions(+), 16 deletions(-)
diff --git a/docs/content.zh/docs/dev/python/python_config.md
b/docs/content.zh/docs/dev/python/python_config.md
index 4ffad06..93906c7 100644
--- a/docs/content.zh/docs/dev/python/python_config.md
+++ b/docs/content.zh/docs/dev/python/python_config.md
@@ -26,10 +26,33 @@ under the License.
# 配置
-Depending on the requirements of a Python Table API program, it might be
necessary to adjust certain parameters for optimization.
-All the config options available for Java/Scala Table API program could also
be used in the Python Table API program.
-You could refer to the [Table API Configuration]({{< ref
"docs/dev/table/config" >}}) for more details on all the available config
options for Java/Scala Table API programs.
-It has also provided examples on how to set the config options in a Table API
program.
+Depending on the requirements of a Python API program, it might be necessary
to adjust certain parameters for optimization.
+
+For Python DataStream API program, the config options could be set as
following:
+```python
+from pyflink.common import Configuration
+from pyflink.datastream import StreamExecutionEnvironment
+from pyflink.util.java_utils import get_j_env_configuration
+
+env = StreamExecutionEnvironment.get_execution_environment()
+config =
Configuration(j_configuration=get_j_env_configuration(env._j_stream_execution_environment))
+config.set_integer("python.fn-execution.bundle.size", 1000)
+```
+
+For Python Table API program, all the config options available for Java/Scala
Table API
+program could also be used in the Python Table API program.
+You could refer to the [Table API Configuration]({{< ref
"docs/dev/table/config" >}}) for more details
+on all the available config options for Table API programs.
+The config options could be set as following in a Table API program:
+```python
+from pyflink.table import TableEnvironment, EnvironmentSettings
+
+env_settings =
EnvironmentSettings.new_instance().in_streaming_mode().use_blink_planner().build()
+t_env = TableEnvironment.create(env_settings)
+
+config = t_env.get_config().get_configuration()
+config.set_integer("python.fn-execution.bundle.size", 1000)
+```
## Python Options
diff --git a/docs/content.zh/docs/dev/table/config.md
b/docs/content.zh/docs/dev/table/config.md
index 2344a52..94d0048 100644
--- a/docs/content.zh/docs/dev/table/config.md
+++ b/docs/content.zh/docs/dev/table/config.md
@@ -75,11 +75,11 @@ configuration.setString("table.exec.mini-batch.size",
"5000")
t_env = ...
# access flink configuration
-configuration = t_env.get_config().get_configuration();
+configuration = t_env.get_config().get_configuration()
# set low-level key-value options
-configuration.set_string("table.exec.mini-batch.enabled", "true");
-configuration.set_string("table.exec.mini-batch.allow-latency", "5 s");
-configuration.set_string("table.exec.mini-batch.size", "5000");
+configuration.set_string("table.exec.mini-batch.enabled", "true")
+configuration.set_string("table.exec.mini-batch.allow-latency", "5 s")
+configuration.set_string("table.exec.mini-batch.size", "5000")
```
{{< /tab >}}
{{< tab "SQL CLI" >}}
diff --git a/docs/content/docs/dev/python/python_config.md
b/docs/content/docs/dev/python/python_config.md
index a517a0c..388ac6d 100644
--- a/docs/content/docs/dev/python/python_config.md
+++ b/docs/content/docs/dev/python/python_config.md
@@ -26,10 +26,33 @@ under the License.
# Configuration
-Depending on the requirements of a Python Table API program, it might be
necessary to adjust certain parameters for optimization.
-All the config options available for Java/Scala Table API program could also
be used in the Python Table API program.
-You could refer to the [Table API Configuration]({{< ref
"docs/dev/table/config" >}}) for more details on all the available config
options for Java/Scala Table API programs.
-It has also provided examples on how to set the config options in a Table API
program.
+Depending on the requirements of a Python API program, it might be necessary
to adjust certain parameters for optimization.
+
+For Python DataStream API program, the config options could be set as
following:
+```python
+from pyflink.common import Configuration
+from pyflink.datastream import StreamExecutionEnvironment
+from pyflink.util.java_utils import get_j_env_configuration
+
+env = StreamExecutionEnvironment.get_execution_environment()
+config =
Configuration(j_configuration=get_j_env_configuration(env._j_stream_execution_environment))
+config.set_integer("python.fn-execution.bundle.size", 1000)
+```
+
+For Python Table API program, all the config options available for Java/Scala
Table API
+program could also be used in the Python Table API program.
+You could refer to the [Table API Configuration]({{< ref
"docs/dev/table/config" >}}) for more details
+on all the available config options for Table API programs.
+The config options could be set as following in a Table API program:
+```python
+from pyflink.table import TableEnvironment, EnvironmentSettings
+
+env_settings =
EnvironmentSettings.new_instance().in_streaming_mode().use_blink_planner().build()
+t_env = TableEnvironment.create(env_settings)
+
+config = t_env.get_config().get_configuration()
+config.set_integer("python.fn-execution.bundle.size", 1000)
+```
## Python Options
diff --git a/docs/content/docs/dev/table/config.md
b/docs/content/docs/dev/table/config.md
index 6e27186..a4fd7b7 100644
--- a/docs/content/docs/dev/table/config.md
+++ b/docs/content/docs/dev/table/config.md
@@ -82,11 +82,11 @@ configuration.setString("table.exec.mini-batch.size",
"5000")
t_env = ...
# access flink configuration
-configuration = t_env.get_config().get_configuration();
+configuration = t_env.get_config().get_configuration()
# set low-level key-value options
-configuration.set_string("table.exec.mini-batch.enabled", "true");
-configuration.set_string("table.exec.mini-batch.allow-latency", "5 s");
-configuration.set_string("table.exec.mini-batch.size", "5000");
+configuration.set_string("table.exec.mini-batch.enabled", "true")
+configuration.set_string("table.exec.mini-batch.allow-latency", "5 s")
+configuration.set_string("table.exec.mini-batch.size", "5000")
```
{{< /tab >}}
{{< tab "SQL CLI" >}}