RollsBean commented on a change in pull request #16490:
URL: https://github.com/apache/flink/pull/16490#discussion_r675332516



##########
File path: docs/content.zh/docs/dev/datastream/application_parameters.md
##########
@@ -124,18 +118,17 @@ ParameterTool parameters = ParameterTool.fromArgs(args);
 final ExecutionEnvironment env = 
ExecutionEnvironment.getExecutionEnvironment();
 env.getConfig().setGlobalJobParameters(parameters);
 ```
-
-Access them in any rich user function:
+在任意富函数中访问参数:
 
 ```java
 public static final class Tokenizer extends RichFlatMapFunction<String, 
Tuple2<String, Integer>> {
 
     @Override
     public void flatMap(String value, Collector<Tuple2<String, Integer>> out) {
-       ParameterTool parameters = (ParameterTool)
-           getRuntimeContext().getExecutionConfig().getGlobalJobParameters();
-       parameters.getRequired("input");
-       // .. do more ..
+        ParameterTool parameters = (ParameterTool)
+                
getRuntimeContext().getExecutionConfig().getGlobalJobParameters();

Review comment:
       这里多了一行,你用 md 编辑器查看一下

##########
File path: docs/content.zh/docs/dev/datastream/application_parameters.md
##########
@@ -93,29 +88,28 @@ parameter.getNumberOfParameters()
 // .. there are more methods available.
 ```
 
-You can use the return values of these methods directly in the `main()` method 
of the client submitting the application.
-For example, you could set the parallelism of a operator like this:
+你可以在提交应用程序时直接在客户端的 `main()` 方法中使用这些方法的返回值。例如,你可以这样设置算子的并行度:
 
 ```java
 ParameterTool parameters = ParameterTool.fromArgs(args);
 int parallelism = parameters.get("mapParallelism", 2);
 DataStream<Tuple2<String, Integer>> counts = text.flatMap(new 
Tokenizer()).setParallelism(parallelism);
 ```
 
-Since the `ParameterTool` is serializable, you can pass it to the functions 
itself:
+由于 `ParameterTool` 是序列化的,你可以将其传递给函数本身:
 
 ```java
 ParameterTool parameters = ParameterTool.fromArgs(args);
 DataStream<Tuple2<String, Integer>> counts = text.flatMap(new 
Tokenizer(parameters));
 ```
 
-and then use it inside the function for getting values from the command line.
+然后在函数内使用它以获取命令行的传递的参数。
 
-#### Register the parameters globally
+#### 全局注册参数
 
-Parameters registered as global job parameters in the `ExecutionConfig` can be 
accessed as configuration values from the JobManager web interface and in all 
functions defined by the user.
+从 JobManager web 界面和用户定义的所有函数中可以以配置值的方式访问在 `ExecutionConfig` 中注册为全局作业参数。

Review comment:
       ```suggestion
   从 JobManager web 界面和所有用户定义的函数中可以以配置值的方式访问在 `ExecutionConfig` 中注册的全局作业参数。
   ```

##########
File path: docs/content.zh/docs/dev/datastream/application_parameters.md
##########
@@ -24,28 +24,23 @@ specific language governing permissions and limitations
 under the License.
 -->
 
-# Handling Application Parameters
+# 应用程序参数处理
 
-
-
-Handling Application Parameters
+应用程序参数处理
 -------------------------------
-Almost all Flink applications, both batch and streaming, rely on external 
configuration parameters.
-They are used to specify input and output sources (like paths or addresses), 
system parameters (parallelism, runtime configuration), and application 
specific parameters (typically used within user functions).
+几乎所有的批和流的 Flink 
应用程序,都依赖于外部配置参数。这些配置参数可以用于指定输入和输出源(如路径或地址)、系统参数(并行度,运行时配置)和特定的应用程序参数(通常使用在用户自定义函数)。
 
-Flink provides a simple utility called `ParameterTool` to provide some basic 
tooling for solving these problems.
-Please note that you don't have to use the `ParameterTool` described here. 
Other frameworks such as [Commons 
CLI](https://commons.apache.org/proper/commons-cli/) and
-[argparse4j](http://argparse4j.sourceforge.net/) also work well with Flink.
+为解决以上问题,Flink 提供一个名为 `Parametertool` 的简单公共类,其中包含了一些基本的工具。请注意,这里说的 
`Parametertool` 并不是必须使用的。[Commons 
CLI](https://commons.apache.org/proper/commons-cli/) 和 
[argparse4j](http://argparse4j.sourceforge.net/) 等其他框架也可以非常好地兼容 Flink。
 
+### `ParameterTool` 读取配置值
 
-### Getting your configuration values into the `ParameterTool`
+`ParameterTool` 已经定义好了一组静态方法,用于读取配置信息。该工具类内部使用了 `Map<string,string>` 
类型,这样使得它可以很容易的与你的配置集成在一起。

Review comment:
       ```suggestion
   `ParameterTool` 已经定义好了一组静态方法,用于读取配置信息。该工具类内部使用了 `Map<string,string>` 
类型,这样使得它可以很容易地与你的配置集成在一起。
   ```

##########
File path: docs/content.zh/docs/dev/datastream/application_parameters.md
##########
@@ -124,18 +118,17 @@ ParameterTool parameters = ParameterTool.fromArgs(args);
 final ExecutionEnvironment env = 
ExecutionEnvironment.getExecutionEnvironment();
 env.getConfig().setGlobalJobParameters(parameters);
 ```
-
-Access them in any rich user function:
+在任意富函数中访问参数:
 
 ```java
 public static final class Tokenizer extends RichFlatMapFunction<String, 
Tuple2<String, Integer>> {
 
     @Override
     public void flatMap(String value, Collector<Tuple2<String, Integer>> out) {
-       ParameterTool parameters = (ParameterTool)
-           getRuntimeContext().getExecutionConfig().getGlobalJobParameters();
-       parameters.getRequired("input");
-       // .. do more ..
+        ParameterTool parameters = (ParameterTool)
+                
getRuntimeContext().getExecutionConfig().getGlobalJobParameters();

Review comment:
       这里多了一行,你用 md 编辑器看一下渲染后的效果




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to