You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/06/27 17:18:35 UTC

[GitHub] [flink] hapihu opened a new pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

hapihu opened a new pull request #16304:
URL: https://github.com/apache/flink/pull/16304


   Translate Task Lifecycle document into Chinese
   
   


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-869200661


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19593",
       "triggerID" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282",
       "triggerID" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ec4f33d90c4ab15a1f9c4248d293a0a385738b39",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20509",
       "triggerID" : "ec4f33d90c4ab15a1f9c4248d293a0a385738b39",
       "triggerType" : "PUSH"
     }, {
       "hash" : "1e13b57c3a960554e8434040f2799857c5b99f5e",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "1e13b57c3a960554e8434040f2799857c5b99f5e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "05b3184b25d509f95029492f9c29adf72d00b71c",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "05b3184b25d509f95029492f9c29adf72d00b71c",
       "triggerType" : "PUSH"
     }, {
       "hash" : "cff071ab1e29dd10754fcb210edea5c8aa7fe6f4",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "cff071ab1e29dd10754fcb210edea5c8aa7fe6f4",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 462cbd1cf74422aa22733f9361554adb7a96b0a2 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282) 
   * 2ba4d3b2f5bfa23ae4980654d725deba3a2a525a UNKNOWN
   * 43f7f0a6f04bf9feb24f181a44b018c39485287d UNKNOWN
   * ec4f33d90c4ab15a1f9c4248d293a0a385738b39 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20509) 
   * 1e13b57c3a960554e8434040f2799857c5b99f5e UNKNOWN
   * 05b3184b25d509f95029492f9c29adf72d00b71c UNKNOWN
   * cff071ab1e29dd10754fcb210edea5c8aa7fe6f4 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] hapihu commented on a change in pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
hapihu commented on a change in pull request #16304:
URL: https://github.com/apache/flink/pull/16304#discussion_r670623576



##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,119 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 *5* 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
+
+## 算子生命周期简介
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),因此我们在每个算子下也展示(以缩进的方式)了 UDF 生命周期中调用的各个方法。`AbstractUdfStreamOperator` 是所有执行 UDF 的算子的基类,如果算子继承了 `AbstractUdfStreamOperator`,那么这些方法都是可用的。
 
-## Operator Lifecycle in a nutshell
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
+ 
 
-        // initialization phase
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        // 处理阶段(对每个 element 或 watermark 调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(对每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,在算子初始化时调用 `setup()` 来初始化算子的特定设置,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户自定义函数。
 
 {{< hint info >}}
-The `initializeState()` contains both the logic for initializing the 
-state of the operator during its initial execution (*e.g.* register any keyed state), and also the logic to retrieve its
-state from a checkpoint after a failure. More about this on the rest of this page.
+`initializeState()` 既包含在初始化过程中算子状态的初始化逻辑(比如注册 keyed 状态),又包含异常后从 checkpoint 中恢复原有状态的逻辑。在接下来的篇幅会进行更详细的介绍。
 {{< /hint >}}
 
-Now that everything is set, the operator is ready to process incoming data. Incoming elements can be one of the following: 
-input elements, watermark, and checkpoint barriers. Each one of them has a special element for handling it. Elements are 
-processed by the `processElement()` method, watermarks by the `processWatermark()`, and checkpoint barriers trigger a 
-checkpoint which invokes (asynchronously) the `snapshotState()` method, which we describe below. For each incoming element,
-depending on its type one of the aforementioned methods is called. Note that the `processElement()` is also the place 
-where the UDF's logic is invoked, *e.g.* the `map()` method of your `MapFunction`.
-
-Finally, in the case of a normal, fault-free termination of the operator (*e.g.* if the stream is
-finite and its end is reached), the `finish()` method is called to perform any final bookkeeping
-action required by the operator's logic (*e.g.* flush any buffered data, or emit data to mark end of
-procesing), and the `close()` is called after that to free any resources held by the operator
-(*e.g.* open network connections, io streams, or native memory held by the operator's data).
-
-In the case of a termination due to a failure or due to manual cancellation, the execution jumps directly to the `close()`
-and skips any intermediate phases between the phase the operator was in when the failure happened and the `close()`.
-
-**Checkpoints:** The `snapshotState()` method of the operator is called asynchronously to the rest of the methods described 
-above whenever a checkpoint barrier is received. Checkpoints are performed during the processing phase, *i.e.* after the 
-operator is opened and before it is closed. The responsibility of this method is to store the current state of the operator 
-to the specified [state backend]({{< ref "docs/ops/state/state_backends" >}}) from where it will be retrieved when 
-the job resumes execution after a failure. Below we include a brief description of Flink's checkpointing mechanism, 
-and for a more detailed discussion on the principles around checkpointing in Flink please read the corresponding documentation: 
-[Data Streaming Fault Tolerance]({{< ref "docs/learn-flink/fault_tolerance" >}}).
-
-## Task Lifecycle
-
-Following that brief introduction on the operator's main phases, this section describes in more detail how a task calls 
-the respective methods during its execution on a cluster. The sequence of the phases described here is mainly included 
-in the `invoke()` method of the `StreamTask` class. The remainder of this document is split into two subsections, one 
-describing the phases during a regular, fault-free execution of a task (see [Normal Execution](#normal-execution)), and 
-(a shorter) one describing the different sequence followed in case the task is cancelled (see [Interrupted Execution](#interrupted-execution)), 
-either manually, or due some other reason, *e.g.* an exception thrown during execution.
-
-### Normal Execution
-
-The steps a task goes through when executed until completion without being interrupted are illustrated below:
-
-        TASK::setInitialState
-        TASK::invoke
-            create basic utils (config, etc) and load the chain of operators
-            setup-operators
-            task-specific-init
-            initialize-operator-states
-            open-operators
-            run
-            finish-operators
-            close-operators
-            task-specific-cleanup
-            common-cleanup
-
-As shown above, after recovering the task configuration and initializing some important runtime parameters, the very 
-first step for the task is to retrieve its initial, task-wide state. This is done in the `setInitialState()`, and it is 
-particularly important in two cases:
-
-1. when the task is recovering from a failure and restarts from the last successful checkpoint
-2. when resuming from a [savepoint]({{< ref "docs/ops/state/savepoints" >}}). 
-
-If it is the first time the task is executed, the initial task state is empty. 
-
-After recovering any initial state, the task goes into its `invoke()` method. There, it first initializes the operators 
-involved in the local computation by calling the `setup()` method of each one of them and then performs its task-specific 
-initialization by calling the local `init()` method. By task-specific, we mean that depending on the type of the task 
-(`SourceTask`, `OneInputStreamTask` or `TwoInputStreamTask`, etc), this step may differ, but in any case, here is where 
-the necessary task-wide resources are acquired. As an example, the `OneInputStreamTask`, which represents a task that 
-expects to have a single input stream, initializes the connection(s) to the location(s) of the different partitions of 
-the input stream that are relevant to the local task.
-
-Having acquired the necessary resources, it is time for the different operators and user-defined functions to acquire 
-their individual state from the task-wide state retrieved above. This is done in the `initializeState()` method, which 
-calls the `initializeState()` of each individual operator. This method should be overridden by every stateful operator 
-and should contain the state initialization logic, both for the first time a job is executed, and also for the case when 
-the task recovers from a failure or when using a savepoint.
-
-Now that all operators in the task have been initialized, the `open()` method of each individual operator is called by 
-the `openAllOperators()` method of the `StreamTask`. This method performs all the operational initialization, 
-such as registering any retrieved timers with the timer service. A single task may be executing multiple operators with one 
-consuming the output of its predecessor. In this case, the `open()` method is called from the last operator, *i.e.* the 
-one whose output is also the output of the task itself, to the first. This is done so that when the first operator starts 
-processing the task's input, all downstream operators are ready to receive its output.
+当所有初始化都完成之后,算子开始处理流入的数据。流入的数据可以分为三种类型:用户数据、watermark 和 checkpoint barriers。每种类型的数据都有单独的方法来处理。用户数据通过 `processElement()` 方法来处理,watermark 通过 `processWatermark()` 来处理,checkpoint barriers 会调用(异步)`snapshotState()` 方法触发 checkpoint。对于每个流入的数据,根据其类型调用上述相应的方法。注意,`processElement()` 方法也是用户自定义函数逻辑执行的地方,比如用户自定义 `MapFunction` 里的  `map()` 方法。
+
+最后,在算子正常无故障的情况下(比如,如果流式数据是有限的,并且最后一个数据已经到达),会调用 `finish()` 方法结束算子并进行必要的清理工作(比如刷新所有缓冲数据,或发送处理结束的标记数据)。在这之后会调用 `close()` 方法来释放算子持有的资源(比如算子数据持有的本地内存)。
+
+在作业失败或手动取消的情况下,会略过从算子异常位置到 `close()` 中间的所有步骤,直接跳到 `close()` 方法结束算子。
+
+**Checkpoints:** 算子的 `snapshotState()` 方法是在收到 checkpoint barrier 后异步调用的。Checkpoint 在处理阶段执行,即算子打开之后,结束之前的这个阶段。这个方法的职责是存储算子的当前状态到一个特定的[状态后端]({{< ref "docs/ops/state/state_backends" >}}),当作业失败后恢复执行时会从这个后端恢复状态数据。下面我们简要描述了 Flink 的 checkpoint 机制,如果想了解更多 Flink checkpoint 相关的原理,可以读一读 [数据流容错]({{< ref "docs/learn-flink/fault_tolerance" >}})。
+
+<a name="task-lifecycle-1"> </a>
+
+## Task 生命周期
+
+在上文对算子主要阶段的简要介绍之后,本节将详细介绍 task 在集群执行期间是如何调用相关方法的。这里所说的阶段主要包含在 `StreamTask` 类的 `invoke()` 方法里。本文档的剩余部分会分成两个子章节,其中一节描述了 task 在常规没有失败情况下执行的阶段(请参考 [常规执行](#normal-execution)),另外一节描述了 task 取消之后执行的阶段(请参考 [中断执行](#interrupted-execution)),不管是手动取消还是其他原因(比如执行期间遇到异常)导致的取消。
+
+<a name="normal-execution"> </a>
+
+### 常规执行
+
+Task 在没有中断的情况下执行直到最终的步骤如下所示:
+
+	    TASK::setInitialState
+	    TASK::invoke
+		    create basic utils (config, etc) and load the chain of operators
+		    setup-operators
+		    task-specific-init
+		    initialize-operator-states
+	   	    open-operators
+		    run
+		    finish-operators
+		    close-operators
+		    task-specific-cleanup
+		    common-cleanup
+
+如上所示,在恢复 task 配置和初始化一些重要的运行时参数之后,task 的下一步是读取 task 级别的初始状态数据。这一步在 `setInitialState()` 方法里完成,在下面两个场景特别重要:
+
+1. 当 Task 从失败中恢复,从最后一次成功的 checkpoint 重启的时候

Review comment:
       ok, I made a slight change, and the result looks like this:
   >  1. 当 Task 从失败中恢复并从最近一次成功的 checkpoint 重启的时候
   
   Change  `、` to `.`.
   What do you think of it?




-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-869200661


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19593",
       "triggerID" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282",
       "triggerID" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ec4f33d90c4ab15a1f9c4248d293a0a385738b39",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20509",
       "triggerID" : "ec4f33d90c4ab15a1f9c4248d293a0a385738b39",
       "triggerType" : "PUSH"
     }, {
       "hash" : "1e13b57c3a960554e8434040f2799857c5b99f5e",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "1e13b57c3a960554e8434040f2799857c5b99f5e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "05b3184b25d509f95029492f9c29adf72d00b71c",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "05b3184b25d509f95029492f9c29adf72d00b71c",
       "triggerType" : "PUSH"
     }, {
       "hash" : "cff071ab1e29dd10754fcb210edea5c8aa7fe6f4",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20517",
       "triggerID" : "cff071ab1e29dd10754fcb210edea5c8aa7fe6f4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "67953137deb1743eecbda1da610c9875c29bd69c",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20503",
       "triggerID" : "67953137deb1743eecbda1da610c9875c29bd69c",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 2ba4d3b2f5bfa23ae4980654d725deba3a2a525a UNKNOWN
   * 43f7f0a6f04bf9feb24f181a44b018c39485287d UNKNOWN
   * 1e13b57c3a960554e8434040f2799857c5b99f5e UNKNOWN
   * 05b3184b25d509f95029492f9c29adf72d00b71c UNKNOWN
   * cff071ab1e29dd10754fcb210edea5c8aa7fe6f4 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20517) 
   * 67953137deb1743eecbda1da610c9875c29bd69c Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20503) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] RocMarshal commented on a change in pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
RocMarshal commented on a change in pull request #16304:
URL: https://github.com/apache/flink/pull/16304#discussion_r670542035



##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,119 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 *5* 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
+
+## 算子生命周期简介
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),因此我们在每个算子下也展示(以缩进的方式)了 UDF 生命周期中调用的各个方法。`AbstractUdfStreamOperator` 是所有执行 UDF 的算子的基类,如果算子继承了 `AbstractUdfStreamOperator`,那么这些方法都是可用的。
 
-## Operator Lifecycle in a nutshell
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
+ 
 
-        // initialization phase
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        // 处理阶段(对每个 element 或 watermark 调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(对每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,在算子初始化时调用 `setup()` 来初始化算子的特定设置,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户自定义函数。
 
 {{< hint info >}}
-The `initializeState()` contains both the logic for initializing the 
-state of the operator during its initial execution (*e.g.* register any keyed state), and also the logic to retrieve its
-state from a checkpoint after a failure. More about this on the rest of this page.
+`initializeState()` 既包含在初始化过程中算子状态的初始化逻辑(比如注册 keyed 状态),又包含异常后从 checkpoint 中恢复原有状态的逻辑。在接下来的篇幅会进行更详细的介绍。
 {{< /hint >}}
 
-Now that everything is set, the operator is ready to process incoming data. Incoming elements can be one of the following: 
-input elements, watermark, and checkpoint barriers. Each one of them has a special element for handling it. Elements are 
-processed by the `processElement()` method, watermarks by the `processWatermark()`, and checkpoint barriers trigger a 
-checkpoint which invokes (asynchronously) the `snapshotState()` method, which we describe below. For each incoming element,
-depending on its type one of the aforementioned methods is called. Note that the `processElement()` is also the place 
-where the UDF's logic is invoked, *e.g.* the `map()` method of your `MapFunction`.
-
-Finally, in the case of a normal, fault-free termination of the operator (*e.g.* if the stream is
-finite and its end is reached), the `finish()` method is called to perform any final bookkeeping
-action required by the operator's logic (*e.g.* flush any buffered data, or emit data to mark end of
-procesing), and the `close()` is called after that to free any resources held by the operator
-(*e.g.* open network connections, io streams, or native memory held by the operator's data).
-
-In the case of a termination due to a failure or due to manual cancellation, the execution jumps directly to the `close()`
-and skips any intermediate phases between the phase the operator was in when the failure happened and the `close()`.
-
-**Checkpoints:** The `snapshotState()` method of the operator is called asynchronously to the rest of the methods described 
-above whenever a checkpoint barrier is received. Checkpoints are performed during the processing phase, *i.e.* after the 
-operator is opened and before it is closed. The responsibility of this method is to store the current state of the operator 
-to the specified [state backend]({{< ref "docs/ops/state/state_backends" >}}) from where it will be retrieved when 
-the job resumes execution after a failure. Below we include a brief description of Flink's checkpointing mechanism, 
-and for a more detailed discussion on the principles around checkpointing in Flink please read the corresponding documentation: 
-[Data Streaming Fault Tolerance]({{< ref "docs/learn-flink/fault_tolerance" >}}).
-
-## Task Lifecycle
-
-Following that brief introduction on the operator's main phases, this section describes in more detail how a task calls 
-the respective methods during its execution on a cluster. The sequence of the phases described here is mainly included 
-in the `invoke()` method of the `StreamTask` class. The remainder of this document is split into two subsections, one 
-describing the phases during a regular, fault-free execution of a task (see [Normal Execution](#normal-execution)), and 
-(a shorter) one describing the different sequence followed in case the task is cancelled (see [Interrupted Execution](#interrupted-execution)), 
-either manually, or due some other reason, *e.g.* an exception thrown during execution.
-
-### Normal Execution
-
-The steps a task goes through when executed until completion without being interrupted are illustrated below:
-
-        TASK::setInitialState
-        TASK::invoke
-            create basic utils (config, etc) and load the chain of operators
-            setup-operators
-            task-specific-init
-            initialize-operator-states
-            open-operators
-            run
-            finish-operators
-            close-operators
-            task-specific-cleanup
-            common-cleanup
-
-As shown above, after recovering the task configuration and initializing some important runtime parameters, the very 
-first step for the task is to retrieve its initial, task-wide state. This is done in the `setInitialState()`, and it is 
-particularly important in two cases:
-
-1. when the task is recovering from a failure and restarts from the last successful checkpoint
-2. when resuming from a [savepoint]({{< ref "docs/ops/state/savepoints" >}}). 
-
-If it is the first time the task is executed, the initial task state is empty. 
-
-After recovering any initial state, the task goes into its `invoke()` method. There, it first initializes the operators 
-involved in the local computation by calling the `setup()` method of each one of them and then performs its task-specific 
-initialization by calling the local `init()` method. By task-specific, we mean that depending on the type of the task 
-(`SourceTask`, `OneInputStreamTask` or `TwoInputStreamTask`, etc), this step may differ, but in any case, here is where 
-the necessary task-wide resources are acquired. As an example, the `OneInputStreamTask`, which represents a task that 
-expects to have a single input stream, initializes the connection(s) to the location(s) of the different partitions of 
-the input stream that are relevant to the local task.
-
-Having acquired the necessary resources, it is time for the different operators and user-defined functions to acquire 
-their individual state from the task-wide state retrieved above. This is done in the `initializeState()` method, which 
-calls the `initializeState()` of each individual operator. This method should be overridden by every stateful operator 
-and should contain the state initialization logic, both for the first time a job is executed, and also for the case when 
-the task recovers from a failure or when using a savepoint.
-
-Now that all operators in the task have been initialized, the `open()` method of each individual operator is called by 
-the `openAllOperators()` method of the `StreamTask`. This method performs all the operational initialization, 
-such as registering any retrieved timers with the timer service. A single task may be executing multiple operators with one 
-consuming the output of its predecessor. In this case, the `open()` method is called from the last operator, *i.e.* the 
-one whose output is also the output of the task itself, to the first. This is done so that when the first operator starts 
-processing the task's input, all downstream operators are ready to receive its output.
+当所有初始化都完成之后,算子开始处理流入的数据。流入的数据可以分为三种类型:用户数据、watermark 和 checkpoint barriers。每种类型的数据都有单独的方法来处理。用户数据通过 `processElement()` 方法来处理,watermark 通过 `processWatermark()` 来处理,checkpoint barriers 会调用(异步)`snapshotState()` 方法触发 checkpoint。对于每个流入的数据,根据其类型调用上述相应的方法。注意,`processElement()` 方法也是用户自定义函数逻辑执行的地方,比如用户自定义 `MapFunction` 里的  `map()` 方法。
+
+最后,在算子正常无故障的情况下(比如,如果流式数据是有限的,并且最后一个数据已经到达),会调用 `finish()` 方法结束算子并进行必要的清理工作(比如刷新所有缓冲数据,或发送处理结束的标记数据)。在这之后会调用 `close()` 方法来释放算子持有的资源(比如算子数据持有的本地内存)。
+
+在作业失败或手动取消的情况下,会略过从算子异常位置到 `close()` 中间的所有步骤,直接跳到 `close()` 方法结束算子。
+
+**Checkpoints:** 算子的 `snapshotState()` 方法是在收到 checkpoint barrier 后异步调用的。Checkpoint 在处理阶段执行,即算子打开之后,结束之前的这个阶段。这个方法的职责是存储算子的当前状态到一个特定的[状态后端]({{< ref "docs/ops/state/state_backends" >}}),当作业失败后恢复执行时会从这个后端恢复状态数据。下面我们简要描述了 Flink 的 checkpoint 机制,如果想了解更多 Flink checkpoint 相关的原理,可以读一读 [数据流容错]({{< ref "docs/learn-flink/fault_tolerance" >}})。
+
+<a name="task-lifecycle-1"> </a>
+
+## Task 生命周期
+
+在上文对算子主要阶段的简要介绍之后,本节将详细介绍 task 在集群执行期间是如何调用相关方法的。这里所说的阶段主要包含在 `StreamTask` 类的 `invoke()` 方法里。本文档的剩余部分会分成两个子章节,其中一节描述了 task 在常规没有失败情况下执行的阶段(请参考 [常规执行](#normal-execution)),另外一节描述了 task 取消之后执行的阶段(请参考 [中断执行](#interrupted-execution)),不管是手动取消还是其他原因(比如执行期间遇到异常)导致的取消。

Review comment:
       ```suggestion
   在上文对算子主要阶段的简介之后,本节将详细介绍 task 在集群执行期间是如何调用相关方法的。这里所说的阶段主要包含在 `StreamTask` 类的 `invoke()` 方法里。本文档后续内容将分成两个子章节,一节描述了 task 在正常无故障情况下的执行阶段(请参考[常规执行](#normal-execution)),另一节(稍微简短的部分)描述了 task 取消之后的执行阶段(请参考[中断执行](#interrupted-execution)),不管是手动取消还是其他原因(比如执行期间遇到异常)导致的取消。
   ```

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,119 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 *5* 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
+
+## 算子生命周期简介
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),因此我们在每个算子下也展示(以缩进的方式)了 UDF 生命周期中调用的各个方法。`AbstractUdfStreamOperator` 是所有执行 UDF 的算子的基类,如果算子继承了 `AbstractUdfStreamOperator`,那么这些方法都是可用的。
 
-## Operator Lifecycle in a nutshell
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
+ 
 
-        // initialization phase
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        // 处理阶段(对每个 element 或 watermark 调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(对每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,在算子初始化时调用 `setup()` 来初始化算子的特定设置,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户自定义函数。
 
 {{< hint info >}}
-The `initializeState()` contains both the logic for initializing the 
-state of the operator during its initial execution (*e.g.* register any keyed state), and also the logic to retrieve its
-state from a checkpoint after a failure. More about this on the rest of this page.
+`initializeState()` 既包含在初始化过程中算子状态的初始化逻辑(比如注册 keyed 状态),又包含异常后从 checkpoint 中恢复原有状态的逻辑。在接下来的篇幅会进行更详细的介绍。
 {{< /hint >}}
 
-Now that everything is set, the operator is ready to process incoming data. Incoming elements can be one of the following: 
-input elements, watermark, and checkpoint barriers. Each one of them has a special element for handling it. Elements are 
-processed by the `processElement()` method, watermarks by the `processWatermark()`, and checkpoint barriers trigger a 
-checkpoint which invokes (asynchronously) the `snapshotState()` method, which we describe below. For each incoming element,
-depending on its type one of the aforementioned methods is called. Note that the `processElement()` is also the place 
-where the UDF's logic is invoked, *e.g.* the `map()` method of your `MapFunction`.
-
-Finally, in the case of a normal, fault-free termination of the operator (*e.g.* if the stream is
-finite and its end is reached), the `finish()` method is called to perform any final bookkeeping
-action required by the operator's logic (*e.g.* flush any buffered data, or emit data to mark end of
-procesing), and the `close()` is called after that to free any resources held by the operator
-(*e.g.* open network connections, io streams, or native memory held by the operator's data).
-
-In the case of a termination due to a failure or due to manual cancellation, the execution jumps directly to the `close()`
-and skips any intermediate phases between the phase the operator was in when the failure happened and the `close()`.
-
-**Checkpoints:** The `snapshotState()` method of the operator is called asynchronously to the rest of the methods described 
-above whenever a checkpoint barrier is received. Checkpoints are performed during the processing phase, *i.e.* after the 
-operator is opened and before it is closed. The responsibility of this method is to store the current state of the operator 
-to the specified [state backend]({{< ref "docs/ops/state/state_backends" >}}) from where it will be retrieved when 
-the job resumes execution after a failure. Below we include a brief description of Flink's checkpointing mechanism, 
-and for a more detailed discussion on the principles around checkpointing in Flink please read the corresponding documentation: 
-[Data Streaming Fault Tolerance]({{< ref "docs/learn-flink/fault_tolerance" >}}).
-
-## Task Lifecycle
-
-Following that brief introduction on the operator's main phases, this section describes in more detail how a task calls 
-the respective methods during its execution on a cluster. The sequence of the phases described here is mainly included 
-in the `invoke()` method of the `StreamTask` class. The remainder of this document is split into two subsections, one 
-describing the phases during a regular, fault-free execution of a task (see [Normal Execution](#normal-execution)), and 
-(a shorter) one describing the different sequence followed in case the task is cancelled (see [Interrupted Execution](#interrupted-execution)), 
-either manually, or due some other reason, *e.g.* an exception thrown during execution.
-
-### Normal Execution
-
-The steps a task goes through when executed until completion without being interrupted are illustrated below:
-
-        TASK::setInitialState
-        TASK::invoke
-            create basic utils (config, etc) and load the chain of operators
-            setup-operators
-            task-specific-init
-            initialize-operator-states
-            open-operators
-            run
-            finish-operators
-            close-operators
-            task-specific-cleanup
-            common-cleanup
-
-As shown above, after recovering the task configuration and initializing some important runtime parameters, the very 
-first step for the task is to retrieve its initial, task-wide state. This is done in the `setInitialState()`, and it is 
-particularly important in two cases:
-
-1. when the task is recovering from a failure and restarts from the last successful checkpoint
-2. when resuming from a [savepoint]({{< ref "docs/ops/state/savepoints" >}}). 
-
-If it is the first time the task is executed, the initial task state is empty. 
-
-After recovering any initial state, the task goes into its `invoke()` method. There, it first initializes the operators 
-involved in the local computation by calling the `setup()` method of each one of them and then performs its task-specific 
-initialization by calling the local `init()` method. By task-specific, we mean that depending on the type of the task 
-(`SourceTask`, `OneInputStreamTask` or `TwoInputStreamTask`, etc), this step may differ, but in any case, here is where 
-the necessary task-wide resources are acquired. As an example, the `OneInputStreamTask`, which represents a task that 
-expects to have a single input stream, initializes the connection(s) to the location(s) of the different partitions of 
-the input stream that are relevant to the local task.
-
-Having acquired the necessary resources, it is time for the different operators and user-defined functions to acquire 
-their individual state from the task-wide state retrieved above. This is done in the `initializeState()` method, which 
-calls the `initializeState()` of each individual operator. This method should be overridden by every stateful operator 
-and should contain the state initialization logic, both for the first time a job is executed, and also for the case when 
-the task recovers from a failure or when using a savepoint.
-
-Now that all operators in the task have been initialized, the `open()` method of each individual operator is called by 
-the `openAllOperators()` method of the `StreamTask`. This method performs all the operational initialization, 
-such as registering any retrieved timers with the timer service. A single task may be executing multiple operators with one 
-consuming the output of its predecessor. In this case, the `open()` method is called from the last operator, *i.e.* the 
-one whose output is also the output of the task itself, to the first. This is done so that when the first operator starts 
-processing the task's input, all downstream operators are ready to receive its output.
+当所有初始化都完成之后,算子开始处理流入的数据。流入的数据可以分为三种类型:用户数据、watermark 和 checkpoint barriers。每种类型的数据都有单独的方法来处理。用户数据通过 `processElement()` 方法来处理,watermark 通过 `processWatermark()` 来处理,checkpoint barriers 会调用(异步)`snapshotState()` 方法触发 checkpoint。对于每个流入的数据,根据其类型调用上述相应的方法。注意,`processElement()` 方法也是用户自定义函数逻辑执行的地方,比如用户自定义 `MapFunction` 里的  `map()` 方法。
+
+最后,在算子正常无故障的情况下(比如,如果流式数据是有限的,并且最后一个数据已经到达),会调用 `finish()` 方法结束算子并进行必要的清理工作(比如刷新所有缓冲数据,或发送处理结束的标记数据)。在这之后会调用 `close()` 方法来释放算子持有的资源(比如算子数据持有的本地内存)。
+
+在作业失败或手动取消的情况下,会略过从算子异常位置到 `close()` 中间的所有步骤,直接跳到 `close()` 方法结束算子。
+
+**Checkpoints:** 算子的 `snapshotState()` 方法是在收到 checkpoint barrier 后异步调用的。Checkpoint 在处理阶段执行,即算子打开之后,结束之前的这个阶段。这个方法的职责是存储算子的当前状态到一个特定的[状态后端]({{< ref "docs/ops/state/state_backends" >}}),当作业失败后恢复执行时会从这个后端恢复状态数据。下面我们简要描述了 Flink 的 checkpoint 机制,如果想了解更多 Flink checkpoint 相关的原理,可以读一读 [数据流容错]({{< ref "docs/learn-flink/fault_tolerance" >}})。
+
+<a name="task-lifecycle-1"> </a>
+
+## Task 生命周期
+
+在上文对算子主要阶段的简要介绍之后,本节将详细介绍 task 在集群执行期间是如何调用相关方法的。这里所说的阶段主要包含在 `StreamTask` 类的 `invoke()` 方法里。本文档的剩余部分会分成两个子章节,其中一节描述了 task 在常规没有失败情况下执行的阶段(请参考 [常规执行](#normal-execution)),另外一节描述了 task 取消之后执行的阶段(请参考 [中断执行](#interrupted-execution)),不管是手动取消还是其他原因(比如执行期间遇到异常)导致的取消。
+
+<a name="normal-execution"> </a>
+
+### 常规执行
+
+Task 在没有中断的情况下执行直到最终的步骤如下所示:

Review comment:
       ```suggestion
   Task 在没有中断的情况下执行到结束的阶段如下所示:
   ```

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,119 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 *5* 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
+
+## 算子生命周期简介
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),因此我们在每个算子下也展示(以缩进的方式)了 UDF 生命周期中调用的各个方法。`AbstractUdfStreamOperator` 是所有执行 UDF 的算子的基类,如果算子继承了 `AbstractUdfStreamOperator`,那么这些方法都是可用的。
 
-## Operator Lifecycle in a nutshell
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
+ 
 
-        // initialization phase
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        // 处理阶段(对每个 element 或 watermark 调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(对每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,在算子初始化时调用 `setup()` 来初始化算子的特定设置,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户自定义函数。
 
 {{< hint info >}}
-The `initializeState()` contains both the logic for initializing the 
-state of the operator during its initial execution (*e.g.* register any keyed state), and also the logic to retrieve its
-state from a checkpoint after a failure. More about this on the rest of this page.
+`initializeState()` 既包含在初始化过程中算子状态的初始化逻辑(比如注册 keyed 状态),又包含异常后从 checkpoint 中恢复原有状态的逻辑。在接下来的篇幅会进行更详细的介绍。
 {{< /hint >}}
 
-Now that everything is set, the operator is ready to process incoming data. Incoming elements can be one of the following: 
-input elements, watermark, and checkpoint barriers. Each one of them has a special element for handling it. Elements are 
-processed by the `processElement()` method, watermarks by the `processWatermark()`, and checkpoint barriers trigger a 
-checkpoint which invokes (asynchronously) the `snapshotState()` method, which we describe below. For each incoming element,
-depending on its type one of the aforementioned methods is called. Note that the `processElement()` is also the place 
-where the UDF's logic is invoked, *e.g.* the `map()` method of your `MapFunction`.
-
-Finally, in the case of a normal, fault-free termination of the operator (*e.g.* if the stream is
-finite and its end is reached), the `finish()` method is called to perform any final bookkeeping
-action required by the operator's logic (*e.g.* flush any buffered data, or emit data to mark end of
-procesing), and the `close()` is called after that to free any resources held by the operator
-(*e.g.* open network connections, io streams, or native memory held by the operator's data).
-
-In the case of a termination due to a failure or due to manual cancellation, the execution jumps directly to the `close()`
-and skips any intermediate phases between the phase the operator was in when the failure happened and the `close()`.
-
-**Checkpoints:** The `snapshotState()` method of the operator is called asynchronously to the rest of the methods described 
-above whenever a checkpoint barrier is received. Checkpoints are performed during the processing phase, *i.e.* after the 
-operator is opened and before it is closed. The responsibility of this method is to store the current state of the operator 
-to the specified [state backend]({{< ref "docs/ops/state/state_backends" >}}) from where it will be retrieved when 
-the job resumes execution after a failure. Below we include a brief description of Flink's checkpointing mechanism, 
-and for a more detailed discussion on the principles around checkpointing in Flink please read the corresponding documentation: 
-[Data Streaming Fault Tolerance]({{< ref "docs/learn-flink/fault_tolerance" >}}).
-
-## Task Lifecycle
-
-Following that brief introduction on the operator's main phases, this section describes in more detail how a task calls 
-the respective methods during its execution on a cluster. The sequence of the phases described here is mainly included 
-in the `invoke()` method of the `StreamTask` class. The remainder of this document is split into two subsections, one 
-describing the phases during a regular, fault-free execution of a task (see [Normal Execution](#normal-execution)), and 
-(a shorter) one describing the different sequence followed in case the task is cancelled (see [Interrupted Execution](#interrupted-execution)), 
-either manually, or due some other reason, *e.g.* an exception thrown during execution.
-
-### Normal Execution
-
-The steps a task goes through when executed until completion without being interrupted are illustrated below:
-
-        TASK::setInitialState
-        TASK::invoke
-            create basic utils (config, etc) and load the chain of operators
-            setup-operators
-            task-specific-init
-            initialize-operator-states
-            open-operators
-            run
-            finish-operators
-            close-operators
-            task-specific-cleanup
-            common-cleanup
-
-As shown above, after recovering the task configuration and initializing some important runtime parameters, the very 
-first step for the task is to retrieve its initial, task-wide state. This is done in the `setInitialState()`, and it is 
-particularly important in two cases:
-
-1. when the task is recovering from a failure and restarts from the last successful checkpoint
-2. when resuming from a [savepoint]({{< ref "docs/ops/state/savepoints" >}}). 
-
-If it is the first time the task is executed, the initial task state is empty. 
-
-After recovering any initial state, the task goes into its `invoke()` method. There, it first initializes the operators 
-involved in the local computation by calling the `setup()` method of each one of them and then performs its task-specific 
-initialization by calling the local `init()` method. By task-specific, we mean that depending on the type of the task 
-(`SourceTask`, `OneInputStreamTask` or `TwoInputStreamTask`, etc), this step may differ, but in any case, here is where 
-the necessary task-wide resources are acquired. As an example, the `OneInputStreamTask`, which represents a task that 
-expects to have a single input stream, initializes the connection(s) to the location(s) of the different partitions of 
-the input stream that are relevant to the local task.
-
-Having acquired the necessary resources, it is time for the different operators and user-defined functions to acquire 
-their individual state from the task-wide state retrieved above. This is done in the `initializeState()` method, which 
-calls the `initializeState()` of each individual operator. This method should be overridden by every stateful operator 
-and should contain the state initialization logic, both for the first time a job is executed, and also for the case when 
-the task recovers from a failure or when using a savepoint.
-
-Now that all operators in the task have been initialized, the `open()` method of each individual operator is called by 
-the `openAllOperators()` method of the `StreamTask`. This method performs all the operational initialization, 
-such as registering any retrieved timers with the timer service. A single task may be executing multiple operators with one 
-consuming the output of its predecessor. In this case, the `open()` method is called from the last operator, *i.e.* the 
-one whose output is also the output of the task itself, to the first. This is done so that when the first operator starts 
-processing the task's input, all downstream operators are ready to receive its output.
+当所有初始化都完成之后,算子开始处理流入的数据。流入的数据可以分为三种类型:用户数据、watermark 和 checkpoint barriers。每种类型的数据都有单独的方法来处理。用户数据通过 `processElement()` 方法来处理,watermark 通过 `processWatermark()` 来处理,checkpoint barriers 会调用(异步)`snapshotState()` 方法触发 checkpoint。对于每个流入的数据,根据其类型调用上述相应的方法。注意,`processElement()` 方法也是用户自定义函数逻辑执行的地方,比如用户自定义 `MapFunction` 里的  `map()` 方法。
+
+最后,在算子正常无故障的情况下(比如,如果流式数据是有限的,并且最后一个数据已经到达),会调用 `finish()` 方法结束算子并进行必要的清理工作(比如刷新所有缓冲数据,或发送处理结束的标记数据)。在这之后会调用 `close()` 方法来释放算子持有的资源(比如算子数据持有的本地内存)。
+
+在作业失败或手动取消的情况下,会略过从算子异常位置到 `close()` 中间的所有步骤,直接跳到 `close()` 方法结束算子。
+
+**Checkpoints:** 算子的 `snapshotState()` 方法是在收到 checkpoint barrier 后异步调用的。Checkpoint 在处理阶段执行,即算子打开之后,结束之前的这个阶段。这个方法的职责是存储算子的当前状态到一个特定的[状态后端]({{< ref "docs/ops/state/state_backends" >}}),当作业失败后恢复执行时会从这个后端恢复状态数据。下面我们简要描述了 Flink 的 checkpoint 机制,如果想了解更多 Flink checkpoint 相关的原理,可以读一读 [数据流容错]({{< ref "docs/learn-flink/fault_tolerance" >}})。
+
+<a name="task-lifecycle-1"> </a>
+
+## Task 生命周期
+
+在上文对算子主要阶段的简要介绍之后,本节将详细介绍 task 在集群执行期间是如何调用相关方法的。这里所说的阶段主要包含在 `StreamTask` 类的 `invoke()` 方法里。本文档的剩余部分会分成两个子章节,其中一节描述了 task 在常规没有失败情况下执行的阶段(请参考 [常规执行](#normal-execution)),另外一节描述了 task 取消之后执行的阶段(请参考 [中断执行](#interrupted-execution)),不管是手动取消还是其他原因(比如执行期间遇到异常)导致的取消。
+
+<a name="normal-execution"> </a>
+
+### 常规执行
+
+Task 在没有中断的情况下执行直到最终的步骤如下所示:
+
+	    TASK::setInitialState
+	    TASK::invoke
+		    create basic utils (config, etc) and load the chain of operators
+		    setup-operators
+		    task-specific-init
+		    initialize-operator-states
+	   	    open-operators
+		    run
+		    finish-operators
+		    close-operators
+		    task-specific-cleanup
+		    common-cleanup
+
+如上所示,在恢复 task 配置和初始化一些重要的运行时参数之后,task 的下一步是读取 task 级别的初始状态数据。这一步在 `setInitialState()` 方法里完成,在下面两个场景特别重要:

Review comment:
       ```suggestion
   如上所示,在恢复 task 配置和初始化一些重要的运行时参数之后,task 的下一步是读取 task 级别的初始状态。这一步在 `setInitialState()` 方法里完成,在下面两种情况尤其重要:
   ```

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,119 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 *5* 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
+
+## 算子生命周期简介
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),因此我们在每个算子下也展示(以缩进的方式)了 UDF 生命周期中调用的各个方法。`AbstractUdfStreamOperator` 是所有执行 UDF 的算子的基类,如果算子继承了 `AbstractUdfStreamOperator`,那么这些方法都是可用的。
 
-## Operator Lifecycle in a nutshell
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
+ 
 
-        // initialization phase
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        // 处理阶段(对每个 element 或 watermark 调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(对每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,在算子初始化时调用 `setup()` 来初始化算子的特定设置,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户自定义函数。
 
 {{< hint info >}}
-The `initializeState()` contains both the logic for initializing the 
-state of the operator during its initial execution (*e.g.* register any keyed state), and also the logic to retrieve its
-state from a checkpoint after a failure. More about this on the rest of this page.
+`initializeState()` 既包含在初始化过程中算子状态的初始化逻辑(比如注册 keyed 状态),又包含异常后从 checkpoint 中恢复原有状态的逻辑。在接下来的篇幅会进行更详细的介绍。
 {{< /hint >}}
 
-Now that everything is set, the operator is ready to process incoming data. Incoming elements can be one of the following: 
-input elements, watermark, and checkpoint barriers. Each one of them has a special element for handling it. Elements are 
-processed by the `processElement()` method, watermarks by the `processWatermark()`, and checkpoint barriers trigger a 
-checkpoint which invokes (asynchronously) the `snapshotState()` method, which we describe below. For each incoming element,
-depending on its type one of the aforementioned methods is called. Note that the `processElement()` is also the place 
-where the UDF's logic is invoked, *e.g.* the `map()` method of your `MapFunction`.
-
-Finally, in the case of a normal, fault-free termination of the operator (*e.g.* if the stream is
-finite and its end is reached), the `finish()` method is called to perform any final bookkeeping
-action required by the operator's logic (*e.g.* flush any buffered data, or emit data to mark end of
-procesing), and the `close()` is called after that to free any resources held by the operator
-(*e.g.* open network connections, io streams, or native memory held by the operator's data).
-
-In the case of a termination due to a failure or due to manual cancellation, the execution jumps directly to the `close()`
-and skips any intermediate phases between the phase the operator was in when the failure happened and the `close()`.
-
-**Checkpoints:** The `snapshotState()` method of the operator is called asynchronously to the rest of the methods described 
-above whenever a checkpoint barrier is received. Checkpoints are performed during the processing phase, *i.e.* after the 
-operator is opened and before it is closed. The responsibility of this method is to store the current state of the operator 
-to the specified [state backend]({{< ref "docs/ops/state/state_backends" >}}) from where it will be retrieved when 
-the job resumes execution after a failure. Below we include a brief description of Flink's checkpointing mechanism, 
-and for a more detailed discussion on the principles around checkpointing in Flink please read the corresponding documentation: 
-[Data Streaming Fault Tolerance]({{< ref "docs/learn-flink/fault_tolerance" >}}).
-
-## Task Lifecycle
-
-Following that brief introduction on the operator's main phases, this section describes in more detail how a task calls 
-the respective methods during its execution on a cluster. The sequence of the phases described here is mainly included 
-in the `invoke()` method of the `StreamTask` class. The remainder of this document is split into two subsections, one 
-describing the phases during a regular, fault-free execution of a task (see [Normal Execution](#normal-execution)), and 
-(a shorter) one describing the different sequence followed in case the task is cancelled (see [Interrupted Execution](#interrupted-execution)), 
-either manually, or due some other reason, *e.g.* an exception thrown during execution.
-
-### Normal Execution
-
-The steps a task goes through when executed until completion without being interrupted are illustrated below:
-
-        TASK::setInitialState
-        TASK::invoke
-            create basic utils (config, etc) and load the chain of operators
-            setup-operators
-            task-specific-init
-            initialize-operator-states
-            open-operators
-            run
-            finish-operators
-            close-operators
-            task-specific-cleanup
-            common-cleanup
-
-As shown above, after recovering the task configuration and initializing some important runtime parameters, the very 
-first step for the task is to retrieve its initial, task-wide state. This is done in the `setInitialState()`, and it is 
-particularly important in two cases:
-
-1. when the task is recovering from a failure and restarts from the last successful checkpoint
-2. when resuming from a [savepoint]({{< ref "docs/ops/state/savepoints" >}}). 
-
-If it is the first time the task is executed, the initial task state is empty. 
-
-After recovering any initial state, the task goes into its `invoke()` method. There, it first initializes the operators 
-involved in the local computation by calling the `setup()` method of each one of them and then performs its task-specific 
-initialization by calling the local `init()` method. By task-specific, we mean that depending on the type of the task 
-(`SourceTask`, `OneInputStreamTask` or `TwoInputStreamTask`, etc), this step may differ, but in any case, here is where 
-the necessary task-wide resources are acquired. As an example, the `OneInputStreamTask`, which represents a task that 
-expects to have a single input stream, initializes the connection(s) to the location(s) of the different partitions of 
-the input stream that are relevant to the local task.
-
-Having acquired the necessary resources, it is time for the different operators and user-defined functions to acquire 
-their individual state from the task-wide state retrieved above. This is done in the `initializeState()` method, which 
-calls the `initializeState()` of each individual operator. This method should be overridden by every stateful operator 
-and should contain the state initialization logic, both for the first time a job is executed, and also for the case when 
-the task recovers from a failure or when using a savepoint.
-
-Now that all operators in the task have been initialized, the `open()` method of each individual operator is called by 
-the `openAllOperators()` method of the `StreamTask`. This method performs all the operational initialization, 
-such as registering any retrieved timers with the timer service. A single task may be executing multiple operators with one 
-consuming the output of its predecessor. In this case, the `open()` method is called from the last operator, *i.e.* the 
-one whose output is also the output of the task itself, to the first. This is done so that when the first operator starts 
-processing the task's input, all downstream operators are ready to receive its output.
+当所有初始化都完成之后,算子开始处理流入的数据。流入的数据可以分为三种类型:用户数据、watermark 和 checkpoint barriers。每种类型的数据都有单独的方法来处理。用户数据通过 `processElement()` 方法来处理,watermark 通过 `processWatermark()` 来处理,checkpoint barriers 会调用(异步)`snapshotState()` 方法触发 checkpoint。对于每个流入的数据,根据其类型调用上述相应的方法。注意,`processElement()` 方法也是用户自定义函数逻辑执行的地方,比如用户自定义 `MapFunction` 里的  `map()` 方法。
+
+最后,在算子正常无故障的情况下(比如,如果流式数据是有限的,并且最后一个数据已经到达),会调用 `finish()` 方法结束算子并进行必要的清理工作(比如刷新所有缓冲数据,或发送处理结束的标记数据)。在这之后会调用 `close()` 方法来释放算子持有的资源(比如算子数据持有的本地内存)。
+
+在作业失败或手动取消的情况下,会略过从算子异常位置到 `close()` 中间的所有步骤,直接跳到 `close()` 方法结束算子。
+
+**Checkpoints:** 算子的 `snapshotState()` 方法是在收到 checkpoint barrier 后异步调用的。Checkpoint 在处理阶段执行,即算子打开之后,结束之前的这个阶段。这个方法的职责是存储算子的当前状态到一个特定的[状态后端]({{< ref "docs/ops/state/state_backends" >}}),当作业失败后恢复执行时会从这个后端恢复状态数据。下面我们简要描述了 Flink 的 checkpoint 机制,如果想了解更多 Flink checkpoint 相关的原理,可以读一读 [数据流容错]({{< ref "docs/learn-flink/fault_tolerance" >}})。
+
+<a name="task-lifecycle-1"> </a>
+
+## Task 生命周期
+
+在上文对算子主要阶段的简要介绍之后,本节将详细介绍 task 在集群执行期间是如何调用相关方法的。这里所说的阶段主要包含在 `StreamTask` 类的 `invoke()` 方法里。本文档的剩余部分会分成两个子章节,其中一节描述了 task 在常规没有失败情况下执行的阶段(请参考 [常规执行](#normal-execution)),另外一节描述了 task 取消之后执行的阶段(请参考 [中断执行](#interrupted-execution)),不管是手动取消还是其他原因(比如执行期间遇到异常)导致的取消。
+
+<a name="normal-execution"> </a>

Review comment:
       same as the above mentioned.

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,119 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 *5* 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
+
+## 算子生命周期简介
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),因此我们在每个算子下也展示(以缩进的方式)了 UDF 生命周期中调用的各个方法。`AbstractUdfStreamOperator` 是所有执行 UDF 的算子的基类,如果算子继承了 `AbstractUdfStreamOperator`,那么这些方法都是可用的。
 
-## Operator Lifecycle in a nutshell
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
+ 
 
-        // initialization phase
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        // 处理阶段(对每个 element 或 watermark 调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(对每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,在算子初始化时调用 `setup()` 来初始化算子的特定设置,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户自定义函数。
 
 {{< hint info >}}
-The `initializeState()` contains both the logic for initializing the 
-state of the operator during its initial execution (*e.g.* register any keyed state), and also the logic to retrieve its
-state from a checkpoint after a failure. More about this on the rest of this page.
+`initializeState()` 既包含在初始化过程中算子状态的初始化逻辑(比如注册 keyed 状态),又包含异常后从 checkpoint 中恢复原有状态的逻辑。在接下来的篇幅会进行更详细的介绍。
 {{< /hint >}}
 
-Now that everything is set, the operator is ready to process incoming data. Incoming elements can be one of the following: 
-input elements, watermark, and checkpoint barriers. Each one of them has a special element for handling it. Elements are 
-processed by the `processElement()` method, watermarks by the `processWatermark()`, and checkpoint barriers trigger a 
-checkpoint which invokes (asynchronously) the `snapshotState()` method, which we describe below. For each incoming element,
-depending on its type one of the aforementioned methods is called. Note that the `processElement()` is also the place 
-where the UDF's logic is invoked, *e.g.* the `map()` method of your `MapFunction`.
-
-Finally, in the case of a normal, fault-free termination of the operator (*e.g.* if the stream is
-finite and its end is reached), the `finish()` method is called to perform any final bookkeeping
-action required by the operator's logic (*e.g.* flush any buffered data, or emit data to mark end of
-procesing), and the `close()` is called after that to free any resources held by the operator
-(*e.g.* open network connections, io streams, or native memory held by the operator's data).
-
-In the case of a termination due to a failure or due to manual cancellation, the execution jumps directly to the `close()`
-and skips any intermediate phases between the phase the operator was in when the failure happened and the `close()`.
-
-**Checkpoints:** The `snapshotState()` method of the operator is called asynchronously to the rest of the methods described 
-above whenever a checkpoint barrier is received. Checkpoints are performed during the processing phase, *i.e.* after the 
-operator is opened and before it is closed. The responsibility of this method is to store the current state of the operator 
-to the specified [state backend]({{< ref "docs/ops/state/state_backends" >}}) from where it will be retrieved when 
-the job resumes execution after a failure. Below we include a brief description of Flink's checkpointing mechanism, 
-and for a more detailed discussion on the principles around checkpointing in Flink please read the corresponding documentation: 
-[Data Streaming Fault Tolerance]({{< ref "docs/learn-flink/fault_tolerance" >}}).
-
-## Task Lifecycle
-
-Following that brief introduction on the operator's main phases, this section describes in more detail how a task calls 
-the respective methods during its execution on a cluster. The sequence of the phases described here is mainly included 
-in the `invoke()` method of the `StreamTask` class. The remainder of this document is split into two subsections, one 
-describing the phases during a regular, fault-free execution of a task (see [Normal Execution](#normal-execution)), and 
-(a shorter) one describing the different sequence followed in case the task is cancelled (see [Interrupted Execution](#interrupted-execution)), 
-either manually, or due some other reason, *e.g.* an exception thrown during execution.
-
-### Normal Execution
-
-The steps a task goes through when executed until completion without being interrupted are illustrated below:
-
-        TASK::setInitialState
-        TASK::invoke
-            create basic utils (config, etc) and load the chain of operators
-            setup-operators
-            task-specific-init
-            initialize-operator-states
-            open-operators
-            run
-            finish-operators
-            close-operators
-            task-specific-cleanup
-            common-cleanup
-
-As shown above, after recovering the task configuration and initializing some important runtime parameters, the very 
-first step for the task is to retrieve its initial, task-wide state. This is done in the `setInitialState()`, and it is 
-particularly important in two cases:
-
-1. when the task is recovering from a failure and restarts from the last successful checkpoint
-2. when resuming from a [savepoint]({{< ref "docs/ops/state/savepoints" >}}). 
-
-If it is the first time the task is executed, the initial task state is empty. 
-
-After recovering any initial state, the task goes into its `invoke()` method. There, it first initializes the operators 
-involved in the local computation by calling the `setup()` method of each one of them and then performs its task-specific 
-initialization by calling the local `init()` method. By task-specific, we mean that depending on the type of the task 
-(`SourceTask`, `OneInputStreamTask` or `TwoInputStreamTask`, etc), this step may differ, but in any case, here is where 
-the necessary task-wide resources are acquired. As an example, the `OneInputStreamTask`, which represents a task that 
-expects to have a single input stream, initializes the connection(s) to the location(s) of the different partitions of 
-the input stream that are relevant to the local task.
-
-Having acquired the necessary resources, it is time for the different operators and user-defined functions to acquire 
-their individual state from the task-wide state retrieved above. This is done in the `initializeState()` method, which 
-calls the `initializeState()` of each individual operator. This method should be overridden by every stateful operator 
-and should contain the state initialization logic, both for the first time a job is executed, and also for the case when 
-the task recovers from a failure or when using a savepoint.
-
-Now that all operators in the task have been initialized, the `open()` method of each individual operator is called by 
-the `openAllOperators()` method of the `StreamTask`. This method performs all the operational initialization, 
-such as registering any retrieved timers with the timer service. A single task may be executing multiple operators with one 
-consuming the output of its predecessor. In this case, the `open()` method is called from the last operator, *i.e.* the 
-one whose output is also the output of the task itself, to the first. This is done so that when the first operator starts 
-processing the task's input, all downstream operators are ready to receive its output.
+当所有初始化都完成之后,算子开始处理流入的数据。流入的数据可以分为三种类型:用户数据、watermark 和 checkpoint barriers。每种类型的数据都有单独的方法来处理。用户数据通过 `processElement()` 方法来处理,watermark 通过 `processWatermark()` 来处理,checkpoint barriers 会调用(异步)`snapshotState()` 方法触发 checkpoint。对于每个流入的数据,根据其类型调用上述相应的方法。注意,`processElement()` 方法也是用户自定义函数逻辑执行的地方,比如用户自定义 `MapFunction` 里的  `map()` 方法。
+
+最后,在算子正常无故障的情况下(比如,如果流式数据是有限的,并且最后一个数据已经到达),会调用 `finish()` 方法结束算子并进行必要的清理工作(比如刷新所有缓冲数据,或发送处理结束的标记数据)。在这之后会调用 `close()` 方法来释放算子持有的资源(比如算子数据持有的本地内存)。
+
+在作业失败或手动取消的情况下,会略过从算子异常位置到 `close()` 中间的所有步骤,直接跳到 `close()` 方法结束算子。
+
+**Checkpoints:** 算子的 `snapshotState()` 方法是在收到 checkpoint barrier 后异步调用的。Checkpoint 在处理阶段执行,即算子打开之后,结束之前的这个阶段。这个方法的职责是存储算子的当前状态到一个特定的[状态后端]({{< ref "docs/ops/state/state_backends" >}}),当作业失败后恢复执行时会从这个后端恢复状态数据。下面我们简要描述了 Flink 的 checkpoint 机制,如果想了解更多 Flink checkpoint 相关的原理,可以读一读 [数据流容错]({{< ref "docs/learn-flink/fault_tolerance" >}})。
+
+<a name="task-lifecycle-1"> </a>
+
+## Task 生命周期
+
+在上文对算子主要阶段的简要介绍之后,本节将详细介绍 task 在集群执行期间是如何调用相关方法的。这里所说的阶段主要包含在 `StreamTask` 类的 `invoke()` 方法里。本文档的剩余部分会分成两个子章节,其中一节描述了 task 在常规没有失败情况下执行的阶段(请参考 [常规执行](#normal-execution)),另外一节描述了 task 取消之后执行的阶段(请参考 [中断执行](#interrupted-execution)),不管是手动取消还是其他原因(比如执行期间遇到异常)导致的取消。
+
+<a name="normal-execution"> </a>
+
+### 常规执行
+
+Task 在没有中断的情况下执行直到最终的步骤如下所示:
+
+	    TASK::setInitialState
+	    TASK::invoke
+		    create basic utils (config, etc) and load the chain of operators
+		    setup-operators
+		    task-specific-init
+		    initialize-operator-states
+	   	    open-operators
+		    run
+		    finish-operators
+		    close-operators
+		    task-specific-cleanup
+		    common-cleanup
+
+如上所示,在恢复 task 配置和初始化一些重要的运行时参数之后,task 的下一步是读取 task 级别的初始状态数据。这一步在 `setInitialState()` 方法里完成,在下面两个场景特别重要:
+
+1. 当 Task 从失败中恢复,从最后一次成功的 checkpoint 重启的时候

Review comment:
       ```suggestion
   1、当 Task 从失败中恢复并从最近一次成功的 checkpoint 重启的时候
   ```

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,119 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 *5* 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
+
+## 算子生命周期简介
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),因此我们在每个算子下也展示(以缩进的方式)了 UDF 生命周期中调用的各个方法。`AbstractUdfStreamOperator` 是所有执行 UDF 的算子的基类,如果算子继承了 `AbstractUdfStreamOperator`,那么这些方法都是可用的。
 
-## Operator Lifecycle in a nutshell
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
+ 
 
-        // initialization phase
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        // 处理阶段(对每个 element 或 watermark 调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(对每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,在算子初始化时调用 `setup()` 来初始化算子的特定设置,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户自定义函数。
 
 {{< hint info >}}
-The `initializeState()` contains both the logic for initializing the 
-state of the operator during its initial execution (*e.g.* register any keyed state), and also the logic to retrieve its
-state from a checkpoint after a failure. More about this on the rest of this page.
+`initializeState()` 既包含在初始化过程中算子状态的初始化逻辑(比如注册 keyed 状态),又包含异常后从 checkpoint 中恢复原有状态的逻辑。在接下来的篇幅会进行更详细的介绍。
 {{< /hint >}}
 
-Now that everything is set, the operator is ready to process incoming data. Incoming elements can be one of the following: 
-input elements, watermark, and checkpoint barriers. Each one of them has a special element for handling it. Elements are 
-processed by the `processElement()` method, watermarks by the `processWatermark()`, and checkpoint barriers trigger a 
-checkpoint which invokes (asynchronously) the `snapshotState()` method, which we describe below. For each incoming element,
-depending on its type one of the aforementioned methods is called. Note that the `processElement()` is also the place 
-where the UDF's logic is invoked, *e.g.* the `map()` method of your `MapFunction`.
-
-Finally, in the case of a normal, fault-free termination of the operator (*e.g.* if the stream is
-finite and its end is reached), the `finish()` method is called to perform any final bookkeeping
-action required by the operator's logic (*e.g.* flush any buffered data, or emit data to mark end of
-procesing), and the `close()` is called after that to free any resources held by the operator
-(*e.g.* open network connections, io streams, or native memory held by the operator's data).
-
-In the case of a termination due to a failure or due to manual cancellation, the execution jumps directly to the `close()`
-and skips any intermediate phases between the phase the operator was in when the failure happened and the `close()`.
-
-**Checkpoints:** The `snapshotState()` method of the operator is called asynchronously to the rest of the methods described 
-above whenever a checkpoint barrier is received. Checkpoints are performed during the processing phase, *i.e.* after the 
-operator is opened and before it is closed. The responsibility of this method is to store the current state of the operator 
-to the specified [state backend]({{< ref "docs/ops/state/state_backends" >}}) from where it will be retrieved when 
-the job resumes execution after a failure. Below we include a brief description of Flink's checkpointing mechanism, 
-and for a more detailed discussion on the principles around checkpointing in Flink please read the corresponding documentation: 
-[Data Streaming Fault Tolerance]({{< ref "docs/learn-flink/fault_tolerance" >}}).
-
-## Task Lifecycle
-
-Following that brief introduction on the operator's main phases, this section describes in more detail how a task calls 
-the respective methods during its execution on a cluster. The sequence of the phases described here is mainly included 
-in the `invoke()` method of the `StreamTask` class. The remainder of this document is split into two subsections, one 
-describing the phases during a regular, fault-free execution of a task (see [Normal Execution](#normal-execution)), and 
-(a shorter) one describing the different sequence followed in case the task is cancelled (see [Interrupted Execution](#interrupted-execution)), 
-either manually, or due some other reason, *e.g.* an exception thrown during execution.
-
-### Normal Execution
-
-The steps a task goes through when executed until completion without being interrupted are illustrated below:
-
-        TASK::setInitialState
-        TASK::invoke
-            create basic utils (config, etc) and load the chain of operators
-            setup-operators
-            task-specific-init
-            initialize-operator-states
-            open-operators
-            run
-            finish-operators
-            close-operators
-            task-specific-cleanup
-            common-cleanup
-
-As shown above, after recovering the task configuration and initializing some important runtime parameters, the very 
-first step for the task is to retrieve its initial, task-wide state. This is done in the `setInitialState()`, and it is 
-particularly important in two cases:
-
-1. when the task is recovering from a failure and restarts from the last successful checkpoint
-2. when resuming from a [savepoint]({{< ref "docs/ops/state/savepoints" >}}). 
-
-If it is the first time the task is executed, the initial task state is empty. 
-
-After recovering any initial state, the task goes into its `invoke()` method. There, it first initializes the operators 
-involved in the local computation by calling the `setup()` method of each one of them and then performs its task-specific 
-initialization by calling the local `init()` method. By task-specific, we mean that depending on the type of the task 
-(`SourceTask`, `OneInputStreamTask` or `TwoInputStreamTask`, etc), this step may differ, but in any case, here is where 
-the necessary task-wide resources are acquired. As an example, the `OneInputStreamTask`, which represents a task that 
-expects to have a single input stream, initializes the connection(s) to the location(s) of the different partitions of 
-the input stream that are relevant to the local task.
-
-Having acquired the necessary resources, it is time for the different operators and user-defined functions to acquire 
-their individual state from the task-wide state retrieved above. This is done in the `initializeState()` method, which 
-calls the `initializeState()` of each individual operator. This method should be overridden by every stateful operator 
-and should contain the state initialization logic, both for the first time a job is executed, and also for the case when 
-the task recovers from a failure or when using a savepoint.
-
-Now that all operators in the task have been initialized, the `open()` method of each individual operator is called by 
-the `openAllOperators()` method of the `StreamTask`. This method performs all the operational initialization, 
-such as registering any retrieved timers with the timer service. A single task may be executing multiple operators with one 
-consuming the output of its predecessor. In this case, the `open()` method is called from the last operator, *i.e.* the 
-one whose output is also the output of the task itself, to the first. This is done so that when the first operator starts 
-processing the task's input, all downstream operators are ready to receive its output.
+当所有初始化都完成之后,算子开始处理流入的数据。流入的数据可以分为三种类型:用户数据、watermark 和 checkpoint barriers。每种类型的数据都有单独的方法来处理。用户数据通过 `processElement()` 方法来处理,watermark 通过 `processWatermark()` 来处理,checkpoint barriers 会调用(异步)`snapshotState()` 方法触发 checkpoint。对于每个流入的数据,根据其类型调用上述相应的方法。注意,`processElement()` 方法也是用户自定义函数逻辑执行的地方,比如用户自定义 `MapFunction` 里的  `map()` 方法。
+
+最后,在算子正常无故障的情况下(比如,如果流式数据是有限的,并且最后一个数据已经到达),会调用 `finish()` 方法结束算子并进行必要的清理工作(比如刷新所有缓冲数据,或发送处理结束的标记数据)。在这之后会调用 `close()` 方法来释放算子持有的资源(比如算子数据持有的本地内存)。
+
+在作业失败或手动取消的情况下,会略过从算子异常位置到 `close()` 中间的所有步骤,直接跳到 `close()` 方法结束算子。
+
+**Checkpoints:** 算子的 `snapshotState()` 方法是在收到 checkpoint barrier 后异步调用的。Checkpoint 在处理阶段执行,即算子打开之后,结束之前的这个阶段。这个方法的职责是存储算子的当前状态到一个特定的[状态后端]({{< ref "docs/ops/state/state_backends" >}}),当作业失败后恢复执行时会从这个后端恢复状态数据。下面我们简要描述了 Flink 的 checkpoint 机制,如果想了解更多 Flink checkpoint 相关的原理,可以读一读 [数据流容错]({{< ref "docs/learn-flink/fault_tolerance" >}})。
+
+<a name="task-lifecycle-1"> </a>
+
+## Task 生命周期
+
+在上文对算子主要阶段的简要介绍之后,本节将详细介绍 task 在集群执行期间是如何调用相关方法的。这里所说的阶段主要包含在 `StreamTask` 类的 `invoke()` 方法里。本文档的剩余部分会分成两个子章节,其中一节描述了 task 在常规没有失败情况下执行的阶段(请参考 [常规执行](#normal-execution)),另外一节描述了 task 取消之后执行的阶段(请参考 [中断执行](#interrupted-execution)),不管是手动取消还是其他原因(比如执行期间遇到异常)导致的取消。
+
+<a name="normal-execution"> </a>
+
+### 常规执行
+
+Task 在没有中断的情况下执行直到最终的步骤如下所示:
+
+	    TASK::setInitialState
+	    TASK::invoke
+		    create basic utils (config, etc) and load the chain of operators
+		    setup-operators
+		    task-specific-init
+		    initialize-operator-states
+	   	    open-operators
+		    run
+		    finish-operators
+		    close-operators
+		    task-specific-cleanup
+		    common-cleanup
+
+如上所示,在恢复 task 配置和初始化一些重要的运行时参数之后,task 的下一步是读取 task 级别的初始状态数据。这一步在 `setInitialState()` 方法里完成,在下面两个场景特别重要:
+
+1. 当 Task 从失败中恢复,从最后一次成功的 checkpoint 重启的时候
+2. 当 Task 从 [savepoint]({{< ref "docs/ops/state/savepoints" >}}) 里恢复的时候。
+
+如果 task 是第一次执行的话,它的初始状态为空。
+
+在恢复初始状态之后,task 进入到 `invoke()` 方法。在这里,首先调用 `setup()` 方法来初始化本地计算涉及到的每个算子,然后调用本地的 `init()` 方法来做特定 task 的初始化。这里所说的特定 task,取决于 task 的类型 (`SourceTask`,`OneInputStreamTask` 或 `TwoInputStreamTask` 等等)。这一步可能会有所不同,但却是申请 task 范围所需资源的地方。例如,`OneInputStreamTask` ,只有一个上游的 task,会初始化和上游的连接。
+
+在申请到必要的资源之后,不同算子和用户定义函数开始从上面读到的 task 范围状态数据里获取他们各自的状态值。这块工作是在各个算子调用 `initializeState()` 时完成。每个有状态的算子都应该重写该方法,包含状态的初始化逻辑,既适用于作业第一次执行的场景,又适用于 task 从 checkpoint 或 savepoint 中恢复的场景。

Review comment:
       ```suggestion
   在申请到必要的资源之后,不同算子和用户定义函数开始从上面读到的 task 范围状态数据里获取它们各自的状态值。这一部分是算子调用 `initializeState()` 完成的。每个有状态的算子都应该重写该方法,包含状态的初始化逻辑,既适用于作业第一次执行的场景,又适用于 task 从 checkpoint 或 savepoint 中恢复的场景。
   ```

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,119 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 *5* 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
+
+## 算子生命周期简介
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),因此我们在每个算子下也展示(以缩进的方式)了 UDF 生命周期中调用的各个方法。`AbstractUdfStreamOperator` 是所有执行 UDF 的算子的基类,如果算子继承了 `AbstractUdfStreamOperator`,那么这些方法都是可用的。
 
-## Operator Lifecycle in a nutshell
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
+ 
 
-        // initialization phase
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        // 处理阶段(对每个 element 或 watermark 调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(对每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,在算子初始化时调用 `setup()` 来初始化算子的特定设置,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户自定义函数。
 
 {{< hint info >}}
-The `initializeState()` contains both the logic for initializing the 
-state of the operator during its initial execution (*e.g.* register any keyed state), and also the logic to retrieve its
-state from a checkpoint after a failure. More about this on the rest of this page.
+`initializeState()` 既包含在初始化过程中算子状态的初始化逻辑(比如注册 keyed 状态),又包含异常后从 checkpoint 中恢复原有状态的逻辑。在接下来的篇幅会进行更详细的介绍。
 {{< /hint >}}
 
-Now that everything is set, the operator is ready to process incoming data. Incoming elements can be one of the following: 
-input elements, watermark, and checkpoint barriers. Each one of them has a special element for handling it. Elements are 
-processed by the `processElement()` method, watermarks by the `processWatermark()`, and checkpoint barriers trigger a 
-checkpoint which invokes (asynchronously) the `snapshotState()` method, which we describe below. For each incoming element,
-depending on its type one of the aforementioned methods is called. Note that the `processElement()` is also the place 
-where the UDF's logic is invoked, *e.g.* the `map()` method of your `MapFunction`.
-
-Finally, in the case of a normal, fault-free termination of the operator (*e.g.* if the stream is
-finite and its end is reached), the `finish()` method is called to perform any final bookkeeping
-action required by the operator's logic (*e.g.* flush any buffered data, or emit data to mark end of
-procesing), and the `close()` is called after that to free any resources held by the operator
-(*e.g.* open network connections, io streams, or native memory held by the operator's data).
-
-In the case of a termination due to a failure or due to manual cancellation, the execution jumps directly to the `close()`
-and skips any intermediate phases between the phase the operator was in when the failure happened and the `close()`.
-
-**Checkpoints:** The `snapshotState()` method of the operator is called asynchronously to the rest of the methods described 
-above whenever a checkpoint barrier is received. Checkpoints are performed during the processing phase, *i.e.* after the 
-operator is opened and before it is closed. The responsibility of this method is to store the current state of the operator 
-to the specified [state backend]({{< ref "docs/ops/state/state_backends" >}}) from where it will be retrieved when 
-the job resumes execution after a failure. Below we include a brief description of Flink's checkpointing mechanism, 
-and for a more detailed discussion on the principles around checkpointing in Flink please read the corresponding documentation: 
-[Data Streaming Fault Tolerance]({{< ref "docs/learn-flink/fault_tolerance" >}}).
-
-## Task Lifecycle
-
-Following that brief introduction on the operator's main phases, this section describes in more detail how a task calls 
-the respective methods during its execution on a cluster. The sequence of the phases described here is mainly included 
-in the `invoke()` method of the `StreamTask` class. The remainder of this document is split into two subsections, one 
-describing the phases during a regular, fault-free execution of a task (see [Normal Execution](#normal-execution)), and 
-(a shorter) one describing the different sequence followed in case the task is cancelled (see [Interrupted Execution](#interrupted-execution)), 
-either manually, or due some other reason, *e.g.* an exception thrown during execution.
-
-### Normal Execution
-
-The steps a task goes through when executed until completion without being interrupted are illustrated below:
-
-        TASK::setInitialState
-        TASK::invoke
-            create basic utils (config, etc) and load the chain of operators
-            setup-operators
-            task-specific-init
-            initialize-operator-states
-            open-operators
-            run
-            finish-operators
-            close-operators
-            task-specific-cleanup
-            common-cleanup
-
-As shown above, after recovering the task configuration and initializing some important runtime parameters, the very 
-first step for the task is to retrieve its initial, task-wide state. This is done in the `setInitialState()`, and it is 
-particularly important in two cases:
-
-1. when the task is recovering from a failure and restarts from the last successful checkpoint
-2. when resuming from a [savepoint]({{< ref "docs/ops/state/savepoints" >}}). 
-
-If it is the first time the task is executed, the initial task state is empty. 
-
-After recovering any initial state, the task goes into its `invoke()` method. There, it first initializes the operators 
-involved in the local computation by calling the `setup()` method of each one of them and then performs its task-specific 
-initialization by calling the local `init()` method. By task-specific, we mean that depending on the type of the task 
-(`SourceTask`, `OneInputStreamTask` or `TwoInputStreamTask`, etc), this step may differ, but in any case, here is where 
-the necessary task-wide resources are acquired. As an example, the `OneInputStreamTask`, which represents a task that 
-expects to have a single input stream, initializes the connection(s) to the location(s) of the different partitions of 
-the input stream that are relevant to the local task.
-
-Having acquired the necessary resources, it is time for the different operators and user-defined functions to acquire 
-their individual state from the task-wide state retrieved above. This is done in the `initializeState()` method, which 
-calls the `initializeState()` of each individual operator. This method should be overridden by every stateful operator 
-and should contain the state initialization logic, both for the first time a job is executed, and also for the case when 
-the task recovers from a failure or when using a savepoint.
-
-Now that all operators in the task have been initialized, the `open()` method of each individual operator is called by 
-the `openAllOperators()` method of the `StreamTask`. This method performs all the operational initialization, 
-such as registering any retrieved timers with the timer service. A single task may be executing multiple operators with one 
-consuming the output of its predecessor. In this case, the `open()` method is called from the last operator, *i.e.* the 
-one whose output is also the output of the task itself, to the first. This is done so that when the first operator starts 
-processing the task's input, all downstream operators are ready to receive its output.
+当所有初始化都完成之后,算子开始处理流入的数据。流入的数据可以分为三种类型:用户数据、watermark 和 checkpoint barriers。每种类型的数据都有单独的方法来处理。用户数据通过 `processElement()` 方法来处理,watermark 通过 `processWatermark()` 来处理,checkpoint barriers 会调用(异步)`snapshotState()` 方法触发 checkpoint。对于每个流入的数据,根据其类型调用上述相应的方法。注意,`processElement()` 方法也是用户自定义函数逻辑执行的地方,比如用户自定义 `MapFunction` 里的  `map()` 方法。
+
+最后,在算子正常无故障的情况下(比如,如果流式数据是有限的,并且最后一个数据已经到达),会调用 `finish()` 方法结束算子并进行必要的清理工作(比如刷新所有缓冲数据,或发送处理结束的标记数据)。在这之后会调用 `close()` 方法来释放算子持有的资源(比如算子数据持有的本地内存)。
+
+在作业失败或手动取消的情况下,会略过从算子异常位置到 `close()` 中间的所有步骤,直接跳到 `close()` 方法结束算子。
+
+**Checkpoints:** 算子的 `snapshotState()` 方法是在收到 checkpoint barrier 后异步调用的。Checkpoint 在处理阶段执行,即算子打开之后,结束之前的这个阶段。这个方法的职责是存储算子的当前状态到一个特定的[状态后端]({{< ref "docs/ops/state/state_backends" >}}),当作业失败后恢复执行时会从这个后端恢复状态数据。下面我们简要描述了 Flink 的 checkpoint 机制,如果想了解更多 Flink checkpoint 相关的原理,可以读一读 [数据流容错]({{< ref "docs/learn-flink/fault_tolerance" >}})。
+
+<a name="task-lifecycle-1"> </a>
+
+## Task 生命周期
+
+在上文对算子主要阶段的简要介绍之后,本节将详细介绍 task 在集群执行期间是如何调用相关方法的。这里所说的阶段主要包含在 `StreamTask` 类的 `invoke()` 方法里。本文档的剩余部分会分成两个子章节,其中一节描述了 task 在常规没有失败情况下执行的阶段(请参考 [常规执行](#normal-execution)),另外一节描述了 task 取消之后执行的阶段(请参考 [中断执行](#interrupted-execution)),不管是手动取消还是其他原因(比如执行期间遇到异常)导致的取消。
+
+<a name="normal-execution"> </a>
+
+### 常规执行
+
+Task 在没有中断的情况下执行直到最终的步骤如下所示:
+
+	    TASK::setInitialState
+	    TASK::invoke
+		    create basic utils (config, etc) and load the chain of operators
+		    setup-operators
+		    task-specific-init
+		    initialize-operator-states
+	   	    open-operators
+		    run
+		    finish-operators
+		    close-operators
+		    task-specific-cleanup
+		    common-cleanup
+
+如上所示,在恢复 task 配置和初始化一些重要的运行时参数之后,task 的下一步是读取 task 级别的初始状态数据。这一步在 `setInitialState()` 方法里完成,在下面两个场景特别重要:
+
+1. 当 Task 从失败中恢复,从最后一次成功的 checkpoint 重启的时候
+2. 当 Task 从 [savepoint]({{< ref "docs/ops/state/savepoints" >}}) 里恢复的时候。

Review comment:
       ```suggestion
   2、当 Task 从 [savepoint]({{< ref "docs/ops/state/savepoints" >}}) 恢复的时候。
   ```

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,119 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 *5* 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
+
+## 算子生命周期简介
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),因此我们在每个算子下也展示(以缩进的方式)了 UDF 生命周期中调用的各个方法。`AbstractUdfStreamOperator` 是所有执行 UDF 的算子的基类,如果算子继承了 `AbstractUdfStreamOperator`,那么这些方法都是可用的。
 
-## Operator Lifecycle in a nutshell
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
+ 
 
-        // initialization phase
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        // 处理阶段(对每个 element 或 watermark 调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(对每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,在算子初始化时调用 `setup()` 来初始化算子的特定设置,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户自定义函数。
 
 {{< hint info >}}
-The `initializeState()` contains both the logic for initializing the 
-state of the operator during its initial execution (*e.g.* register any keyed state), and also the logic to retrieve its
-state from a checkpoint after a failure. More about this on the rest of this page.
+`initializeState()` 既包含在初始化过程中算子状态的初始化逻辑(比如注册 keyed 状态),又包含异常后从 checkpoint 中恢复原有状态的逻辑。在接下来的篇幅会进行更详细的介绍。
 {{< /hint >}}
 
-Now that everything is set, the operator is ready to process incoming data. Incoming elements can be one of the following: 
-input elements, watermark, and checkpoint barriers. Each one of them has a special element for handling it. Elements are 
-processed by the `processElement()` method, watermarks by the `processWatermark()`, and checkpoint barriers trigger a 
-checkpoint which invokes (asynchronously) the `snapshotState()` method, which we describe below. For each incoming element,
-depending on its type one of the aforementioned methods is called. Note that the `processElement()` is also the place 
-where the UDF's logic is invoked, *e.g.* the `map()` method of your `MapFunction`.
-
-Finally, in the case of a normal, fault-free termination of the operator (*e.g.* if the stream is
-finite and its end is reached), the `finish()` method is called to perform any final bookkeeping
-action required by the operator's logic (*e.g.* flush any buffered data, or emit data to mark end of
-procesing), and the `close()` is called after that to free any resources held by the operator
-(*e.g.* open network connections, io streams, or native memory held by the operator's data).
-
-In the case of a termination due to a failure or due to manual cancellation, the execution jumps directly to the `close()`
-and skips any intermediate phases between the phase the operator was in when the failure happened and the `close()`.
-
-**Checkpoints:** The `snapshotState()` method of the operator is called asynchronously to the rest of the methods described 
-above whenever a checkpoint barrier is received. Checkpoints are performed during the processing phase, *i.e.* after the 
-operator is opened and before it is closed. The responsibility of this method is to store the current state of the operator 
-to the specified [state backend]({{< ref "docs/ops/state/state_backends" >}}) from where it will be retrieved when 
-the job resumes execution after a failure. Below we include a brief description of Flink's checkpointing mechanism, 
-and for a more detailed discussion on the principles around checkpointing in Flink please read the corresponding documentation: 
-[Data Streaming Fault Tolerance]({{< ref "docs/learn-flink/fault_tolerance" >}}).
-
-## Task Lifecycle
-
-Following that brief introduction on the operator's main phases, this section describes in more detail how a task calls 
-the respective methods during its execution on a cluster. The sequence of the phases described here is mainly included 
-in the `invoke()` method of the `StreamTask` class. The remainder of this document is split into two subsections, one 
-describing the phases during a regular, fault-free execution of a task (see [Normal Execution](#normal-execution)), and 
-(a shorter) one describing the different sequence followed in case the task is cancelled (see [Interrupted Execution](#interrupted-execution)), 
-either manually, or due some other reason, *e.g.* an exception thrown during execution.
-
-### Normal Execution
-
-The steps a task goes through when executed until completion without being interrupted are illustrated below:
-
-        TASK::setInitialState
-        TASK::invoke
-            create basic utils (config, etc) and load the chain of operators
-            setup-operators
-            task-specific-init
-            initialize-operator-states
-            open-operators
-            run
-            finish-operators
-            close-operators
-            task-specific-cleanup
-            common-cleanup
-
-As shown above, after recovering the task configuration and initializing some important runtime parameters, the very 
-first step for the task is to retrieve its initial, task-wide state. This is done in the `setInitialState()`, and it is 
-particularly important in two cases:
-
-1. when the task is recovering from a failure and restarts from the last successful checkpoint
-2. when resuming from a [savepoint]({{< ref "docs/ops/state/savepoints" >}}). 
-
-If it is the first time the task is executed, the initial task state is empty. 
-
-After recovering any initial state, the task goes into its `invoke()` method. There, it first initializes the operators 
-involved in the local computation by calling the `setup()` method of each one of them and then performs its task-specific 
-initialization by calling the local `init()` method. By task-specific, we mean that depending on the type of the task 
-(`SourceTask`, `OneInputStreamTask` or `TwoInputStreamTask`, etc), this step may differ, but in any case, here is where 
-the necessary task-wide resources are acquired. As an example, the `OneInputStreamTask`, which represents a task that 
-expects to have a single input stream, initializes the connection(s) to the location(s) of the different partitions of 
-the input stream that are relevant to the local task.
-
-Having acquired the necessary resources, it is time for the different operators and user-defined functions to acquire 
-their individual state from the task-wide state retrieved above. This is done in the `initializeState()` method, which 
-calls the `initializeState()` of each individual operator. This method should be overridden by every stateful operator 
-and should contain the state initialization logic, both for the first time a job is executed, and also for the case when 
-the task recovers from a failure or when using a savepoint.
-
-Now that all operators in the task have been initialized, the `open()` method of each individual operator is called by 
-the `openAllOperators()` method of the `StreamTask`. This method performs all the operational initialization, 
-such as registering any retrieved timers with the timer service. A single task may be executing multiple operators with one 
-consuming the output of its predecessor. In this case, the `open()` method is called from the last operator, *i.e.* the 
-one whose output is also the output of the task itself, to the first. This is done so that when the first operator starts 
-processing the task's input, all downstream operators are ready to receive its output.
+当所有初始化都完成之后,算子开始处理流入的数据。流入的数据可以分为三种类型:用户数据、watermark 和 checkpoint barriers。每种类型的数据都有单独的方法来处理。用户数据通过 `processElement()` 方法来处理,watermark 通过 `processWatermark()` 来处理,checkpoint barriers 会调用(异步)`snapshotState()` 方法触发 checkpoint。对于每个流入的数据,根据其类型调用上述相应的方法。注意,`processElement()` 方法也是用户自定义函数逻辑执行的地方,比如用户自定义 `MapFunction` 里的  `map()` 方法。
+
+最后,在算子正常无故障的情况下(比如,如果流式数据是有限的,并且最后一个数据已经到达),会调用 `finish()` 方法结束算子并进行必要的清理工作(比如刷新所有缓冲数据,或发送处理结束的标记数据)。在这之后会调用 `close()` 方法来释放算子持有的资源(比如算子数据持有的本地内存)。
+
+在作业失败或手动取消的情况下,会略过从算子异常位置到 `close()` 中间的所有步骤,直接跳到 `close()` 方法结束算子。
+
+**Checkpoints:** 算子的 `snapshotState()` 方法是在收到 checkpoint barrier 后异步调用的。Checkpoint 在处理阶段执行,即算子打开之后,结束之前的这个阶段。这个方法的职责是存储算子的当前状态到一个特定的[状态后端]({{< ref "docs/ops/state/state_backends" >}}),当作业失败后恢复执行时会从这个后端恢复状态数据。下面我们简要描述了 Flink 的 checkpoint 机制,如果想了解更多 Flink checkpoint 相关的原理,可以读一读 [数据流容错]({{< ref "docs/learn-flink/fault_tolerance" >}})。
+
+<a name="task-lifecycle-1"> </a>
+
+## Task 生命周期
+
+在上文对算子主要阶段的简要介绍之后,本节将详细介绍 task 在集群执行期间是如何调用相关方法的。这里所说的阶段主要包含在 `StreamTask` 类的 `invoke()` 方法里。本文档的剩余部分会分成两个子章节,其中一节描述了 task 在常规没有失败情况下执行的阶段(请参考 [常规执行](#normal-execution)),另外一节描述了 task 取消之后执行的阶段(请参考 [中断执行](#interrupted-execution)),不管是手动取消还是其他原因(比如执行期间遇到异常)导致的取消。
+
+<a name="normal-execution"> </a>
+
+### 常规执行
+
+Task 在没有中断的情况下执行直到最终的步骤如下所示:
+
+	    TASK::setInitialState
+	    TASK::invoke
+		    create basic utils (config, etc) and load the chain of operators
+		    setup-operators
+		    task-specific-init
+		    initialize-operator-states
+	   	    open-operators
+		    run
+		    finish-operators
+		    close-operators
+		    task-specific-cleanup
+		    common-cleanup
+
+如上所示,在恢复 task 配置和初始化一些重要的运行时参数之后,task 的下一步是读取 task 级别的初始状态数据。这一步在 `setInitialState()` 方法里完成,在下面两个场景特别重要:
+
+1. 当 Task 从失败中恢复,从最后一次成功的 checkpoint 重启的时候
+2. 当 Task 从 [savepoint]({{< ref "docs/ops/state/savepoints" >}}) 里恢复的时候。
+
+如果 task 是第一次执行的话,它的初始状态为空。
+
+在恢复初始状态之后,task 进入到 `invoke()` 方法。在这里,首先调用 `setup()` 方法来初始化本地计算涉及到的每个算子,然后调用本地的 `init()` 方法来做特定 task 的初始化。这里所说的特定 task,取决于 task 的类型 (`SourceTask`,`OneInputStreamTask` 或 `TwoInputStreamTask` 等等)。这一步可能会有所不同,但却是申请 task 范围所需资源的地方。例如,`OneInputStreamTask` ,只有一个上游的 task,会初始化和上游的连接。
+
+在申请到必要的资源之后,不同算子和用户定义函数开始从上面读到的 task 范围状态数据里获取他们各自的状态值。这块工作是在各个算子调用 `initializeState()` 时完成。每个有状态的算子都应该重写该方法,包含状态的初始化逻辑,既适用于作业第一次执行的场景,又适用于 task 从 checkpoint 或 savepoint 中恢复的场景。
+
+现在 task 里的所有算子都已经被初始化了,每个算子里的 `open()`方法也通过 `StreamTask` 的 `openAllOperators()` 方法调用了。这个方法执行所有操作的初始化,比如在定时器服务里注册获取到的定时器。一个 task 可能会执行多个算子,即一个算子消费它之前算子的输出数据流。在这种情况下,`open()` 方法从最后一个算子调用到第一个算子,即最后一个算子的输出刚好也是整个 task 的输出。这样做是为了当第一个算子开始处理 task 的输入数据流时,所有下游算子已经准备接收它的输出数据了。
 
 {{< hint info >}}
-Consecutive operators in a task are opened from the last to the first.
+
+task 里多个连续算子的开启时是从后往前依次执行。
+
 {{< /hint >}}
 
-Now the task can resume execution and operators can start processing fresh input data. This is the place where the 
-task-specific `run()`  method is called. This method will run until either there is no more input data (finite stream), 
-or the task is cancelled (manually or not). Here is where the operator specific `processElement()` and `processWatermark()` 
-methods are called.
+现在 task 可以恢复执行,算子可以开始处理新输入的数据。在这里,特定 task 的 `run()`  方法会被调用。这个方法会一直运行直到没有更多输入数据进来(有限的数据流)或者 task 被取消了(人为的或其他的原因)。这里是特定算法的 `processElement()` 方法和 `processWatermark()` 方法执行的地方。

Review comment:
       ```suggestion
   现在 task 可以恢复执行,算子可以开始处理新输入的数据。在这里,特定 task 的 `run()` 方法会被调用。这个方法会一直运行直到没有更多输入数据进来(有限的数据流)或者 task 被取消了(人为的或其他的原因)。这里也是算子定义的 `processElement()` 方法和 `processWatermark()` 方法执行的地方。
   ```
   
   Only a minor suggestion. Maybe we could translate it in a better way.

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,119 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 *5* 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
+
+## 算子生命周期简介
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),因此我们在每个算子下也展示(以缩进的方式)了 UDF 生命周期中调用的各个方法。`AbstractUdfStreamOperator` 是所有执行 UDF 的算子的基类,如果算子继承了 `AbstractUdfStreamOperator`,那么这些方法都是可用的。
 
-## Operator Lifecycle in a nutshell
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
+ 
 
-        // initialization phase
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        // 处理阶段(对每个 element 或 watermark 调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(对每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,在算子初始化时调用 `setup()` 来初始化算子的特定设置,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户自定义函数。
 
 {{< hint info >}}
-The `initializeState()` contains both the logic for initializing the 
-state of the operator during its initial execution (*e.g.* register any keyed state), and also the logic to retrieve its
-state from a checkpoint after a failure. More about this on the rest of this page.
+`initializeState()` 既包含在初始化过程中算子状态的初始化逻辑(比如注册 keyed 状态),又包含异常后从 checkpoint 中恢复原有状态的逻辑。在接下来的篇幅会进行更详细的介绍。
 {{< /hint >}}
 
-Now that everything is set, the operator is ready to process incoming data. Incoming elements can be one of the following: 
-input elements, watermark, and checkpoint barriers. Each one of them has a special element for handling it. Elements are 
-processed by the `processElement()` method, watermarks by the `processWatermark()`, and checkpoint barriers trigger a 
-checkpoint which invokes (asynchronously) the `snapshotState()` method, which we describe below. For each incoming element,
-depending on its type one of the aforementioned methods is called. Note that the `processElement()` is also the place 
-where the UDF's logic is invoked, *e.g.* the `map()` method of your `MapFunction`.
-
-Finally, in the case of a normal, fault-free termination of the operator (*e.g.* if the stream is
-finite and its end is reached), the `finish()` method is called to perform any final bookkeeping
-action required by the operator's logic (*e.g.* flush any buffered data, or emit data to mark end of
-procesing), and the `close()` is called after that to free any resources held by the operator
-(*e.g.* open network connections, io streams, or native memory held by the operator's data).
-
-In the case of a termination due to a failure or due to manual cancellation, the execution jumps directly to the `close()`
-and skips any intermediate phases between the phase the operator was in when the failure happened and the `close()`.
-
-**Checkpoints:** The `snapshotState()` method of the operator is called asynchronously to the rest of the methods described 
-above whenever a checkpoint barrier is received. Checkpoints are performed during the processing phase, *i.e.* after the 
-operator is opened and before it is closed. The responsibility of this method is to store the current state of the operator 
-to the specified [state backend]({{< ref "docs/ops/state/state_backends" >}}) from where it will be retrieved when 
-the job resumes execution after a failure. Below we include a brief description of Flink's checkpointing mechanism, 
-and for a more detailed discussion on the principles around checkpointing in Flink please read the corresponding documentation: 
-[Data Streaming Fault Tolerance]({{< ref "docs/learn-flink/fault_tolerance" >}}).
-
-## Task Lifecycle
-
-Following that brief introduction on the operator's main phases, this section describes in more detail how a task calls 
-the respective methods during its execution on a cluster. The sequence of the phases described here is mainly included 
-in the `invoke()` method of the `StreamTask` class. The remainder of this document is split into two subsections, one 
-describing the phases during a regular, fault-free execution of a task (see [Normal Execution](#normal-execution)), and 
-(a shorter) one describing the different sequence followed in case the task is cancelled (see [Interrupted Execution](#interrupted-execution)), 
-either manually, or due some other reason, *e.g.* an exception thrown during execution.
-
-### Normal Execution
-
-The steps a task goes through when executed until completion without being interrupted are illustrated below:
-
-        TASK::setInitialState
-        TASK::invoke
-            create basic utils (config, etc) and load the chain of operators
-            setup-operators
-            task-specific-init
-            initialize-operator-states
-            open-operators
-            run
-            finish-operators
-            close-operators
-            task-specific-cleanup
-            common-cleanup
-
-As shown above, after recovering the task configuration and initializing some important runtime parameters, the very 
-first step for the task is to retrieve its initial, task-wide state. This is done in the `setInitialState()`, and it is 
-particularly important in two cases:
-
-1. when the task is recovering from a failure and restarts from the last successful checkpoint
-2. when resuming from a [savepoint]({{< ref "docs/ops/state/savepoints" >}}). 
-
-If it is the first time the task is executed, the initial task state is empty. 
-
-After recovering any initial state, the task goes into its `invoke()` method. There, it first initializes the operators 
-involved in the local computation by calling the `setup()` method of each one of them and then performs its task-specific 
-initialization by calling the local `init()` method. By task-specific, we mean that depending on the type of the task 
-(`SourceTask`, `OneInputStreamTask` or `TwoInputStreamTask`, etc), this step may differ, but in any case, here is where 
-the necessary task-wide resources are acquired. As an example, the `OneInputStreamTask`, which represents a task that 
-expects to have a single input stream, initializes the connection(s) to the location(s) of the different partitions of 
-the input stream that are relevant to the local task.
-
-Having acquired the necessary resources, it is time for the different operators and user-defined functions to acquire 
-their individual state from the task-wide state retrieved above. This is done in the `initializeState()` method, which 
-calls the `initializeState()` of each individual operator. This method should be overridden by every stateful operator 
-and should contain the state initialization logic, both for the first time a job is executed, and also for the case when 
-the task recovers from a failure or when using a savepoint.
-
-Now that all operators in the task have been initialized, the `open()` method of each individual operator is called by 
-the `openAllOperators()` method of the `StreamTask`. This method performs all the operational initialization, 
-such as registering any retrieved timers with the timer service. A single task may be executing multiple operators with one 
-consuming the output of its predecessor. In this case, the `open()` method is called from the last operator, *i.e.* the 
-one whose output is also the output of the task itself, to the first. This is done so that when the first operator starts 
-processing the task's input, all downstream operators are ready to receive its output.
+当所有初始化都完成之后,算子开始处理流入的数据。流入的数据可以分为三种类型:用户数据、watermark 和 checkpoint barriers。每种类型的数据都有单独的方法来处理。用户数据通过 `processElement()` 方法来处理,watermark 通过 `processWatermark()` 来处理,checkpoint barriers 会调用(异步)`snapshotState()` 方法触发 checkpoint。对于每个流入的数据,根据其类型调用上述相应的方法。注意,`processElement()` 方法也是用户自定义函数逻辑执行的地方,比如用户自定义 `MapFunction` 里的  `map()` 方法。
+
+最后,在算子正常无故障的情况下(比如,如果流式数据是有限的,并且最后一个数据已经到达),会调用 `finish()` 方法结束算子并进行必要的清理工作(比如刷新所有缓冲数据,或发送处理结束的标记数据)。在这之后会调用 `close()` 方法来释放算子持有的资源(比如算子数据持有的本地内存)。
+
+在作业失败或手动取消的情况下,会略过从算子异常位置到 `close()` 中间的所有步骤,直接跳到 `close()` 方法结束算子。
+
+**Checkpoints:** 算子的 `snapshotState()` 方法是在收到 checkpoint barrier 后异步调用的。Checkpoint 在处理阶段执行,即算子打开之后,结束之前的这个阶段。这个方法的职责是存储算子的当前状态到一个特定的[状态后端]({{< ref "docs/ops/state/state_backends" >}}),当作业失败后恢复执行时会从这个后端恢复状态数据。下面我们简要描述了 Flink 的 checkpoint 机制,如果想了解更多 Flink checkpoint 相关的原理,可以读一读 [数据流容错]({{< ref "docs/learn-flink/fault_tolerance" >}})。
+
+<a name="task-lifecycle-1"> </a>
+
+## Task 生命周期
+
+在上文对算子主要阶段的简要介绍之后,本节将详细介绍 task 在集群执行期间是如何调用相关方法的。这里所说的阶段主要包含在 `StreamTask` 类的 `invoke()` 方法里。本文档的剩余部分会分成两个子章节,其中一节描述了 task 在常规没有失败情况下执行的阶段(请参考 [常规执行](#normal-execution)),另外一节描述了 task 取消之后执行的阶段(请参考 [中断执行](#interrupted-execution)),不管是手动取消还是其他原因(比如执行期间遇到异常)导致的取消。
+
+<a name="normal-execution"> </a>
+
+### 常规执行
+
+Task 在没有中断的情况下执行直到最终的步骤如下所示:
+
+	    TASK::setInitialState
+	    TASK::invoke
+		    create basic utils (config, etc) and load the chain of operators
+		    setup-operators
+		    task-specific-init
+		    initialize-operator-states
+	   	    open-operators
+		    run
+		    finish-operators
+		    close-operators
+		    task-specific-cleanup
+		    common-cleanup
+
+如上所示,在恢复 task 配置和初始化一些重要的运行时参数之后,task 的下一步是读取 task 级别的初始状态数据。这一步在 `setInitialState()` 方法里完成,在下面两个场景特别重要:
+
+1. 当 Task 从失败中恢复,从最后一次成功的 checkpoint 重启的时候
+2. 当 Task 从 [savepoint]({{< ref "docs/ops/state/savepoints" >}}) 里恢复的时候。
+
+如果 task 是第一次执行的话,它的初始状态为空。
+
+在恢复初始状态之后,task 进入到 `invoke()` 方法。在这里,首先调用 `setup()` 方法来初始化本地计算涉及到的每个算子,然后调用本地的 `init()` 方法来做特定 task 的初始化。这里所说的特定 task,取决于 task 的类型 (`SourceTask`,`OneInputStreamTask` 或 `TwoInputStreamTask` 等等)。这一步可能会有所不同,但却是申请 task 范围所需资源的地方。例如,`OneInputStreamTask` ,只有一个上游的 task,会初始化和上游的连接。
+
+在申请到必要的资源之后,不同算子和用户定义函数开始从上面读到的 task 范围状态数据里获取他们各自的状态值。这块工作是在各个算子调用 `initializeState()` 时完成。每个有状态的算子都应该重写该方法,包含状态的初始化逻辑,既适用于作业第一次执行的场景,又适用于 task 从 checkpoint 或 savepoint 中恢复的场景。
+
+现在 task 里的所有算子都已经被初始化了,每个算子里的 `open()`方法也通过 `StreamTask` 的 `openAllOperators()` 方法调用了。这个方法执行所有操作的初始化,比如在定时器服务里注册获取到的定时器。一个 task 可能会执行多个算子,即一个算子消费它之前算子的输出数据流。在这种情况下,`open()` 方法从最后一个算子调用到第一个算子,即最后一个算子的输出刚好也是整个 task 的输出。这样做是为了当第一个算子开始处理 task 的输入数据流时,所有下游算子已经准备接收它的输出数据了。
 
 {{< hint info >}}
-Consecutive operators in a task are opened from the last to the first.
+
+task 里多个连续算子的开启时是从后往前依次执行。
+
 {{< /hint >}}
 
-Now the task can resume execution and operators can start processing fresh input data. This is the place where the 
-task-specific `run()`  method is called. This method will run until either there is no more input data (finite stream), 
-or the task is cancelled (manually or not). Here is where the operator specific `processElement()` and `processWatermark()` 
-methods are called.
+现在 task 可以恢复执行,算子可以开始处理新输入的数据。在这里,特定 task 的 `run()`  方法会被调用。这个方法会一直运行直到没有更多输入数据进来(有限的数据流)或者 task 被取消了(人为的或其他的原因)。这里是特定算法的 `processElement()` 方法和 `processWatermark()` 方法执行的地方。
 
-In the case of running till completion, *i.e.* there is no more input data to process, after exiting from the `run()` 
-method, the task enters its shutdown process. Initially, the timer service stops registering any new timers (*e.g.* from 
-fired timers that are being executed), clears all not-yet-started timers, and awaits the completion of currently 
-executing timers. Then the `finishAllOperators()` notifies the operators involved in the computation by
-calling the `finish()` method of each operator. Then, any buffered output data is flushed so that they can be processed
-by the downstream tasks, and finally the task tries to clear all the resources held by the operators by calling the
-`close()` method of each one. When opening the different operators, we mentioned that the order is from the
-last to the first. Closing happens in the opposite manner, from first to last.
+在运行到完成的情况下,即没有更多的输入数据要处理,从run()方法退出后,task 进入关闭阶段。首先定时器服务停止注册任何新的定时器(比如从正在执行的定时器里注册),清理掉所有还未启动的定时器,并等待当前执行中的定时器运行结束。然后 `finishAllOperators()` 方法通过调用每个算子的 `finish()` 方法来通知所有参与计算的算子。然后所有缓存的输出数据会刷出去以便下游 task 处理,最终 task 通过调用每个算子的 `close()` 方法来尝试清理掉算子持有的所有资源。之前我们提到不同算子开启时,是从后往前依次调用;关闭时刚好相反,从前往后依次调用。

Review comment:
       ```suggestion
   在运行到完成的情况下,即没有更多的输入数据要处理,从run()方法退出后,task 进入关闭阶段。首先定时器服务停止注册任何新的定时器(比如从正在执行的定时器里注册),清理掉所有还未启动的定时器,并等待当前执行中的定时器运行结束。然后通过调用 `finishAllOperators()` 方法调用每个算子的 `finish()` 方法来通知所有参与计算的算子。然后所有缓存的输出数据会刷出去以便下游 task 处理,最终 task 通过调用每个算子的 `close()` 方法来尝试清理掉算子持有的所有资源。与我们之前提到的开启算子不同是,开启时从后往前依次调用 `open()`;而关闭时刚好相反,从前往后依次调用 `close()`。
   ```

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,119 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 *5* 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
+
+## 算子生命周期简介
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),因此我们在每个算子下也展示(以缩进的方式)了 UDF 生命周期中调用的各个方法。`AbstractUdfStreamOperator` 是所有执行 UDF 的算子的基类,如果算子继承了 `AbstractUdfStreamOperator`,那么这些方法都是可用的。
 
-## Operator Lifecycle in a nutshell
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
+ 
 
-        // initialization phase
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        // 处理阶段(对每个 element 或 watermark 调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(对每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,在算子初始化时调用 `setup()` 来初始化算子的特定设置,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户自定义函数。
 
 {{< hint info >}}
-The `initializeState()` contains both the logic for initializing the 
-state of the operator during its initial execution (*e.g.* register any keyed state), and also the logic to retrieve its
-state from a checkpoint after a failure. More about this on the rest of this page.
+`initializeState()` 既包含在初始化过程中算子状态的初始化逻辑(比如注册 keyed 状态),又包含异常后从 checkpoint 中恢复原有状态的逻辑。在接下来的篇幅会进行更详细的介绍。
 {{< /hint >}}
 
-Now that everything is set, the operator is ready to process incoming data. Incoming elements can be one of the following: 
-input elements, watermark, and checkpoint barriers. Each one of them has a special element for handling it. Elements are 
-processed by the `processElement()` method, watermarks by the `processWatermark()`, and checkpoint barriers trigger a 
-checkpoint which invokes (asynchronously) the `snapshotState()` method, which we describe below. For each incoming element,
-depending on its type one of the aforementioned methods is called. Note that the `processElement()` is also the place 
-where the UDF's logic is invoked, *e.g.* the `map()` method of your `MapFunction`.
-
-Finally, in the case of a normal, fault-free termination of the operator (*e.g.* if the stream is
-finite and its end is reached), the `finish()` method is called to perform any final bookkeeping
-action required by the operator's logic (*e.g.* flush any buffered data, or emit data to mark end of
-procesing), and the `close()` is called after that to free any resources held by the operator
-(*e.g.* open network connections, io streams, or native memory held by the operator's data).
-
-In the case of a termination due to a failure or due to manual cancellation, the execution jumps directly to the `close()`
-and skips any intermediate phases between the phase the operator was in when the failure happened and the `close()`.
-
-**Checkpoints:** The `snapshotState()` method of the operator is called asynchronously to the rest of the methods described 
-above whenever a checkpoint barrier is received. Checkpoints are performed during the processing phase, *i.e.* after the 
-operator is opened and before it is closed. The responsibility of this method is to store the current state of the operator 
-to the specified [state backend]({{< ref "docs/ops/state/state_backends" >}}) from where it will be retrieved when 
-the job resumes execution after a failure. Below we include a brief description of Flink's checkpointing mechanism, 
-and for a more detailed discussion on the principles around checkpointing in Flink please read the corresponding documentation: 
-[Data Streaming Fault Tolerance]({{< ref "docs/learn-flink/fault_tolerance" >}}).
-
-## Task Lifecycle
-
-Following that brief introduction on the operator's main phases, this section describes in more detail how a task calls 
-the respective methods during its execution on a cluster. The sequence of the phases described here is mainly included 
-in the `invoke()` method of the `StreamTask` class. The remainder of this document is split into two subsections, one 
-describing the phases during a regular, fault-free execution of a task (see [Normal Execution](#normal-execution)), and 
-(a shorter) one describing the different sequence followed in case the task is cancelled (see [Interrupted Execution](#interrupted-execution)), 
-either manually, or due some other reason, *e.g.* an exception thrown during execution.
-
-### Normal Execution
-
-The steps a task goes through when executed until completion without being interrupted are illustrated below:
-
-        TASK::setInitialState
-        TASK::invoke
-            create basic utils (config, etc) and load the chain of operators
-            setup-operators
-            task-specific-init
-            initialize-operator-states
-            open-operators
-            run
-            finish-operators
-            close-operators
-            task-specific-cleanup
-            common-cleanup
-
-As shown above, after recovering the task configuration and initializing some important runtime parameters, the very 
-first step for the task is to retrieve its initial, task-wide state. This is done in the `setInitialState()`, and it is 
-particularly important in two cases:
-
-1. when the task is recovering from a failure and restarts from the last successful checkpoint
-2. when resuming from a [savepoint]({{< ref "docs/ops/state/savepoints" >}}). 
-
-If it is the first time the task is executed, the initial task state is empty. 
-
-After recovering any initial state, the task goes into its `invoke()` method. There, it first initializes the operators 
-involved in the local computation by calling the `setup()` method of each one of them and then performs its task-specific 
-initialization by calling the local `init()` method. By task-specific, we mean that depending on the type of the task 
-(`SourceTask`, `OneInputStreamTask` or `TwoInputStreamTask`, etc), this step may differ, but in any case, here is where 
-the necessary task-wide resources are acquired. As an example, the `OneInputStreamTask`, which represents a task that 
-expects to have a single input stream, initializes the connection(s) to the location(s) of the different partitions of 
-the input stream that are relevant to the local task.
-
-Having acquired the necessary resources, it is time for the different operators and user-defined functions to acquire 
-their individual state from the task-wide state retrieved above. This is done in the `initializeState()` method, which 
-calls the `initializeState()` of each individual operator. This method should be overridden by every stateful operator 
-and should contain the state initialization logic, both for the first time a job is executed, and also for the case when 
-the task recovers from a failure or when using a savepoint.
-
-Now that all operators in the task have been initialized, the `open()` method of each individual operator is called by 
-the `openAllOperators()` method of the `StreamTask`. This method performs all the operational initialization, 
-such as registering any retrieved timers with the timer service. A single task may be executing multiple operators with one 
-consuming the output of its predecessor. In this case, the `open()` method is called from the last operator, *i.e.* the 
-one whose output is also the output of the task itself, to the first. This is done so that when the first operator starts 
-processing the task's input, all downstream operators are ready to receive its output.
+当所有初始化都完成之后,算子开始处理流入的数据。流入的数据可以分为三种类型:用户数据、watermark 和 checkpoint barriers。每种类型的数据都有单独的方法来处理。用户数据通过 `processElement()` 方法来处理,watermark 通过 `processWatermark()` 来处理,checkpoint barriers 会调用(异步)`snapshotState()` 方法触发 checkpoint。对于每个流入的数据,根据其类型调用上述相应的方法。注意,`processElement()` 方法也是用户自定义函数逻辑执行的地方,比如用户自定义 `MapFunction` 里的  `map()` 方法。
+
+最后,在算子正常无故障的情况下(比如,如果流式数据是有限的,并且最后一个数据已经到达),会调用 `finish()` 方法结束算子并进行必要的清理工作(比如刷新所有缓冲数据,或发送处理结束的标记数据)。在这之后会调用 `close()` 方法来释放算子持有的资源(比如算子数据持有的本地内存)。
+
+在作业失败或手动取消的情况下,会略过从算子异常位置到 `close()` 中间的所有步骤,直接跳到 `close()` 方法结束算子。
+
+**Checkpoints:** 算子的 `snapshotState()` 方法是在收到 checkpoint barrier 后异步调用的。Checkpoint 在处理阶段执行,即算子打开之后,结束之前的这个阶段。这个方法的职责是存储算子的当前状态到一个特定的[状态后端]({{< ref "docs/ops/state/state_backends" >}}),当作业失败后恢复执行时会从这个后端恢复状态数据。下面我们简要描述了 Flink 的 checkpoint 机制,如果想了解更多 Flink checkpoint 相关的原理,可以读一读 [数据流容错]({{< ref "docs/learn-flink/fault_tolerance" >}})。
+
+<a name="task-lifecycle-1"> </a>
+
+## Task 生命周期
+
+在上文对算子主要阶段的简要介绍之后,本节将详细介绍 task 在集群执行期间是如何调用相关方法的。这里所说的阶段主要包含在 `StreamTask` 类的 `invoke()` 方法里。本文档的剩余部分会分成两个子章节,其中一节描述了 task 在常规没有失败情况下执行的阶段(请参考 [常规执行](#normal-execution)),另外一节描述了 task 取消之后执行的阶段(请参考 [中断执行](#interrupted-execution)),不管是手动取消还是其他原因(比如执行期间遇到异常)导致的取消。
+
+<a name="normal-execution"> </a>
+
+### 常规执行
+
+Task 在没有中断的情况下执行直到最终的步骤如下所示:
+
+	    TASK::setInitialState
+	    TASK::invoke
+		    create basic utils (config, etc) and load the chain of operators
+		    setup-operators
+		    task-specific-init
+		    initialize-operator-states
+	   	    open-operators
+		    run
+		    finish-operators
+		    close-operators
+		    task-specific-cleanup
+		    common-cleanup
+
+如上所示,在恢复 task 配置和初始化一些重要的运行时参数之后,task 的下一步是读取 task 级别的初始状态数据。这一步在 `setInitialState()` 方法里完成,在下面两个场景特别重要:
+
+1. 当 Task 从失败中恢复,从最后一次成功的 checkpoint 重启的时候
+2. 当 Task 从 [savepoint]({{< ref "docs/ops/state/savepoints" >}}) 里恢复的时候。
+
+如果 task 是第一次执行的话,它的初始状态为空。
+
+在恢复初始状态之后,task 进入到 `invoke()` 方法。在这里,首先调用 `setup()` 方法来初始化本地计算涉及到的每个算子,然后调用本地的 `init()` 方法来做特定 task 的初始化。这里所说的特定 task,取决于 task 的类型 (`SourceTask`,`OneInputStreamTask` 或 `TwoInputStreamTask` 等等)。这一步可能会有所不同,但却是申请 task 范围所需资源的地方。例如,`OneInputStreamTask` ,只有一个上游的 task,会初始化和上游的连接。

Review comment:
       ```suggestion
   在恢复初始状态之后,task 进入到 `invoke()` 方法。在这里,首先调用 `setup()` 方法来初始化本地计算涉及到的每个算子,然后调用本地的 `init()` 方法来做特定 task 的初始化。这里所说的特定 task,取决于 task 的类型 (`SourceTask`、`OneInputStreamTask` 或 `TwoInputStreamTask` 等)。这一步可能会有所不同,但无论如何这是获取 task 范围内所需资源的地方。例如,`OneInputStreamTask`,代表期望一个单一输入流的 task,初始化与本地任务相关输入流的不同分区位置的连接。
   ```

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,119 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 *5* 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
+
+## 算子生命周期简介
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),因此我们在每个算子下也展示(以缩进的方式)了 UDF 生命周期中调用的各个方法。`AbstractUdfStreamOperator` 是所有执行 UDF 的算子的基类,如果算子继承了 `AbstractUdfStreamOperator`,那么这些方法都是可用的。
 
-## Operator Lifecycle in a nutshell
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
+ 
 
-        // initialization phase
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        // 处理阶段(对每个 element 或 watermark 调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(对每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,在算子初始化时调用 `setup()` 来初始化算子的特定设置,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户自定义函数。
 
 {{< hint info >}}
-The `initializeState()` contains both the logic for initializing the 
-state of the operator during its initial execution (*e.g.* register any keyed state), and also the logic to retrieve its
-state from a checkpoint after a failure. More about this on the rest of this page.
+`initializeState()` 既包含在初始化过程中算子状态的初始化逻辑(比如注册 keyed 状态),又包含异常后从 checkpoint 中恢复原有状态的逻辑。在接下来的篇幅会进行更详细的介绍。
 {{< /hint >}}
 
-Now that everything is set, the operator is ready to process incoming data. Incoming elements can be one of the following: 
-input elements, watermark, and checkpoint barriers. Each one of them has a special element for handling it. Elements are 
-processed by the `processElement()` method, watermarks by the `processWatermark()`, and checkpoint barriers trigger a 
-checkpoint which invokes (asynchronously) the `snapshotState()` method, which we describe below. For each incoming element,
-depending on its type one of the aforementioned methods is called. Note that the `processElement()` is also the place 
-where the UDF's logic is invoked, *e.g.* the `map()` method of your `MapFunction`.
-
-Finally, in the case of a normal, fault-free termination of the operator (*e.g.* if the stream is
-finite and its end is reached), the `finish()` method is called to perform any final bookkeeping
-action required by the operator's logic (*e.g.* flush any buffered data, or emit data to mark end of
-procesing), and the `close()` is called after that to free any resources held by the operator
-(*e.g.* open network connections, io streams, or native memory held by the operator's data).
-
-In the case of a termination due to a failure or due to manual cancellation, the execution jumps directly to the `close()`
-and skips any intermediate phases between the phase the operator was in when the failure happened and the `close()`.
-
-**Checkpoints:** The `snapshotState()` method of the operator is called asynchronously to the rest of the methods described 
-above whenever a checkpoint barrier is received. Checkpoints are performed during the processing phase, *i.e.* after the 
-operator is opened and before it is closed. The responsibility of this method is to store the current state of the operator 
-to the specified [state backend]({{< ref "docs/ops/state/state_backends" >}}) from where it will be retrieved when 
-the job resumes execution after a failure. Below we include a brief description of Flink's checkpointing mechanism, 
-and for a more detailed discussion on the principles around checkpointing in Flink please read the corresponding documentation: 
-[Data Streaming Fault Tolerance]({{< ref "docs/learn-flink/fault_tolerance" >}}).
-
-## Task Lifecycle
-
-Following that brief introduction on the operator's main phases, this section describes in more detail how a task calls 
-the respective methods during its execution on a cluster. The sequence of the phases described here is mainly included 
-in the `invoke()` method of the `StreamTask` class. The remainder of this document is split into two subsections, one 
-describing the phases during a regular, fault-free execution of a task (see [Normal Execution](#normal-execution)), and 
-(a shorter) one describing the different sequence followed in case the task is cancelled (see [Interrupted Execution](#interrupted-execution)), 
-either manually, or due some other reason, *e.g.* an exception thrown during execution.
-
-### Normal Execution
-
-The steps a task goes through when executed until completion without being interrupted are illustrated below:
-
-        TASK::setInitialState
-        TASK::invoke
-            create basic utils (config, etc) and load the chain of operators
-            setup-operators
-            task-specific-init
-            initialize-operator-states
-            open-operators
-            run
-            finish-operators
-            close-operators
-            task-specific-cleanup
-            common-cleanup
-
-As shown above, after recovering the task configuration and initializing some important runtime parameters, the very 
-first step for the task is to retrieve its initial, task-wide state. This is done in the `setInitialState()`, and it is 
-particularly important in two cases:
-
-1. when the task is recovering from a failure and restarts from the last successful checkpoint
-2. when resuming from a [savepoint]({{< ref "docs/ops/state/savepoints" >}}). 
-
-If it is the first time the task is executed, the initial task state is empty. 
-
-After recovering any initial state, the task goes into its `invoke()` method. There, it first initializes the operators 
-involved in the local computation by calling the `setup()` method of each one of them and then performs its task-specific 
-initialization by calling the local `init()` method. By task-specific, we mean that depending on the type of the task 
-(`SourceTask`, `OneInputStreamTask` or `TwoInputStreamTask`, etc), this step may differ, but in any case, here is where 
-the necessary task-wide resources are acquired. As an example, the `OneInputStreamTask`, which represents a task that 
-expects to have a single input stream, initializes the connection(s) to the location(s) of the different partitions of 
-the input stream that are relevant to the local task.
-
-Having acquired the necessary resources, it is time for the different operators and user-defined functions to acquire 
-their individual state from the task-wide state retrieved above. This is done in the `initializeState()` method, which 
-calls the `initializeState()` of each individual operator. This method should be overridden by every stateful operator 
-and should contain the state initialization logic, both for the first time a job is executed, and also for the case when 
-the task recovers from a failure or when using a savepoint.
-
-Now that all operators in the task have been initialized, the `open()` method of each individual operator is called by 
-the `openAllOperators()` method of the `StreamTask`. This method performs all the operational initialization, 
-such as registering any retrieved timers with the timer service. A single task may be executing multiple operators with one 
-consuming the output of its predecessor. In this case, the `open()` method is called from the last operator, *i.e.* the 
-one whose output is also the output of the task itself, to the first. This is done so that when the first operator starts 
-processing the task's input, all downstream operators are ready to receive its output.
+当所有初始化都完成之后,算子开始处理流入的数据。流入的数据可以分为三种类型:用户数据、watermark 和 checkpoint barriers。每种类型的数据都有单独的方法来处理。用户数据通过 `processElement()` 方法来处理,watermark 通过 `processWatermark()` 来处理,checkpoint barriers 会调用(异步)`snapshotState()` 方法触发 checkpoint。对于每个流入的数据,根据其类型调用上述相应的方法。注意,`processElement()` 方法也是用户自定义函数逻辑执行的地方,比如用户自定义 `MapFunction` 里的  `map()` 方法。
+
+最后,在算子正常无故障的情况下(比如,如果流式数据是有限的,并且最后一个数据已经到达),会调用 `finish()` 方法结束算子并进行必要的清理工作(比如刷新所有缓冲数据,或发送处理结束的标记数据)。在这之后会调用 `close()` 方法来释放算子持有的资源(比如算子数据持有的本地内存)。
+
+在作业失败或手动取消的情况下,会略过从算子异常位置到 `close()` 中间的所有步骤,直接跳到 `close()` 方法结束算子。
+
+**Checkpoints:** 算子的 `snapshotState()` 方法是在收到 checkpoint barrier 后异步调用的。Checkpoint 在处理阶段执行,即算子打开之后,结束之前的这个阶段。这个方法的职责是存储算子的当前状态到一个特定的[状态后端]({{< ref "docs/ops/state/state_backends" >}}),当作业失败后恢复执行时会从这个后端恢复状态数据。下面我们简要描述了 Flink 的 checkpoint 机制,如果想了解更多 Flink checkpoint 相关的原理,可以读一读 [数据流容错]({{< ref "docs/learn-flink/fault_tolerance" >}})。
+
+<a name="task-lifecycle-1"> </a>
+
+## Task 生命周期
+
+在上文对算子主要阶段的简要介绍之后,本节将详细介绍 task 在集群执行期间是如何调用相关方法的。这里所说的阶段主要包含在 `StreamTask` 类的 `invoke()` 方法里。本文档的剩余部分会分成两个子章节,其中一节描述了 task 在常规没有失败情况下执行的阶段(请参考 [常规执行](#normal-execution)),另外一节描述了 task 取消之后执行的阶段(请参考 [中断执行](#interrupted-execution)),不管是手动取消还是其他原因(比如执行期间遇到异常)导致的取消。
+
+<a name="normal-execution"> </a>
+
+### 常规执行
+
+Task 在没有中断的情况下执行直到最终的步骤如下所示:
+
+	    TASK::setInitialState
+	    TASK::invoke
+		    create basic utils (config, etc) and load the chain of operators
+		    setup-operators
+		    task-specific-init
+		    initialize-operator-states
+	   	    open-operators
+		    run
+		    finish-operators
+		    close-operators
+		    task-specific-cleanup
+		    common-cleanup
+
+如上所示,在恢复 task 配置和初始化一些重要的运行时参数之后,task 的下一步是读取 task 级别的初始状态数据。这一步在 `setInitialState()` 方法里完成,在下面两个场景特别重要:
+
+1. 当 Task 从失败中恢复,从最后一次成功的 checkpoint 重启的时候
+2. 当 Task 从 [savepoint]({{< ref "docs/ops/state/savepoints" >}}) 里恢复的时候。
+
+如果 task 是第一次执行的话,它的初始状态为空。
+
+在恢复初始状态之后,task 进入到 `invoke()` 方法。在这里,首先调用 `setup()` 方法来初始化本地计算涉及到的每个算子,然后调用本地的 `init()` 方法来做特定 task 的初始化。这里所说的特定 task,取决于 task 的类型 (`SourceTask`,`OneInputStreamTask` 或 `TwoInputStreamTask` 等等)。这一步可能会有所不同,但却是申请 task 范围所需资源的地方。例如,`OneInputStreamTask` ,只有一个上游的 task,会初始化和上游的连接。
+
+在申请到必要的资源之后,不同算子和用户定义函数开始从上面读到的 task 范围状态数据里获取他们各自的状态值。这块工作是在各个算子调用 `initializeState()` 时完成。每个有状态的算子都应该重写该方法,包含状态的初始化逻辑,既适用于作业第一次执行的场景,又适用于 task 从 checkpoint 或 savepoint 中恢复的场景。
+
+现在 task 里的所有算子都已经被初始化了,每个算子里的 `open()`方法也通过 `StreamTask` 的 `openAllOperators()` 方法调用了。这个方法执行所有操作的初始化,比如在定时器服务里注册获取到的定时器。一个 task 可能会执行多个算子,即一个算子消费它之前算子的输出数据流。在这种情况下,`open()` 方法从最后一个算子调用到第一个算子,即最后一个算子的输出刚好也是整个 task 的输出。这样做是为了当第一个算子开始处理 task 的输入数据流时,所有下游算子已经准备接收它的输出数据了。
 
 {{< hint info >}}
-Consecutive operators in a task are opened from the last to the first.
+
+task 里多个连续算子的开启时是从后往前依次执行。
+
 {{< /hint >}}
 
-Now the task can resume execution and operators can start processing fresh input data. This is the place where the 
-task-specific `run()`  method is called. This method will run until either there is no more input data (finite stream), 
-or the task is cancelled (manually or not). Here is where the operator specific `processElement()` and `processWatermark()` 
-methods are called.
+现在 task 可以恢复执行,算子可以开始处理新输入的数据。在这里,特定 task 的 `run()`  方法会被调用。这个方法会一直运行直到没有更多输入数据进来(有限的数据流)或者 task 被取消了(人为的或其他的原因)。这里是特定算法的 `processElement()` 方法和 `processWatermark()` 方法执行的地方。
 
-In the case of running till completion, *i.e.* there is no more input data to process, after exiting from the `run()` 
-method, the task enters its shutdown process. Initially, the timer service stops registering any new timers (*e.g.* from 
-fired timers that are being executed), clears all not-yet-started timers, and awaits the completion of currently 
-executing timers. Then the `finishAllOperators()` notifies the operators involved in the computation by
-calling the `finish()` method of each operator. Then, any buffered output data is flushed so that they can be processed
-by the downstream tasks, and finally the task tries to clear all the resources held by the operators by calling the
-`close()` method of each one. When opening the different operators, we mentioned that the order is from the
-last to the first. Closing happens in the opposite manner, from first to last.
+在运行到完成的情况下,即没有更多的输入数据要处理,从run()方法退出后,task 进入关闭阶段。首先定时器服务停止注册任何新的定时器(比如从正在执行的定时器里注册),清理掉所有还未启动的定时器,并等待当前执行中的定时器运行结束。然后 `finishAllOperators()` 方法通过调用每个算子的 `finish()` 方法来通知所有参与计算的算子。然后所有缓存的输出数据会刷出去以便下游 task 处理,最终 task 通过调用每个算子的 `close()` 方法来尝试清理掉算子持有的所有资源。之前我们提到不同算子开启时,是从后往前依次调用;关闭时刚好相反,从前往后依次调用。
 
 {{< hint info >}}
+
+task 里的多个连续算子的关闭是从前往后依次执行。
+
 Consecutive operators in a task are closed from the first to the last.
 {{< /hint >}}
 
-Finally, when all operators have been closed and all their resources freed, the task shuts down its timer service, 
-performs its task-specific cleanup, *e.g.* cleans all its internal buffers, and then performs its generic task clean up 
-which consists of closing all its output channels and cleaning any output buffers.
-
-**Checkpoints:** Previously we saw that during `initializeState()`, and in case of recovering from a failure, the task 
-and all its operators and functions retrieve the state that was persisted to stable storage during the last successful 
-checkpoint before the failure. Checkpoints in Flink are performed periodically based on a user-specified interval, and 
-are performed by a different thread than that of the main task thread. That's why they are not included in the main 
-phases of the task lifecycle. In a nutshell, special elements called `CheckpointBarriers` are injected periodically by 
-the source tasks of a job in the stream of input data, and travel with the actual data from source to sink. A source 
-task injects these barriers after it is in running mode, and assuming that the `CheckpointCoordinator` is also running. 
-Whenever a task receives such a barrier, it schedules a task to be performed by the checkpoint thread, which calls the 
-`snapshotState()` of the operators in the task. Input data can still be received by the task while the checkpoint is 
-being performed, but the data is buffered and only processed and emitted downstream after the checkpoint is successfully 
-completed.
-
-### Interrupted Execution
-
-In the previous sections we described the lifecycle of a task that runs till completion. In case the task is cancelled 
-at any point, then the normal execution is interrupted and the only operations performed from that point on are the timer 
-service shutdown, the task-specific cleanup, the closing of the operators, and the general task cleanup, as described
-above.
+最后,当所有算子都已经关闭,所有资源都已被释放时,task 关掉它的定时器服务,进行特定 task 的清理操作,例如清理掉所有内部缓存,然后进行常规的 task 清理操作,包括关闭所有的输出管道,清理所有输出缓存等。
+
+**Checkpoints:** 之前我们看到在执行 `initializeState()` 方法期间,在从异常失败中恢复的情况下,task 和它内部的所有算子函数都从最后一次成功的 checkpoint 数据里获取对应的状态信息。Flink 里的 checkpoint 是根据用户自定义的时间间隔周期执行的,并且在一个与主 task 线程不同的单独线程里执行。这也是我们没有把 checkpoint 过程涵盖在 task 生命周期的主要阶段里的原因。简而言之,Flink 作业的输入数据 source task 会定时插入一种叫 `checkpoint barrier` 的特殊数据,并跟正常数据一起从 source 流入到 sink。source task 在处于运行模式后发送这些  barrier  ,同时会假设 `CheckpointCoordinator` 也在运行。当 task 接收到这样的 barrier 之后,会通过 task 算子里的 `snapshotState()` 方法调度 checkpoint 线程执行具体任务。在 checkpoint 处理期间,task 依然可以接收输入数据,但是数据会
 被缓存起来,当 checkpoint 执行成功之后才会被处理和发送到下游算子。 

Review comment:
       ```suggestion
   **Checkpoints:** 之前我们看到在执行 `initializeState()` 方法期间,在从异常失败中恢复的情况下,task 和它内部的所有算子函数都从最后一次成功的 checkpoint 数据里获取对应的状态信息。Flink 里的 checkpoint 是根据用户自定义的时间间隔周期执行的,并且在一个与主 task 线程不同的单独线程里执行。这也是我们没有把 checkpoint 过程涵盖在 task 生命周期的主要阶段里的原因。简而言之,Flink 作业的输入数据 source task 会定时插入一种叫 `checkpoint barrier` 的特殊数据,并跟正常数据一起从 source 流入到 sink。source task 在处于运行模式后发送这些  barrier,同时会假设 `CheckpointCoordinator` 也在运行。当 task 接收到这样的 barrier 之后,会通过 task 算子里的 `snapshotState()` 方法调度 checkpoint 线程执行具体任务。在 checkpoint 处理期间,task 依然可以接收输入数据,但是数据会
 被缓存起来,当 checkpoint 执行成功之后才会被处理和发送到下游算子。 
   ```

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,119 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 *5* 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
+
+## 算子生命周期简介
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),因此我们在每个算子下也展示(以缩进的方式)了 UDF 生命周期中调用的各个方法。`AbstractUdfStreamOperator` 是所有执行 UDF 的算子的基类,如果算子继承了 `AbstractUdfStreamOperator`,那么这些方法都是可用的。
 
-## Operator Lifecycle in a nutshell
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
+ 
 
-        // initialization phase
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        // 处理阶段(对每个 element 或 watermark 调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(对每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,在算子初始化时调用 `setup()` 来初始化算子的特定设置,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户自定义函数。
 
 {{< hint info >}}
-The `initializeState()` contains both the logic for initializing the 
-state of the operator during its initial execution (*e.g.* register any keyed state), and also the logic to retrieve its
-state from a checkpoint after a failure. More about this on the rest of this page.
+`initializeState()` 既包含在初始化过程中算子状态的初始化逻辑(比如注册 keyed 状态),又包含异常后从 checkpoint 中恢复原有状态的逻辑。在接下来的篇幅会进行更详细的介绍。
 {{< /hint >}}
 
-Now that everything is set, the operator is ready to process incoming data. Incoming elements can be one of the following: 
-input elements, watermark, and checkpoint barriers. Each one of them has a special element for handling it. Elements are 
-processed by the `processElement()` method, watermarks by the `processWatermark()`, and checkpoint barriers trigger a 
-checkpoint which invokes (asynchronously) the `snapshotState()` method, which we describe below. For each incoming element,
-depending on its type one of the aforementioned methods is called. Note that the `processElement()` is also the place 
-where the UDF's logic is invoked, *e.g.* the `map()` method of your `MapFunction`.
-
-Finally, in the case of a normal, fault-free termination of the operator (*e.g.* if the stream is
-finite and its end is reached), the `finish()` method is called to perform any final bookkeeping
-action required by the operator's logic (*e.g.* flush any buffered data, or emit data to mark end of
-procesing), and the `close()` is called after that to free any resources held by the operator
-(*e.g.* open network connections, io streams, or native memory held by the operator's data).
-
-In the case of a termination due to a failure or due to manual cancellation, the execution jumps directly to the `close()`
-and skips any intermediate phases between the phase the operator was in when the failure happened and the `close()`.
-
-**Checkpoints:** The `snapshotState()` method of the operator is called asynchronously to the rest of the methods described 
-above whenever a checkpoint barrier is received. Checkpoints are performed during the processing phase, *i.e.* after the 
-operator is opened and before it is closed. The responsibility of this method is to store the current state of the operator 
-to the specified [state backend]({{< ref "docs/ops/state/state_backends" >}}) from where it will be retrieved when 
-the job resumes execution after a failure. Below we include a brief description of Flink's checkpointing mechanism, 
-and for a more detailed discussion on the principles around checkpointing in Flink please read the corresponding documentation: 
-[Data Streaming Fault Tolerance]({{< ref "docs/learn-flink/fault_tolerance" >}}).
-
-## Task Lifecycle
-
-Following that brief introduction on the operator's main phases, this section describes in more detail how a task calls 
-the respective methods during its execution on a cluster. The sequence of the phases described here is mainly included 
-in the `invoke()` method of the `StreamTask` class. The remainder of this document is split into two subsections, one 
-describing the phases during a regular, fault-free execution of a task (see [Normal Execution](#normal-execution)), and 
-(a shorter) one describing the different sequence followed in case the task is cancelled (see [Interrupted Execution](#interrupted-execution)), 
-either manually, or due some other reason, *e.g.* an exception thrown during execution.
-
-### Normal Execution
-
-The steps a task goes through when executed until completion without being interrupted are illustrated below:
-
-        TASK::setInitialState
-        TASK::invoke
-            create basic utils (config, etc) and load the chain of operators
-            setup-operators
-            task-specific-init
-            initialize-operator-states
-            open-operators
-            run
-            finish-operators
-            close-operators
-            task-specific-cleanup
-            common-cleanup
-
-As shown above, after recovering the task configuration and initializing some important runtime parameters, the very 
-first step for the task is to retrieve its initial, task-wide state. This is done in the `setInitialState()`, and it is 
-particularly important in two cases:
-
-1. when the task is recovering from a failure and restarts from the last successful checkpoint
-2. when resuming from a [savepoint]({{< ref "docs/ops/state/savepoints" >}}). 
-
-If it is the first time the task is executed, the initial task state is empty. 
-
-After recovering any initial state, the task goes into its `invoke()` method. There, it first initializes the operators 
-involved in the local computation by calling the `setup()` method of each one of them and then performs its task-specific 
-initialization by calling the local `init()` method. By task-specific, we mean that depending on the type of the task 
-(`SourceTask`, `OneInputStreamTask` or `TwoInputStreamTask`, etc), this step may differ, but in any case, here is where 
-the necessary task-wide resources are acquired. As an example, the `OneInputStreamTask`, which represents a task that 
-expects to have a single input stream, initializes the connection(s) to the location(s) of the different partitions of 
-the input stream that are relevant to the local task.
-
-Having acquired the necessary resources, it is time for the different operators and user-defined functions to acquire 
-their individual state from the task-wide state retrieved above. This is done in the `initializeState()` method, which 
-calls the `initializeState()` of each individual operator. This method should be overridden by every stateful operator 
-and should contain the state initialization logic, both for the first time a job is executed, and also for the case when 
-the task recovers from a failure or when using a savepoint.
-
-Now that all operators in the task have been initialized, the `open()` method of each individual operator is called by 
-the `openAllOperators()` method of the `StreamTask`. This method performs all the operational initialization, 
-such as registering any retrieved timers with the timer service. A single task may be executing multiple operators with one 
-consuming the output of its predecessor. In this case, the `open()` method is called from the last operator, *i.e.* the 
-one whose output is also the output of the task itself, to the first. This is done so that when the first operator starts 
-processing the task's input, all downstream operators are ready to receive its output.
+当所有初始化都完成之后,算子开始处理流入的数据。流入的数据可以分为三种类型:用户数据、watermark 和 checkpoint barriers。每种类型的数据都有单独的方法来处理。用户数据通过 `processElement()` 方法来处理,watermark 通过 `processWatermark()` 来处理,checkpoint barriers 会调用(异步)`snapshotState()` 方法触发 checkpoint。对于每个流入的数据,根据其类型调用上述相应的方法。注意,`processElement()` 方法也是用户自定义函数逻辑执行的地方,比如用户自定义 `MapFunction` 里的  `map()` 方法。
+
+最后,在算子正常无故障的情况下(比如,如果流式数据是有限的,并且最后一个数据已经到达),会调用 `finish()` 方法结束算子并进行必要的清理工作(比如刷新所有缓冲数据,或发送处理结束的标记数据)。在这之后会调用 `close()` 方法来释放算子持有的资源(比如算子数据持有的本地内存)。
+
+在作业失败或手动取消的情况下,会略过从算子异常位置到 `close()` 中间的所有步骤,直接跳到 `close()` 方法结束算子。
+
+**Checkpoints:** 算子的 `snapshotState()` 方法是在收到 checkpoint barrier 后异步调用的。Checkpoint 在处理阶段执行,即算子打开之后,结束之前的这个阶段。这个方法的职责是存储算子的当前状态到一个特定的[状态后端]({{< ref "docs/ops/state/state_backends" >}}),当作业失败后恢复执行时会从这个后端恢复状态数据。下面我们简要描述了 Flink 的 checkpoint 机制,如果想了解更多 Flink checkpoint 相关的原理,可以读一读 [数据流容错]({{< ref "docs/learn-flink/fault_tolerance" >}})。
+
+<a name="task-lifecycle-1"> </a>
+
+## Task 生命周期
+
+在上文对算子主要阶段的简要介绍之后,本节将详细介绍 task 在集群执行期间是如何调用相关方法的。这里所说的阶段主要包含在 `StreamTask` 类的 `invoke()` 方法里。本文档的剩余部分会分成两个子章节,其中一节描述了 task 在常规没有失败情况下执行的阶段(请参考 [常规执行](#normal-execution)),另外一节描述了 task 取消之后执行的阶段(请参考 [中断执行](#interrupted-execution)),不管是手动取消还是其他原因(比如执行期间遇到异常)导致的取消。
+
+<a name="normal-execution"> </a>
+
+### 常规执行
+
+Task 在没有中断的情况下执行直到最终的步骤如下所示:
+
+	    TASK::setInitialState
+	    TASK::invoke
+		    create basic utils (config, etc) and load the chain of operators
+		    setup-operators
+		    task-specific-init
+		    initialize-operator-states
+	   	    open-operators
+		    run
+		    finish-operators
+		    close-operators
+		    task-specific-cleanup
+		    common-cleanup
+
+如上所示,在恢复 task 配置和初始化一些重要的运行时参数之后,task 的下一步是读取 task 级别的初始状态数据。这一步在 `setInitialState()` 方法里完成,在下面两个场景特别重要:
+
+1. 当 Task 从失败中恢复,从最后一次成功的 checkpoint 重启的时候
+2. 当 Task 从 [savepoint]({{< ref "docs/ops/state/savepoints" >}}) 里恢复的时候。
+
+如果 task 是第一次执行的话,它的初始状态为空。
+
+在恢复初始状态之后,task 进入到 `invoke()` 方法。在这里,首先调用 `setup()` 方法来初始化本地计算涉及到的每个算子,然后调用本地的 `init()` 方法来做特定 task 的初始化。这里所说的特定 task,取决于 task 的类型 (`SourceTask`,`OneInputStreamTask` 或 `TwoInputStreamTask` 等等)。这一步可能会有所不同,但却是申请 task 范围所需资源的地方。例如,`OneInputStreamTask` ,只有一个上游的 task,会初始化和上游的连接。
+
+在申请到必要的资源之后,不同算子和用户定义函数开始从上面读到的 task 范围状态数据里获取他们各自的状态值。这块工作是在各个算子调用 `initializeState()` 时完成。每个有状态的算子都应该重写该方法,包含状态的初始化逻辑,既适用于作业第一次执行的场景,又适用于 task 从 checkpoint 或 savepoint 中恢复的场景。
+
+现在 task 里的所有算子都已经被初始化了,每个算子里的 `open()`方法也通过 `StreamTask` 的 `openAllOperators()` 方法调用了。这个方法执行所有操作的初始化,比如在定时器服务里注册获取到的定时器。一个 task 可能会执行多个算子,即一个算子消费它之前算子的输出数据流。在这种情况下,`open()` 方法从最后一个算子调用到第一个算子,即最后一个算子的输出刚好也是整个 task 的输出。这样做是为了当第一个算子开始处理 task 的输入数据流时,所有下游算子已经准备接收它的输出数据了。
 
 {{< hint info >}}
-Consecutive operators in a task are opened from the last to the first.
+
+task 里多个连续算子的开启时是从后往前依次执行。

Review comment:
       ```suggestion
   task 里多个连续算子的开启是从后往前依次执行。
   ```




-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-869197551


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit e1b712ae652bd439c03d94b97015a39b7666d3d4 (Sun Jun 27 17:21:23 UTC 2021)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
    * **This pull request references an unassigned [Jira ticket](https://issues.apache.org/jira/browse/FLINK-12438).** According to the [code contribution guide](https://flink.apache.org/contributing/contribute-code.html), tickets need to be assigned before starting with the implementation work.
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] RocMarshal commented on a change in pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
RocMarshal commented on a change in pull request #16304:
URL: https://github.com/apache/flink/pull/16304#discussion_r670344867



##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,123 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 5 的算子,它的每个实例都由一个单独的 task 来执行。

Review comment:
       ```suggestion
   Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 *5* 的算子,它的每个实例都由一个单独的 task 来执行。
   ```

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,123 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 5 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+## 算子生命周期简介
 
-## Operator Lifecycle in a nutshell
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的各个基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),在每个算子的下方也展示(以缩进的方式)了 UDF 生命周期里调用的各个方法。如果算子继承了 `AbstractUdfStreamOperator` 的话,这些方法都是可用的,`AbstractUdfStreamOperator` 是所有继承 UDF 算子的基类。
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
 
-        // initialization phase
+ 
+
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        
+        // 调用处理阶段(通过每条数据或 watermark 来调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(通过每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+                
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,`setup()` 在算子初始化时被调用,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户定义函数。

Review comment:
       ```suggestion
   简而言之,在算子初始化时调用 `setup()` 来初始化算子的特定设置,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户自定义函数。
   ```

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,123 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 5 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+## 算子生命周期简介
 
-## Operator Lifecycle in a nutshell
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的各个基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),在每个算子的下方也展示(以缩进的方式)了 UDF 生命周期里调用的各个方法。如果算子继承了 `AbstractUdfStreamOperator` 的话,这些方法都是可用的,`AbstractUdfStreamOperator` 是所有继承 UDF 算子的基类。
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
 
-        // initialization phase
+ 
+
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        
+        // 调用处理阶段(通过每条数据或 watermark 来调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(通过每个 checkpoint 异步调用)

Review comment:
       ```suggestion
           // checkpointing 阶段(对每个 checkpoint 异步调用)
   ```

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,123 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 5 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+## 算子生命周期简介
 
-## Operator Lifecycle in a nutshell
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的各个基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),在每个算子的下方也展示(以缩进的方式)了 UDF 生命周期里调用的各个方法。如果算子继承了 `AbstractUdfStreamOperator` 的话,这些方法都是可用的,`AbstractUdfStreamOperator` 是所有继承 UDF 算子的基类。
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
 
-        // initialization phase
+ 
+
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        
+        // 调用处理阶段(通过每条数据或 watermark 来调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(通过每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+                

Review comment:
       ```suggestion
   
   ```

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,123 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 5 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+## 算子生命周期简介
 
-## Operator Lifecycle in a nutshell
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的各个基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),在每个算子的下方也展示(以缩进的方式)了 UDF 生命周期里调用的各个方法。如果算子继承了 `AbstractUdfStreamOperator` 的话,这些方法都是可用的,`AbstractUdfStreamOperator` 是所有继承 UDF 算子的基类。
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
 
-        // initialization phase
+ 
+
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        
+        // 调用处理阶段(通过每条数据或 watermark 来调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(通过每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+                
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,`setup()` 在算子初始化时被调用,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户定义函数。
 
 {{< hint info >}}
-The `initializeState()` contains both the logic for initializing the 
-state of the operator during its initial execution (*e.g.* register any keyed state), and also the logic to retrieve its
-state from a checkpoint after a failure. More about this on the rest of this page.
+
+`initializeState()` 既包含状态的初始化逻辑(比如注册 keyed 状态),又包含从 checkpoint 中恢复原有状态的逻辑。在接下来的篇幅会更详细的介绍这些。
 {{< /hint >}}
 
-Now that everything is set, the operator is ready to process incoming data. Incoming elements can be one of the following: 
-input elements, watermark, and checkpoint barriers. Each one of them has a special element for handling it. Elements are 
-processed by the `processElement()` method, watermarks by the `processWatermark()`, and checkpoint barriers trigger a 
-checkpoint which invokes (asynchronously) the `snapshotState()` method, which we describe below. For each incoming element,
-depending on its type one of the aforementioned methods is called. Note that the `processElement()` is also the place 
-where the UDF's logic is invoked, *e.g.* the `map()` method of your `MapFunction`.
-
-Finally, in the case of a normal, fault-free termination of the operator (*e.g.* if the stream is
-finite and its end is reached), the `finish()` method is called to perform any final bookkeeping
-action required by the operator's logic (*e.g.* flush any buffered data, or emit data to mark end of
-procesing), and the `close()` is called after that to free any resources held by the operator
-(*e.g.* open network connections, io streams, or native memory held by the operator's data).
-
-In the case of a termination due to a failure or due to manual cancellation, the execution jumps directly to the `close()`
-and skips any intermediate phases between the phase the operator was in when the failure happened and the `close()`.
-
-**Checkpoints:** The `snapshotState()` method of the operator is called asynchronously to the rest of the methods described 
-above whenever a checkpoint barrier is received. Checkpoints are performed during the processing phase, *i.e.* after the 
-operator is opened and before it is closed. The responsibility of this method is to store the current state of the operator 
-to the specified [state backend]({{< ref "docs/ops/state/state_backends" >}}) from where it will be retrieved when 
-the job resumes execution after a failure. Below we include a brief description of Flink's checkpointing mechanism, 
-and for a more detailed discussion on the principles around checkpointing in Flink please read the corresponding documentation: 
-[Data Streaming Fault Tolerance]({{< ref "docs/learn-flink/fault_tolerance" >}}).
-
-## Task Lifecycle
-
-Following that brief introduction on the operator's main phases, this section describes in more detail how a task calls 
-the respective methods during its execution on a cluster. The sequence of the phases described here is mainly included 
-in the `invoke()` method of the `StreamTask` class. The remainder of this document is split into two subsections, one 
-describing the phases during a regular, fault-free execution of a task (see [Normal Execution](#normal-execution)), and 
-(a shorter) one describing the different sequence followed in case the task is cancelled (see [Interrupted Execution](#interrupted-execution)), 
-either manually, or due some other reason, *e.g.* an exception thrown during execution.
-
-### Normal Execution
-
-The steps a task goes through when executed until completion without being interrupted are illustrated below:
-
-        TASK::setInitialState
-        TASK::invoke
-            create basic utils (config, etc) and load the chain of operators
-            setup-operators
-            task-specific-init
-            initialize-operator-states
-            open-operators
-            run
-            finish-operators
-            close-operators
-            task-specific-cleanup
-            common-cleanup
-
-As shown above, after recovering the task configuration and initializing some important runtime parameters, the very 
-first step for the task is to retrieve its initial, task-wide state. This is done in the `setInitialState()`, and it is 
-particularly important in two cases:
-
-1. when the task is recovering from a failure and restarts from the last successful checkpoint
-2. when resuming from a [savepoint]({{< ref "docs/ops/state/savepoints" >}}). 
-
-If it is the first time the task is executed, the initial task state is empty. 
-
-After recovering any initial state, the task goes into its `invoke()` method. There, it first initializes the operators 
-involved in the local computation by calling the `setup()` method of each one of them and then performs its task-specific 
-initialization by calling the local `init()` method. By task-specific, we mean that depending on the type of the task 
-(`SourceTask`, `OneInputStreamTask` or `TwoInputStreamTask`, etc), this step may differ, but in any case, here is where 
-the necessary task-wide resources are acquired. As an example, the `OneInputStreamTask`, which represents a task that 
-expects to have a single input stream, initializes the connection(s) to the location(s) of the different partitions of 
-the input stream that are relevant to the local task.
-
-Having acquired the necessary resources, it is time for the different operators and user-defined functions to acquire 
-their individual state from the task-wide state retrieved above. This is done in the `initializeState()` method, which 
-calls the `initializeState()` of each individual operator. This method should be overridden by every stateful operator 
-and should contain the state initialization logic, both for the first time a job is executed, and also for the case when 
-the task recovers from a failure or when using a savepoint.
-
-Now that all operators in the task have been initialized, the `open()` method of each individual operator is called by 
-the `openAllOperators()` method of the `StreamTask`. This method performs all the operational initialization, 
-such as registering any retrieved timers with the timer service. A single task may be executing multiple operators with one 
-consuming the output of its predecessor. In this case, the `open()` method is called from the last operator, *i.e.* the 
-one whose output is also the output of the task itself, to the first. This is done so that when the first operator starts 
-processing the task's input, all downstream operators are ready to receive its output.
+当所有初始化都完成之后,算子开始处理流入的数据。流入的数据可以分为三种类型:用户数据、watermark 和 checkpoint barriers。每种类型的数据都有单独的方法来处理。用户数据通过 `processElement()` 方法来处理,watermark 通过 `processWatermark()` 来处理,checkpoint barriers 会触发异步执行的 `snapshotState()` 方法来进行 checkpoint。对于每个流入的数据,根据其类型调用上述方法之一。`processElement()`方法也是用户自定义函数逻辑执行的地方,比如用户自定义 `MapFunction` 里的  `map()` 方法。
+
+最后,在正常无失败的情况下(比如,如果流式数据是有限的,并且最后一个数据已经到达),会调用 `finish()` 方法结束算子并进行必要的清理工作(比如刷新所有缓冲数据,或发送处理结束的标记数据)。在这之后会调用 `close()` 方法来释放算子持有的资源(比如算子数据持有的本地内存)。
+
+在作业失败或手动取消的情况下,会略过中间所有步骤,直接跳到 `close()` 方法结束算子。

Review comment:
       ```suggestion
   在作业失败或手动取消的情况下,会略过从算子异常位置到 `close()` 中间的所有步骤,直接跳到 `close()` 方法结束算子。
   ```

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,123 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 5 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+## 算子生命周期简介
 
-## Operator Lifecycle in a nutshell
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的各个基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),在每个算子的下方也展示(以缩进的方式)了 UDF 生命周期里调用的各个方法。如果算子继承了 `AbstractUdfStreamOperator` 的话,这些方法都是可用的,`AbstractUdfStreamOperator` 是所有继承 UDF 算子的基类。
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
 
-        // initialization phase
+ 
+
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        

Review comment:
       ```suggestion
   
   ```

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,123 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 5 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+## 算子生命周期简介
 
-## Operator Lifecycle in a nutshell
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的各个基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),在每个算子的下方也展示(以缩进的方式)了 UDF 生命周期里调用的各个方法。如果算子继承了 `AbstractUdfStreamOperator` 的话,这些方法都是可用的,`AbstractUdfStreamOperator` 是所有继承 UDF 算子的基类。

Review comment:
       ```suggestion
   因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),因此我们在每个算子下也展示(以缩进的方式)了 UDF 生命周期中调用的各个方法。`AbstractUdfStreamOperator` 是所有执行 UDF 的算子的基类,如果算子继承了 `AbstractUdfStreamOperator`,那么这些方法都是可用的。
   ```

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,123 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+

Review comment:
       Maybe we should not add tag `a` . The new documetation engine has already updated into `hugo` .
   

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,123 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 5 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。

Review comment:
       What about ``` `StreamTask` 是 Flink 流式计算引擎中所有不同子类型 task 的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并阐述每个阶段的主要方法。```
   It's just a minor comments. Maybe we could translate it in a better way.

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,123 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 5 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+## 算子生命周期简介
 
-## Operator Lifecycle in a nutshell
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的各个基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),在每个算子的下方也展示(以缩进的方式)了 UDF 生命周期里调用的各个方法。如果算子继承了 `AbstractUdfStreamOperator` 的话,这些方法都是可用的,`AbstractUdfStreamOperator` 是所有继承 UDF 算子的基类。
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
 
-        // initialization phase
+ 
+
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        
+        // 调用处理阶段(通过每条数据或 watermark 来调用)

Review comment:
       ```suggestion
           // 处理阶段(对每个 element 或 watermark 调用)
   ```
   Please let me know your opinions.

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,123 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 5 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+## 算子生命周期简介
 
-## Operator Lifecycle in a nutshell
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的各个基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),在每个算子的下方也展示(以缩进的方式)了 UDF 生命周期里调用的各个方法。如果算子继承了 `AbstractUdfStreamOperator` 的话,这些方法都是可用的,`AbstractUdfStreamOperator` 是所有继承 UDF 算子的基类。
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
 
-        // initialization phase
+ 
+
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        
+        // 调用处理阶段(通过每条数据或 watermark 来调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(通过每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+                
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,`setup()` 在算子初始化时被调用,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户定义函数。
 
 {{< hint info >}}
-The `initializeState()` contains both the logic for initializing the 
-state of the operator during its initial execution (*e.g.* register any keyed state), and also the logic to retrieve its
-state from a checkpoint after a failure. More about this on the rest of this page.
+
+`initializeState()` 既包含状态的初始化逻辑(比如注册 keyed 状态),又包含从 checkpoint 中恢复原有状态的逻辑。在接下来的篇幅会更详细的介绍这些。
 {{< /hint >}}
 
-Now that everything is set, the operator is ready to process incoming data. Incoming elements can be one of the following: 
-input elements, watermark, and checkpoint barriers. Each one of them has a special element for handling it. Elements are 
-processed by the `processElement()` method, watermarks by the `processWatermark()`, and checkpoint barriers trigger a 
-checkpoint which invokes (asynchronously) the `snapshotState()` method, which we describe below. For each incoming element,
-depending on its type one of the aforementioned methods is called. Note that the `processElement()` is also the place 
-where the UDF's logic is invoked, *e.g.* the `map()` method of your `MapFunction`.
-
-Finally, in the case of a normal, fault-free termination of the operator (*e.g.* if the stream is
-finite and its end is reached), the `finish()` method is called to perform any final bookkeeping
-action required by the operator's logic (*e.g.* flush any buffered data, or emit data to mark end of
-procesing), and the `close()` is called after that to free any resources held by the operator
-(*e.g.* open network connections, io streams, or native memory held by the operator's data).
-
-In the case of a termination due to a failure or due to manual cancellation, the execution jumps directly to the `close()`
-and skips any intermediate phases between the phase the operator was in when the failure happened and the `close()`.
-
-**Checkpoints:** The `snapshotState()` method of the operator is called asynchronously to the rest of the methods described 
-above whenever a checkpoint barrier is received. Checkpoints are performed during the processing phase, *i.e.* after the 
-operator is opened and before it is closed. The responsibility of this method is to store the current state of the operator 
-to the specified [state backend]({{< ref "docs/ops/state/state_backends" >}}) from where it will be retrieved when 
-the job resumes execution after a failure. Below we include a brief description of Flink's checkpointing mechanism, 
-and for a more detailed discussion on the principles around checkpointing in Flink please read the corresponding documentation: 
-[Data Streaming Fault Tolerance]({{< ref "docs/learn-flink/fault_tolerance" >}}).
-
-## Task Lifecycle
-
-Following that brief introduction on the operator's main phases, this section describes in more detail how a task calls 
-the respective methods during its execution on a cluster. The sequence of the phases described here is mainly included 
-in the `invoke()` method of the `StreamTask` class. The remainder of this document is split into two subsections, one 
-describing the phases during a regular, fault-free execution of a task (see [Normal Execution](#normal-execution)), and 
-(a shorter) one describing the different sequence followed in case the task is cancelled (see [Interrupted Execution](#interrupted-execution)), 
-either manually, or due some other reason, *e.g.* an exception thrown during execution.
-
-### Normal Execution
-
-The steps a task goes through when executed until completion without being interrupted are illustrated below:
-
-        TASK::setInitialState
-        TASK::invoke
-            create basic utils (config, etc) and load the chain of operators
-            setup-operators
-            task-specific-init
-            initialize-operator-states
-            open-operators
-            run
-            finish-operators
-            close-operators
-            task-specific-cleanup
-            common-cleanup
-
-As shown above, after recovering the task configuration and initializing some important runtime parameters, the very 
-first step for the task is to retrieve its initial, task-wide state. This is done in the `setInitialState()`, and it is 
-particularly important in two cases:
-
-1. when the task is recovering from a failure and restarts from the last successful checkpoint
-2. when resuming from a [savepoint]({{< ref "docs/ops/state/savepoints" >}}). 
-
-If it is the first time the task is executed, the initial task state is empty. 
-
-After recovering any initial state, the task goes into its `invoke()` method. There, it first initializes the operators 
-involved in the local computation by calling the `setup()` method of each one of them and then performs its task-specific 
-initialization by calling the local `init()` method. By task-specific, we mean that depending on the type of the task 
-(`SourceTask`, `OneInputStreamTask` or `TwoInputStreamTask`, etc), this step may differ, but in any case, here is where 
-the necessary task-wide resources are acquired. As an example, the `OneInputStreamTask`, which represents a task that 
-expects to have a single input stream, initializes the connection(s) to the location(s) of the different partitions of 
-the input stream that are relevant to the local task.
-
-Having acquired the necessary resources, it is time for the different operators and user-defined functions to acquire 
-their individual state from the task-wide state retrieved above. This is done in the `initializeState()` method, which 
-calls the `initializeState()` of each individual operator. This method should be overridden by every stateful operator 
-and should contain the state initialization logic, both for the first time a job is executed, and also for the case when 
-the task recovers from a failure or when using a savepoint.
-
-Now that all operators in the task have been initialized, the `open()` method of each individual operator is called by 
-the `openAllOperators()` method of the `StreamTask`. This method performs all the operational initialization, 
-such as registering any retrieved timers with the timer service. A single task may be executing multiple operators with one 
-consuming the output of its predecessor. In this case, the `open()` method is called from the last operator, *i.e.* the 
-one whose output is also the output of the task itself, to the first. This is done so that when the first operator starts 
-processing the task's input, all downstream operators are ready to receive its output.
+当所有初始化都完成之后,算子开始处理流入的数据。流入的数据可以分为三种类型:用户数据、watermark 和 checkpoint barriers。每种类型的数据都有单独的方法来处理。用户数据通过 `processElement()` 方法来处理,watermark 通过 `processWatermark()` 来处理,checkpoint barriers 会触发异步执行的 `snapshotState()` 方法来进行 checkpoint。对于每个流入的数据,根据其类型调用上述方法之一。`processElement()`方法也是用户自定义函数逻辑执行的地方,比如用户自定义 `MapFunction` 里的  `map()` 方法。
+
+最后,在正常无失败的情况下(比如,如果流式数据是有限的,并且最后一个数据已经到达),会调用 `finish()` 方法结束算子并进行必要的清理工作(比如刷新所有缓冲数据,或发送处理结束的标记数据)。在这之后会调用 `close()` 方法来释放算子持有的资源(比如算子数据持有的本地内存)。

Review comment:
       ```suggestion
   最后,在算子正常无故障的情况下(比如,如果流式数据是有限的,并且最后一个数据已经到达),会调用 `finish()` 方法结束算子并进行必要的清理工作(比如刷新所有缓冲数据,或发送处理结束的标记数据)。在这之后会调用 `close()` 方法来释放算子持有的资源(比如算子数据持有的本地内存)。
   ```

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,123 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 5 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+## 算子生命周期简介
 
-## Operator Lifecycle in a nutshell
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的各个基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),在每个算子的下方也展示(以缩进的方式)了 UDF 生命周期里调用的各个方法。如果算子继承了 `AbstractUdfStreamOperator` 的话,这些方法都是可用的,`AbstractUdfStreamOperator` 是所有继承 UDF 算子的基类。
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
 
-        // initialization phase
+ 
+
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        
+        // 调用处理阶段(通过每条数据或 watermark 来调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(通过每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+                
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,`setup()` 在算子初始化时被调用,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户定义函数。
 
 {{< hint info >}}
-The `initializeState()` contains both the logic for initializing the 
-state of the operator during its initial execution (*e.g.* register any keyed state), and also the logic to retrieve its
-state from a checkpoint after a failure. More about this on the rest of this page.
+

Review comment:
       ```suggestion
   ```

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,123 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 5 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+## 算子生命周期简介
 
-## Operator Lifecycle in a nutshell
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的各个基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),在每个算子的下方也展示(以缩进的方式)了 UDF 生命周期里调用的各个方法。如果算子继承了 `AbstractUdfStreamOperator` 的话,这些方法都是可用的,`AbstractUdfStreamOperator` 是所有继承 UDF 算子的基类。
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
 
-        // initialization phase
+ 
+
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        
+        // 调用处理阶段(通过每条数据或 watermark 来调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(通过每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+                
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,`setup()` 在算子初始化时被调用,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户定义函数。
 
 {{< hint info >}}
-The `initializeState()` contains both the logic for initializing the 
-state of the operator during its initial execution (*e.g.* register any keyed state), and also the logic to retrieve its
-state from a checkpoint after a failure. More about this on the rest of this page.
+
+`initializeState()` 既包含状态的初始化逻辑(比如注册 keyed 状态),又包含从 checkpoint 中恢复原有状态的逻辑。在接下来的篇幅会更详细的介绍这些。

Review comment:
       ```suggestion
   `initializeState()` 既包含在初始化过程中算子状态的初始化逻辑(比如注册 keyed 状态),又包含异常后从 checkpoint 中恢复原有状态的逻辑。在接下来的篇幅会进行更详细的介绍。
   ```

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,123 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 5 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+## 算子生命周期简介
 
-## Operator Lifecycle in a nutshell
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的各个基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),在每个算子的下方也展示(以缩进的方式)了 UDF 生命周期里调用的各个方法。如果算子继承了 `AbstractUdfStreamOperator` 的话,这些方法都是可用的,`AbstractUdfStreamOperator` 是所有继承 UDF 算子的基类。
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
 
-        // initialization phase
+ 
+
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        
+        // 调用处理阶段(通过每条数据或 watermark 来调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(通过每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        

Review comment:
       ```suggestion
   
   ```

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,123 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 5 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+## 算子生命周期简介
 
-## Operator Lifecycle in a nutshell
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的各个基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),在每个算子的下方也展示(以缩进的方式)了 UDF 生命周期里调用的各个方法。如果算子继承了 `AbstractUdfStreamOperator` 的话,这些方法都是可用的,`AbstractUdfStreamOperator` 是所有继承 UDF 算子的基类。
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
 
-        // initialization phase
+ 
+
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        
+        // 调用处理阶段(通过每条数据或 watermark 来调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(通过每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+                
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,`setup()` 在算子初始化时被调用,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户定义函数。
 
 {{< hint info >}}
-The `initializeState()` contains both the logic for initializing the 
-state of the operator during its initial execution (*e.g.* register any keyed state), and also the logic to retrieve its
-state from a checkpoint after a failure. More about this on the rest of this page.
+
+`initializeState()` 既包含状态的初始化逻辑(比如注册 keyed 状态),又包含从 checkpoint 中恢复原有状态的逻辑。在接下来的篇幅会更详细的介绍这些。
 {{< /hint >}}
 
-Now that everything is set, the operator is ready to process incoming data. Incoming elements can be one of the following: 
-input elements, watermark, and checkpoint barriers. Each one of them has a special element for handling it. Elements are 
-processed by the `processElement()` method, watermarks by the `processWatermark()`, and checkpoint barriers trigger a 
-checkpoint which invokes (asynchronously) the `snapshotState()` method, which we describe below. For each incoming element,
-depending on its type one of the aforementioned methods is called. Note that the `processElement()` is also the place 
-where the UDF's logic is invoked, *e.g.* the `map()` method of your `MapFunction`.
-
-Finally, in the case of a normal, fault-free termination of the operator (*e.g.* if the stream is
-finite and its end is reached), the `finish()` method is called to perform any final bookkeeping
-action required by the operator's logic (*e.g.* flush any buffered data, or emit data to mark end of
-procesing), and the `close()` is called after that to free any resources held by the operator
-(*e.g.* open network connections, io streams, or native memory held by the operator's data).
-
-In the case of a termination due to a failure or due to manual cancellation, the execution jumps directly to the `close()`
-and skips any intermediate phases between the phase the operator was in when the failure happened and the `close()`.
-
-**Checkpoints:** The `snapshotState()` method of the operator is called asynchronously to the rest of the methods described 
-above whenever a checkpoint barrier is received. Checkpoints are performed during the processing phase, *i.e.* after the 
-operator is opened and before it is closed. The responsibility of this method is to store the current state of the operator 
-to the specified [state backend]({{< ref "docs/ops/state/state_backends" >}}) from where it will be retrieved when 
-the job resumes execution after a failure. Below we include a brief description of Flink's checkpointing mechanism, 
-and for a more detailed discussion on the principles around checkpointing in Flink please read the corresponding documentation: 
-[Data Streaming Fault Tolerance]({{< ref "docs/learn-flink/fault_tolerance" >}}).
-
-## Task Lifecycle
-
-Following that brief introduction on the operator's main phases, this section describes in more detail how a task calls 
-the respective methods during its execution on a cluster. The sequence of the phases described here is mainly included 
-in the `invoke()` method of the `StreamTask` class. The remainder of this document is split into two subsections, one 
-describing the phases during a regular, fault-free execution of a task (see [Normal Execution](#normal-execution)), and 
-(a shorter) one describing the different sequence followed in case the task is cancelled (see [Interrupted Execution](#interrupted-execution)), 
-either manually, or due some other reason, *e.g.* an exception thrown during execution.
-
-### Normal Execution
-
-The steps a task goes through when executed until completion without being interrupted are illustrated below:
-
-        TASK::setInitialState
-        TASK::invoke
-            create basic utils (config, etc) and load the chain of operators
-            setup-operators
-            task-specific-init
-            initialize-operator-states
-            open-operators
-            run
-            finish-operators
-            close-operators
-            task-specific-cleanup
-            common-cleanup
-
-As shown above, after recovering the task configuration and initializing some important runtime parameters, the very 
-first step for the task is to retrieve its initial, task-wide state. This is done in the `setInitialState()`, and it is 
-particularly important in two cases:
-
-1. when the task is recovering from a failure and restarts from the last successful checkpoint
-2. when resuming from a [savepoint]({{< ref "docs/ops/state/savepoints" >}}). 
-
-If it is the first time the task is executed, the initial task state is empty. 
-
-After recovering any initial state, the task goes into its `invoke()` method. There, it first initializes the operators 
-involved in the local computation by calling the `setup()` method of each one of them and then performs its task-specific 
-initialization by calling the local `init()` method. By task-specific, we mean that depending on the type of the task 
-(`SourceTask`, `OneInputStreamTask` or `TwoInputStreamTask`, etc), this step may differ, but in any case, here is where 
-the necessary task-wide resources are acquired. As an example, the `OneInputStreamTask`, which represents a task that 
-expects to have a single input stream, initializes the connection(s) to the location(s) of the different partitions of 
-the input stream that are relevant to the local task.
-
-Having acquired the necessary resources, it is time for the different operators and user-defined functions to acquire 
-their individual state from the task-wide state retrieved above. This is done in the `initializeState()` method, which 
-calls the `initializeState()` of each individual operator. This method should be overridden by every stateful operator 
-and should contain the state initialization logic, both for the first time a job is executed, and also for the case when 
-the task recovers from a failure or when using a savepoint.
-
-Now that all operators in the task have been initialized, the `open()` method of each individual operator is called by 
-the `openAllOperators()` method of the `StreamTask`. This method performs all the operational initialization, 
-such as registering any retrieved timers with the timer service. A single task may be executing multiple operators with one 
-consuming the output of its predecessor. In this case, the `open()` method is called from the last operator, *i.e.* the 
-one whose output is also the output of the task itself, to the first. This is done so that when the first operator starts 
-processing the task's input, all downstream operators are ready to receive its output.
+当所有初始化都完成之后,算子开始处理流入的数据。流入的数据可以分为三种类型:用户数据、watermark 和 checkpoint barriers。每种类型的数据都有单独的方法来处理。用户数据通过 `processElement()` 方法来处理,watermark 通过 `processWatermark()` 来处理,checkpoint barriers 会触发异步执行的 `snapshotState()` 方法来进行 checkpoint。对于每个流入的数据,根据其类型调用上述方法之一。`processElement()`方法也是用户自定义函数逻辑执行的地方,比如用户自定义 `MapFunction` 里的  `map()` 方法。

Review comment:
       ```suggestion
   当所有初始化都完成之后,算子开始处理流入的数据。流入的数据可以分为三种类型:用户数据、watermark 和 checkpoint barriers。每种类型的数据都有单独的方法来处理。用户数据通过 `processElement()` 方法来处理,watermark 通过 `processWatermark()` 来处理,checkpoint barriers 会调用(异步)`snapshotState()` 方法触发 checkpoint。对于每个流入的数据,根据其类型调用上述相应的方法。注意,`processElement()` 方法也是用户自定义函数逻辑执行的地方,比如用户自定义 `MapFunction` 里的  `map()` 方法。
   ```




-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] hapihu commented on a change in pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
hapihu commented on a change in pull request #16304:
URL: https://github.com/apache/flink/pull/16304#discussion_r670456863



##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,123 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 5 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+## 算子生命周期简介
 
-## Operator Lifecycle in a nutshell
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的各个基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),在每个算子的下方也展示(以缩进的方式)了 UDF 生命周期里调用的各个方法。如果算子继承了 `AbstractUdfStreamOperator` 的话,这些方法都是可用的,`AbstractUdfStreamOperator` 是所有继承 UDF 算子的基类。
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
 
-        // initialization phase
+ 
+
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        

Review comment:
       I think it's more consistent to have an empty line here




-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] hapihu commented on a change in pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
hapihu commented on a change in pull request #16304:
URL: https://github.com/apache/flink/pull/16304#discussion_r670448202



##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,123 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+

Review comment:
       OK, I get it.




-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-869200661


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19593",
       "triggerID" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282",
       "triggerID" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 462cbd1cf74422aa22733f9361554adb7a96b0a2 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282) 
   * 2ba4d3b2f5bfa23ae4980654d725deba3a2a525a UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-869200661


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19593",
       "triggerID" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * e1b712ae652bd439c03d94b97015a39b7666d3d4 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19593) 
   * 462cbd1cf74422aa22733f9361554adb7a96b0a2 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-869200661


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * e1b712ae652bd439c03d94b97015a39b7666d3d4 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-869200661


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19593",
       "triggerID" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282",
       "triggerID" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ec4f33d90c4ab15a1f9c4248d293a0a385738b39",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20509",
       "triggerID" : "ec4f33d90c4ab15a1f9c4248d293a0a385738b39",
       "triggerType" : "PUSH"
     }, {
       "hash" : "1e13b57c3a960554e8434040f2799857c5b99f5e",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "1e13b57c3a960554e8434040f2799857c5b99f5e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "05b3184b25d509f95029492f9c29adf72d00b71c",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "05b3184b25d509f95029492f9c29adf72d00b71c",
       "triggerType" : "PUSH"
     }, {
       "hash" : "cff071ab1e29dd10754fcb210edea5c8aa7fe6f4",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20517",
       "triggerID" : "cff071ab1e29dd10754fcb210edea5c8aa7fe6f4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "67953137deb1743eecbda1da610c9875c29bd69c",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "67953137deb1743eecbda1da610c9875c29bd69c",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 2ba4d3b2f5bfa23ae4980654d725deba3a2a525a UNKNOWN
   * 43f7f0a6f04bf9feb24f181a44b018c39485287d UNKNOWN
   * ec4f33d90c4ab15a1f9c4248d293a0a385738b39 Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20509) 
   * 1e13b57c3a960554e8434040f2799857c5b99f5e UNKNOWN
   * 05b3184b25d509f95029492f9c29adf72d00b71c UNKNOWN
   * cff071ab1e29dd10754fcb210edea5c8aa7fe6f4 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20517) 
   * 67953137deb1743eecbda1da610c9875c29bd69c UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] hapihu commented on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
hapihu commented on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-880864878


   Hello, @RocMarshal, 
   Excuse me for taking up your time.
   I have finished the modification according to your suggestion. Would you like to review it for me again.
   Thank you very much!


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] hapihu edited a comment on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
hapihu edited a comment on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-894688763


   HI @wuchong 
   Excuse me for taking up your time.
   Can you help me to review it again? thanks


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-869200661


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19593",
       "triggerID" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282",
       "triggerID" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ec4f33d90c4ab15a1f9c4248d293a0a385738b39",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20509",
       "triggerID" : "ec4f33d90c4ab15a1f9c4248d293a0a385738b39",
       "triggerType" : "PUSH"
     }, {
       "hash" : "1e13b57c3a960554e8434040f2799857c5b99f5e",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "1e13b57c3a960554e8434040f2799857c5b99f5e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "05b3184b25d509f95029492f9c29adf72d00b71c",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "05b3184b25d509f95029492f9c29adf72d00b71c",
       "triggerType" : "PUSH"
     }, {
       "hash" : "cff071ab1e29dd10754fcb210edea5c8aa7fe6f4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20517",
       "triggerID" : "cff071ab1e29dd10754fcb210edea5c8aa7fe6f4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "67953137deb1743eecbda1da610c9875c29bd69c",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20503",
       "triggerID" : "67953137deb1743eecbda1da610c9875c29bd69c",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 2ba4d3b2f5bfa23ae4980654d725deba3a2a525a UNKNOWN
   * 43f7f0a6f04bf9feb24f181a44b018c39485287d UNKNOWN
   * 1e13b57c3a960554e8434040f2799857c5b99f5e UNKNOWN
   * 05b3184b25d509f95029492f9c29adf72d00b71c UNKNOWN
   * 67953137deb1743eecbda1da610c9875c29bd69c Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20503) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-869200661


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19593",
       "triggerID" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * e1b712ae652bd439c03d94b97015a39b7666d3d4 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19593) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] hapihu commented on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
hapihu commented on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-880711061


   Hello, @RocMarshal, I made some changes in response to your suggestion. plz help me review again~ 
   Thank you very much!


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] hapihu commented on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
hapihu commented on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-894688763


   @wuchong 
   Excuse me for taking up your time.
   Can you help me to review it again? thanks


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-869200661


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19593",
       "triggerID" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282",
       "triggerID" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 462cbd1cf74422aa22733f9361554adb7a96b0a2 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-869200661


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19593",
       "triggerID" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282",
       "triggerID" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ec4f33d90c4ab15a1f9c4248d293a0a385738b39",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "ec4f33d90c4ab15a1f9c4248d293a0a385738b39",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 462cbd1cf74422aa22733f9361554adb7a96b0a2 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282) 
   * 2ba4d3b2f5bfa23ae4980654d725deba3a2a525a UNKNOWN
   * 43f7f0a6f04bf9feb24f181a44b018c39485287d UNKNOWN
   * ec4f33d90c4ab15a1f9c4248d293a0a385738b39 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-869200661


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19593",
       "triggerID" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282",
       "triggerID" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * e1b712ae652bd439c03d94b97015a39b7666d3d4 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19593) 
   * 462cbd1cf74422aa22733f9361554adb7a96b0a2 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-869200661


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19593",
       "triggerID" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282",
       "triggerID" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ec4f33d90c4ab15a1f9c4248d293a0a385738b39",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20509",
       "triggerID" : "ec4f33d90c4ab15a1f9c4248d293a0a385738b39",
       "triggerType" : "PUSH"
     }, {
       "hash" : "1e13b57c3a960554e8434040f2799857c5b99f5e",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "1e13b57c3a960554e8434040f2799857c5b99f5e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "05b3184b25d509f95029492f9c29adf72d00b71c",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "05b3184b25d509f95029492f9c29adf72d00b71c",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 462cbd1cf74422aa22733f9361554adb7a96b0a2 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282) 
   * 2ba4d3b2f5bfa23ae4980654d725deba3a2a525a UNKNOWN
   * 43f7f0a6f04bf9feb24f181a44b018c39485287d UNKNOWN
   * ec4f33d90c4ab15a1f9c4248d293a0a385738b39 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20509) 
   * 1e13b57c3a960554e8434040f2799857c5b99f5e UNKNOWN
   * 05b3184b25d509f95029492f9c29adf72d00b71c UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] hapihu commented on a change in pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
hapihu commented on a change in pull request #16304:
URL: https://github.com/apache/flink/pull/16304#discussion_r670445559



##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,123 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 5 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。

Review comment:
       Well, I think your translation reads more smoothly.
   I made a slight change, and the result looks like this:
   
   > `StreamTask` 是 Flink 流式计算引擎中所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并阐述每个阶段的主要方法。
   
   What do you think of it?




-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-869200661


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19593",
       "triggerID" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282",
       "triggerID" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ec4f33d90c4ab15a1f9c4248d293a0a385738b39",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20509",
       "triggerID" : "ec4f33d90c4ab15a1f9c4248d293a0a385738b39",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 462cbd1cf74422aa22733f9361554adb7a96b0a2 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282) 
   * 2ba4d3b2f5bfa23ae4980654d725deba3a2a525a UNKNOWN
   * 43f7f0a6f04bf9feb24f181a44b018c39485287d UNKNOWN
   * ec4f33d90c4ab15a1f9c4248d293a0a385738b39 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20509) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] RocMarshal commented on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
RocMarshal commented on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-878913228


   Good job. @hapihu . And thanks @wuchong for assigning. I'll review this PR. Wait a moment, please.


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-869200661


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19593",
       "triggerID" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282",
       "triggerID" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ec4f33d90c4ab15a1f9c4248d293a0a385738b39",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20509",
       "triggerID" : "ec4f33d90c4ab15a1f9c4248d293a0a385738b39",
       "triggerType" : "PUSH"
     }, {
       "hash" : "1e13b57c3a960554e8434040f2799857c5b99f5e",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "1e13b57c3a960554e8434040f2799857c5b99f5e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "05b3184b25d509f95029492f9c29adf72d00b71c",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "05b3184b25d509f95029492f9c29adf72d00b71c",
       "triggerType" : "PUSH"
     }, {
       "hash" : "cff071ab1e29dd10754fcb210edea5c8aa7fe6f4",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20517",
       "triggerID" : "cff071ab1e29dd10754fcb210edea5c8aa7fe6f4",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 462cbd1cf74422aa22733f9361554adb7a96b0a2 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282) 
   * 2ba4d3b2f5bfa23ae4980654d725deba3a2a525a UNKNOWN
   * 43f7f0a6f04bf9feb24f181a44b018c39485287d UNKNOWN
   * ec4f33d90c4ab15a1f9c4248d293a0a385738b39 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20509) 
   * 1e13b57c3a960554e8434040f2799857c5b99f5e UNKNOWN
   * 05b3184b25d509f95029492f9c29adf72d00b71c UNKNOWN
   * cff071ab1e29dd10754fcb210edea5c8aa7fe6f4 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20517) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-869200661


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19593",
       "triggerID" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * e1b712ae652bd439c03d94b97015a39b7666d3d4 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19593) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-869200661


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19593",
       "triggerID" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282",
       "triggerID" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ec4f33d90c4ab15a1f9c4248d293a0a385738b39",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20509",
       "triggerID" : "ec4f33d90c4ab15a1f9c4248d293a0a385738b39",
       "triggerType" : "PUSH"
     }, {
       "hash" : "1e13b57c3a960554e8434040f2799857c5b99f5e",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "1e13b57c3a960554e8434040f2799857c5b99f5e",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 462cbd1cf74422aa22733f9361554adb7a96b0a2 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282) 
   * 2ba4d3b2f5bfa23ae4980654d725deba3a2a525a UNKNOWN
   * 43f7f0a6f04bf9feb24f181a44b018c39485287d UNKNOWN
   * ec4f33d90c4ab15a1f9c4248d293a0a385738b39 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20509) 
   * 1e13b57c3a960554e8434040f2799857c5b99f5e UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] wuchong merged pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
wuchong merged pull request #16304:
URL: https://github.com/apache/flink/pull/16304


   


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-869200661


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19593",
       "triggerID" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282",
       "triggerID" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 462cbd1cf74422aa22733f9361554adb7a96b0a2 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282) 
   * 2ba4d3b2f5bfa23ae4980654d725deba3a2a525a UNKNOWN
   * 43f7f0a6f04bf9feb24f181a44b018c39485287d UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-869200661


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19593",
       "triggerID" : "e1b712ae652bd439c03d94b97015a39b7666d3d4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20282",
       "triggerID" : "462cbd1cf74422aa22733f9361554adb7a96b0a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2ba4d3b2f5bfa23ae4980654d725deba3a2a525a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "43f7f0a6f04bf9feb24f181a44b018c39485287d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ec4f33d90c4ab15a1f9c4248d293a0a385738b39",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20509",
       "triggerID" : "ec4f33d90c4ab15a1f9c4248d293a0a385738b39",
       "triggerType" : "PUSH"
     }, {
       "hash" : "1e13b57c3a960554e8434040f2799857c5b99f5e",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "1e13b57c3a960554e8434040f2799857c5b99f5e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "05b3184b25d509f95029492f9c29adf72d00b71c",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "05b3184b25d509f95029492f9c29adf72d00b71c",
       "triggerType" : "PUSH"
     }, {
       "hash" : "cff071ab1e29dd10754fcb210edea5c8aa7fe6f4",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20517",
       "triggerID" : "cff071ab1e29dd10754fcb210edea5c8aa7fe6f4",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 2ba4d3b2f5bfa23ae4980654d725deba3a2a525a UNKNOWN
   * 43f7f0a6f04bf9feb24f181a44b018c39485287d UNKNOWN
   * ec4f33d90c4ab15a1f9c4248d293a0a385738b39 Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20509) 
   * 1e13b57c3a960554e8434040f2799857c5b99f5e UNKNOWN
   * 05b3184b25d509f95029492f9c29adf72d00b71c UNKNOWN
   * cff071ab1e29dd10754fcb210edea5c8aa7fe6f4 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=20517) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] wuchong commented on pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
wuchong commented on pull request #16304:
URL: https://github.com/apache/flink/pull/16304#issuecomment-877946837


   cc @RocMarshal , do you want to help reviewing this page? 


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] hapihu commented on a change in pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
hapihu commented on a change in pull request #16304:
URL: https://github.com/apache/flink/pull/16304#discussion_r670628205



##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,119 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 *5* 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
+
+## 算子生命周期简介
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),因此我们在每个算子下也展示(以缩进的方式)了 UDF 生命周期中调用的各个方法。`AbstractUdfStreamOperator` 是所有执行 UDF 的算子的基类,如果算子继承了 `AbstractUdfStreamOperator`,那么这些方法都是可用的。
 
-## Operator Lifecycle in a nutshell
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
+ 
 
-        // initialization phase
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        // 处理阶段(对每个 element 或 watermark 调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(对每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,在算子初始化时调用 `setup()` 来初始化算子的特定设置,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户自定义函数。
 
 {{< hint info >}}
-The `initializeState()` contains both the logic for initializing the 
-state of the operator during its initial execution (*e.g.* register any keyed state), and also the logic to retrieve its
-state from a checkpoint after a failure. More about this on the rest of this page.
+`initializeState()` 既包含在初始化过程中算子状态的初始化逻辑(比如注册 keyed 状态),又包含异常后从 checkpoint 中恢复原有状态的逻辑。在接下来的篇幅会进行更详细的介绍。
 {{< /hint >}}
 
-Now that everything is set, the operator is ready to process incoming data. Incoming elements can be one of the following: 
-input elements, watermark, and checkpoint barriers. Each one of them has a special element for handling it. Elements are 
-processed by the `processElement()` method, watermarks by the `processWatermark()`, and checkpoint barriers trigger a 
-checkpoint which invokes (asynchronously) the `snapshotState()` method, which we describe below. For each incoming element,
-depending on its type one of the aforementioned methods is called. Note that the `processElement()` is also the place 
-where the UDF's logic is invoked, *e.g.* the `map()` method of your `MapFunction`.
-
-Finally, in the case of a normal, fault-free termination of the operator (*e.g.* if the stream is
-finite and its end is reached), the `finish()` method is called to perform any final bookkeeping
-action required by the operator's logic (*e.g.* flush any buffered data, or emit data to mark end of
-procesing), and the `close()` is called after that to free any resources held by the operator
-(*e.g.* open network connections, io streams, or native memory held by the operator's data).
-
-In the case of a termination due to a failure or due to manual cancellation, the execution jumps directly to the `close()`
-and skips any intermediate phases between the phase the operator was in when the failure happened and the `close()`.
-
-**Checkpoints:** The `snapshotState()` method of the operator is called asynchronously to the rest of the methods described 
-above whenever a checkpoint barrier is received. Checkpoints are performed during the processing phase, *i.e.* after the 
-operator is opened and before it is closed. The responsibility of this method is to store the current state of the operator 
-to the specified [state backend]({{< ref "docs/ops/state/state_backends" >}}) from where it will be retrieved when 
-the job resumes execution after a failure. Below we include a brief description of Flink's checkpointing mechanism, 
-and for a more detailed discussion on the principles around checkpointing in Flink please read the corresponding documentation: 
-[Data Streaming Fault Tolerance]({{< ref "docs/learn-flink/fault_tolerance" >}}).
-
-## Task Lifecycle
-
-Following that brief introduction on the operator's main phases, this section describes in more detail how a task calls 
-the respective methods during its execution on a cluster. The sequence of the phases described here is mainly included 
-in the `invoke()` method of the `StreamTask` class. The remainder of this document is split into two subsections, one 
-describing the phases during a regular, fault-free execution of a task (see [Normal Execution](#normal-execution)), and 
-(a shorter) one describing the different sequence followed in case the task is cancelled (see [Interrupted Execution](#interrupted-execution)), 
-either manually, or due some other reason, *e.g.* an exception thrown during execution.
-
-### Normal Execution
-
-The steps a task goes through when executed until completion without being interrupted are illustrated below:
-
-        TASK::setInitialState
-        TASK::invoke
-            create basic utils (config, etc) and load the chain of operators
-            setup-operators
-            task-specific-init
-            initialize-operator-states
-            open-operators
-            run
-            finish-operators
-            close-operators
-            task-specific-cleanup
-            common-cleanup
-
-As shown above, after recovering the task configuration and initializing some important runtime parameters, the very 
-first step for the task is to retrieve its initial, task-wide state. This is done in the `setInitialState()`, and it is 
-particularly important in two cases:
-
-1. when the task is recovering from a failure and restarts from the last successful checkpoint
-2. when resuming from a [savepoint]({{< ref "docs/ops/state/savepoints" >}}). 
-
-If it is the first time the task is executed, the initial task state is empty. 
-
-After recovering any initial state, the task goes into its `invoke()` method. There, it first initializes the operators 
-involved in the local computation by calling the `setup()` method of each one of them and then performs its task-specific 
-initialization by calling the local `init()` method. By task-specific, we mean that depending on the type of the task 
-(`SourceTask`, `OneInputStreamTask` or `TwoInputStreamTask`, etc), this step may differ, but in any case, here is where 
-the necessary task-wide resources are acquired. As an example, the `OneInputStreamTask`, which represents a task that 
-expects to have a single input stream, initializes the connection(s) to the location(s) of the different partitions of 
-the input stream that are relevant to the local task.
-
-Having acquired the necessary resources, it is time for the different operators and user-defined functions to acquire 
-their individual state from the task-wide state retrieved above. This is done in the `initializeState()` method, which 
-calls the `initializeState()` of each individual operator. This method should be overridden by every stateful operator 
-and should contain the state initialization logic, both for the first time a job is executed, and also for the case when 
-the task recovers from a failure or when using a savepoint.
-
-Now that all operators in the task have been initialized, the `open()` method of each individual operator is called by 
-the `openAllOperators()` method of the `StreamTask`. This method performs all the operational initialization, 
-such as registering any retrieved timers with the timer service. A single task may be executing multiple operators with one 
-consuming the output of its predecessor. In this case, the `open()` method is called from the last operator, *i.e.* the 
-one whose output is also the output of the task itself, to the first. This is done so that when the first operator starts 
-processing the task's input, all downstream operators are ready to receive its output.
+当所有初始化都完成之后,算子开始处理流入的数据。流入的数据可以分为三种类型:用户数据、watermark 和 checkpoint barriers。每种类型的数据都有单独的方法来处理。用户数据通过 `processElement()` 方法来处理,watermark 通过 `processWatermark()` 来处理,checkpoint barriers 会调用(异步)`snapshotState()` 方法触发 checkpoint。对于每个流入的数据,根据其类型调用上述相应的方法。注意,`processElement()` 方法也是用户自定义函数逻辑执行的地方,比如用户自定义 `MapFunction` 里的  `map()` 方法。
+
+最后,在算子正常无故障的情况下(比如,如果流式数据是有限的,并且最后一个数据已经到达),会调用 `finish()` 方法结束算子并进行必要的清理工作(比如刷新所有缓冲数据,或发送处理结束的标记数据)。在这之后会调用 `close()` 方法来释放算子持有的资源(比如算子数据持有的本地内存)。
+
+在作业失败或手动取消的情况下,会略过从算子异常位置到 `close()` 中间的所有步骤,直接跳到 `close()` 方法结束算子。
+
+**Checkpoints:** 算子的 `snapshotState()` 方法是在收到 checkpoint barrier 后异步调用的。Checkpoint 在处理阶段执行,即算子打开之后,结束之前的这个阶段。这个方法的职责是存储算子的当前状态到一个特定的[状态后端]({{< ref "docs/ops/state/state_backends" >}}),当作业失败后恢复执行时会从这个后端恢复状态数据。下面我们简要描述了 Flink 的 checkpoint 机制,如果想了解更多 Flink checkpoint 相关的原理,可以读一读 [数据流容错]({{< ref "docs/learn-flink/fault_tolerance" >}})。
+
+<a name="task-lifecycle-1"> </a>
+
+## Task 生命周期
+
+在上文对算子主要阶段的简要介绍之后,本节将详细介绍 task 在集群执行期间是如何调用相关方法的。这里所说的阶段主要包含在 `StreamTask` 类的 `invoke()` 方法里。本文档的剩余部分会分成两个子章节,其中一节描述了 task 在常规没有失败情况下执行的阶段(请参考 [常规执行](#normal-execution)),另外一节描述了 task 取消之后执行的阶段(请参考 [中断执行](#interrupted-execution)),不管是手动取消还是其他原因(比如执行期间遇到异常)导致的取消。
+
+<a name="normal-execution"> </a>
+
+### 常规执行
+
+Task 在没有中断的情况下执行直到最终的步骤如下所示:
+
+	    TASK::setInitialState
+	    TASK::invoke
+		    create basic utils (config, etc) and load the chain of operators
+		    setup-operators
+		    task-specific-init
+		    initialize-operator-states
+	   	    open-operators
+		    run
+		    finish-operators
+		    close-operators
+		    task-specific-cleanup
+		    common-cleanup
+
+如上所示,在恢复 task 配置和初始化一些重要的运行时参数之后,task 的下一步是读取 task 级别的初始状态数据。这一步在 `setInitialState()` 方法里完成,在下面两个场景特别重要:
+
+1. 当 Task 从失败中恢复,从最后一次成功的 checkpoint 重启的时候
+2. 当 Task 从 [savepoint]({{< ref "docs/ops/state/savepoints" >}}) 里恢复的时候。

Review comment:
       ok, I made a slight change, and the result looks like this:
   
   > 2. 当 Task 从 [savepoint]({{< ref "docs/ops/state/savepoints" >}}) 恢复的时候。
   Change `、` to `.`.
   What do you think of it?

##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,119 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 *5* 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
+
+## 算子生命周期简介
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),因此我们在每个算子下也展示(以缩进的方式)了 UDF 生命周期中调用的各个方法。`AbstractUdfStreamOperator` 是所有执行 UDF 的算子的基类,如果算子继承了 `AbstractUdfStreamOperator`,那么这些方法都是可用的。
 
-## Operator Lifecycle in a nutshell
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
+ 
 
-        // initialization phase
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        // 处理阶段(对每个 element 或 watermark 调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(对每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,在算子初始化时调用 `setup()` 来初始化算子的特定设置,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户自定义函数。
 
 {{< hint info >}}
-The `initializeState()` contains both the logic for initializing the 
-state of the operator during its initial execution (*e.g.* register any keyed state), and also the logic to retrieve its
-state from a checkpoint after a failure. More about this on the rest of this page.
+`initializeState()` 既包含在初始化过程中算子状态的初始化逻辑(比如注册 keyed 状态),又包含异常后从 checkpoint 中恢复原有状态的逻辑。在接下来的篇幅会进行更详细的介绍。
 {{< /hint >}}
 
-Now that everything is set, the operator is ready to process incoming data. Incoming elements can be one of the following: 
-input elements, watermark, and checkpoint barriers. Each one of them has a special element for handling it. Elements are 
-processed by the `processElement()` method, watermarks by the `processWatermark()`, and checkpoint barriers trigger a 
-checkpoint which invokes (asynchronously) the `snapshotState()` method, which we describe below. For each incoming element,
-depending on its type one of the aforementioned methods is called. Note that the `processElement()` is also the place 
-where the UDF's logic is invoked, *e.g.* the `map()` method of your `MapFunction`.
-
-Finally, in the case of a normal, fault-free termination of the operator (*e.g.* if the stream is
-finite and its end is reached), the `finish()` method is called to perform any final bookkeeping
-action required by the operator's logic (*e.g.* flush any buffered data, or emit data to mark end of
-procesing), and the `close()` is called after that to free any resources held by the operator
-(*e.g.* open network connections, io streams, or native memory held by the operator's data).
-
-In the case of a termination due to a failure or due to manual cancellation, the execution jumps directly to the `close()`
-and skips any intermediate phases between the phase the operator was in when the failure happened and the `close()`.
-
-**Checkpoints:** The `snapshotState()` method of the operator is called asynchronously to the rest of the methods described 
-above whenever a checkpoint barrier is received. Checkpoints are performed during the processing phase, *i.e.* after the 
-operator is opened and before it is closed. The responsibility of this method is to store the current state of the operator 
-to the specified [state backend]({{< ref "docs/ops/state/state_backends" >}}) from where it will be retrieved when 
-the job resumes execution after a failure. Below we include a brief description of Flink's checkpointing mechanism, 
-and for a more detailed discussion on the principles around checkpointing in Flink please read the corresponding documentation: 
-[Data Streaming Fault Tolerance]({{< ref "docs/learn-flink/fault_tolerance" >}}).
-
-## Task Lifecycle
-
-Following that brief introduction on the operator's main phases, this section describes in more detail how a task calls 
-the respective methods during its execution on a cluster. The sequence of the phases described here is mainly included 
-in the `invoke()` method of the `StreamTask` class. The remainder of this document is split into two subsections, one 
-describing the phases during a regular, fault-free execution of a task (see [Normal Execution](#normal-execution)), and 
-(a shorter) one describing the different sequence followed in case the task is cancelled (see [Interrupted Execution](#interrupted-execution)), 
-either manually, or due some other reason, *e.g.* an exception thrown during execution.
-
-### Normal Execution
-
-The steps a task goes through when executed until completion without being interrupted are illustrated below:
-
-        TASK::setInitialState
-        TASK::invoke
-            create basic utils (config, etc) and load the chain of operators
-            setup-operators
-            task-specific-init
-            initialize-operator-states
-            open-operators
-            run
-            finish-operators
-            close-operators
-            task-specific-cleanup
-            common-cleanup
-
-As shown above, after recovering the task configuration and initializing some important runtime parameters, the very 
-first step for the task is to retrieve its initial, task-wide state. This is done in the `setInitialState()`, and it is 
-particularly important in two cases:
-
-1. when the task is recovering from a failure and restarts from the last successful checkpoint
-2. when resuming from a [savepoint]({{< ref "docs/ops/state/savepoints" >}}). 
-
-If it is the first time the task is executed, the initial task state is empty. 
-
-After recovering any initial state, the task goes into its `invoke()` method. There, it first initializes the operators 
-involved in the local computation by calling the `setup()` method of each one of them and then performs its task-specific 
-initialization by calling the local `init()` method. By task-specific, we mean that depending on the type of the task 
-(`SourceTask`, `OneInputStreamTask` or `TwoInputStreamTask`, etc), this step may differ, but in any case, here is where 
-the necessary task-wide resources are acquired. As an example, the `OneInputStreamTask`, which represents a task that 
-expects to have a single input stream, initializes the connection(s) to the location(s) of the different partitions of 
-the input stream that are relevant to the local task.
-
-Having acquired the necessary resources, it is time for the different operators and user-defined functions to acquire 
-their individual state from the task-wide state retrieved above. This is done in the `initializeState()` method, which 
-calls the `initializeState()` of each individual operator. This method should be overridden by every stateful operator 
-and should contain the state initialization logic, both for the first time a job is executed, and also for the case when 
-the task recovers from a failure or when using a savepoint.
-
-Now that all operators in the task have been initialized, the `open()` method of each individual operator is called by 
-the `openAllOperators()` method of the `StreamTask`. This method performs all the operational initialization, 
-such as registering any retrieved timers with the timer service. A single task may be executing multiple operators with one 
-consuming the output of its predecessor. In this case, the `open()` method is called from the last operator, *i.e.* the 
-one whose output is also the output of the task itself, to the first. This is done so that when the first operator starts 
-processing the task's input, all downstream operators are ready to receive its output.
+当所有初始化都完成之后,算子开始处理流入的数据。流入的数据可以分为三种类型:用户数据、watermark 和 checkpoint barriers。每种类型的数据都有单独的方法来处理。用户数据通过 `processElement()` 方法来处理,watermark 通过 `processWatermark()` 来处理,checkpoint barriers 会调用(异步)`snapshotState()` 方法触发 checkpoint。对于每个流入的数据,根据其类型调用上述相应的方法。注意,`processElement()` 方法也是用户自定义函数逻辑执行的地方,比如用户自定义 `MapFunction` 里的  `map()` 方法。
+
+最后,在算子正常无故障的情况下(比如,如果流式数据是有限的,并且最后一个数据已经到达),会调用 `finish()` 方法结束算子并进行必要的清理工作(比如刷新所有缓冲数据,或发送处理结束的标记数据)。在这之后会调用 `close()` 方法来释放算子持有的资源(比如算子数据持有的本地内存)。
+
+在作业失败或手动取消的情况下,会略过从算子异常位置到 `close()` 中间的所有步骤,直接跳到 `close()` 方法结束算子。
+
+**Checkpoints:** 算子的 `snapshotState()` 方法是在收到 checkpoint barrier 后异步调用的。Checkpoint 在处理阶段执行,即算子打开之后,结束之前的这个阶段。这个方法的职责是存储算子的当前状态到一个特定的[状态后端]({{< ref "docs/ops/state/state_backends" >}}),当作业失败后恢复执行时会从这个后端恢复状态数据。下面我们简要描述了 Flink 的 checkpoint 机制,如果想了解更多 Flink checkpoint 相关的原理,可以读一读 [数据流容错]({{< ref "docs/learn-flink/fault_tolerance" >}})。
+
+<a name="task-lifecycle-1"> </a>
+
+## Task 生命周期
+
+在上文对算子主要阶段的简要介绍之后,本节将详细介绍 task 在集群执行期间是如何调用相关方法的。这里所说的阶段主要包含在 `StreamTask` 类的 `invoke()` 方法里。本文档的剩余部分会分成两个子章节,其中一节描述了 task 在常规没有失败情况下执行的阶段(请参考 [常规执行](#normal-execution)),另外一节描述了 task 取消之后执行的阶段(请参考 [中断执行](#interrupted-execution)),不管是手动取消还是其他原因(比如执行期间遇到异常)导致的取消。
+
+<a name="normal-execution"> </a>
+
+### 常规执行
+
+Task 在没有中断的情况下执行直到最终的步骤如下所示:
+
+	    TASK::setInitialState
+	    TASK::invoke
+		    create basic utils (config, etc) and load the chain of operators
+		    setup-operators
+		    task-specific-init
+		    initialize-operator-states
+	   	    open-operators
+		    run
+		    finish-operators
+		    close-operators
+		    task-specific-cleanup
+		    common-cleanup
+
+如上所示,在恢复 task 配置和初始化一些重要的运行时参数之后,task 的下一步是读取 task 级别的初始状态数据。这一步在 `setInitialState()` 方法里完成,在下面两个场景特别重要:
+
+1. 当 Task 从失败中恢复,从最后一次成功的 checkpoint 重启的时候
+2. 当 Task 从 [savepoint]({{< ref "docs/ops/state/savepoints" >}}) 里恢复的时候。

Review comment:
       ok, I made a slight change, and the result looks like this:
   
   > 2. 当 Task 从 [savepoint]({{< ref "docs/ops/state/savepoints" >}}) 恢复的时候。
   
   Change `、` to `.`.
   What do you think of it?




-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] hapihu commented on a change in pull request #16304: [FLINK-12438][doc-zh]Translate Task Lifecycle document into Chinese

Posted by GitBox <gi...@apache.org>.
hapihu commented on a change in pull request #16304:
URL: https://github.com/apache/flink/pull/16304#discussion_r670644990



##########
File path: docs/content.zh/docs/internals/task_lifecycle.md
##########
@@ -24,181 +24,119 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+<a name='task-lifecycle'> </a>
+
 # Task 生命周期
 
-A task in Flink is the basic unit of execution. It is the place where each parallel instance of an
-operator is executed. As an example, an operator with a parallelism of *5* will have each of its
-instances executed by a separate task.
+Task 是 Flink 的基本执行单元。算子的每个并行实例都在 task 里执行。例如,一个并行度为 *5* 的算子,它的每个实例都由一个单独的 task 来执行。
+
+在 Flink 流式计算引擎里,`StreamTask` 是所有不同 task 子类的基础。本文会深入讲解  `StreamTask` 生命周期的不同阶段,并描述每个阶段的主要方法。
+
+<a name="operator-lifecycle-in-a-nutshell"> </a>
+
+## 算子生命周期简介
 
-The `StreamTask` is the base for all different task sub-types in Flink's streaming engine. This
-document goes through the different phases in the lifecycle of the `StreamTask` and describes the
-main methods representing each of these phases.
+因为 task 是算子并行实例的执行实体,所以它的生命周期跟算子的生命周期紧密联系在一起。因此,在深入介绍 `StreamTask` 生命周期之前,先简要介绍一下代表算子生命周期的基本方法。这些方法按调用的先后顺序如下所示。考虑到算子可能是用户自定义函数(*UDF*),因此我们在每个算子下也展示(以缩进的方式)了 UDF 生命周期中调用的各个方法。`AbstractUdfStreamOperator` 是所有执行 UDF 的算子的基类,如果算子继承了 `AbstractUdfStreamOperator`,那么这些方法都是可用的。
 
-## Operator Lifecycle in a nutshell
 
-Because the task is the entity that executes a parallel instance of an operator, its lifecycle is tightly integrated 
-with that of an operator. So, we will briefly mention the basic methods representing the lifecycle of an operator before 
-diving into those of the `StreamTask` itself. The list is presented below in the order that each of the methods is called. 
-Given that an operator can have a user-defined function (*UDF*), below each of the operator methods we also present 
-(indented) the methods in the lifecycle of the UDF that it calls. These methods are available if your operator extends 
-the `AbstractUdfStreamOperator`, which is the basic class for all operators that execute UDFs.
+ 
 
-        // initialization phase
+        // 初始化阶段
         OPERATOR::setup
             UDF::setRuntimeContext
         OPERATOR::initializeState
         OPERATOR::open
             UDF::open
-
-        // processing phase (called on every element/watermark)
+        // 处理阶段(对每个 element 或 watermark 调用)
         OPERATOR::processElement
             UDF::run
         OPERATOR::processWatermark
         
-        // checkpointing phase (called asynchronously on every checkpoint)
+        // checkpointing 阶段(对每个 checkpoint 异步调用)
         OPERATOR::snapshotState
-
-        // notify the operator about the end of processing records
+        // 通知 operator 处理记录的过程结束
         OPERATOR::finish
-
-        // termination phase
+        // 结束阶段
         OPERATOR::close
             UDF::close
-    
-In a nutshell, the `setup()` is called to initialize some operator-specific machinery, such as its `RuntimeContext` and 
-its metric collection data-structures. After this, the `initializeState()` gives an operator its initial state, and the 
- `open()` method executes any operator-specific initialization, such as opening the user-defined function in the case of 
-the `AbstractUdfStreamOperator`. 
+
+简而言之,在算子初始化时调用 `setup()` 来初始化算子的特定设置,比如 `RuntimeContext` 和指标收集的数据结构。在这之后,算子通过 `initializeState()` 初始化状态,算子的所有初始化工作在 `open()` 方法中执行,比如在继承 `AbstractUdfStreamOperator` 的情况下,初始化用户自定义函数。
 
 {{< hint info >}}
-The `initializeState()` contains both the logic for initializing the 
-state of the operator during its initial execution (*e.g.* register any keyed state), and also the logic to retrieve its
-state from a checkpoint after a failure. More about this on the rest of this page.
+`initializeState()` 既包含在初始化过程中算子状态的初始化逻辑(比如注册 keyed 状态),又包含异常后从 checkpoint 中恢复原有状态的逻辑。在接下来的篇幅会进行更详细的介绍。
 {{< /hint >}}
 
-Now that everything is set, the operator is ready to process incoming data. Incoming elements can be one of the following: 
-input elements, watermark, and checkpoint barriers. Each one of them has a special element for handling it. Elements are 
-processed by the `processElement()` method, watermarks by the `processWatermark()`, and checkpoint barriers trigger a 
-checkpoint which invokes (asynchronously) the `snapshotState()` method, which we describe below. For each incoming element,
-depending on its type one of the aforementioned methods is called. Note that the `processElement()` is also the place 
-where the UDF's logic is invoked, *e.g.* the `map()` method of your `MapFunction`.
-
-Finally, in the case of a normal, fault-free termination of the operator (*e.g.* if the stream is
-finite and its end is reached), the `finish()` method is called to perform any final bookkeeping
-action required by the operator's logic (*e.g.* flush any buffered data, or emit data to mark end of
-procesing), and the `close()` is called after that to free any resources held by the operator
-(*e.g.* open network connections, io streams, or native memory held by the operator's data).
-
-In the case of a termination due to a failure or due to manual cancellation, the execution jumps directly to the `close()`
-and skips any intermediate phases between the phase the operator was in when the failure happened and the `close()`.
-
-**Checkpoints:** The `snapshotState()` method of the operator is called asynchronously to the rest of the methods described 
-above whenever a checkpoint barrier is received. Checkpoints are performed during the processing phase, *i.e.* after the 
-operator is opened and before it is closed. The responsibility of this method is to store the current state of the operator 
-to the specified [state backend]({{< ref "docs/ops/state/state_backends" >}}) from where it will be retrieved when 
-the job resumes execution after a failure. Below we include a brief description of Flink's checkpointing mechanism, 
-and for a more detailed discussion on the principles around checkpointing in Flink please read the corresponding documentation: 
-[Data Streaming Fault Tolerance]({{< ref "docs/learn-flink/fault_tolerance" >}}).
-
-## Task Lifecycle
-
-Following that brief introduction on the operator's main phases, this section describes in more detail how a task calls 
-the respective methods during its execution on a cluster. The sequence of the phases described here is mainly included 
-in the `invoke()` method of the `StreamTask` class. The remainder of this document is split into two subsections, one 
-describing the phases during a regular, fault-free execution of a task (see [Normal Execution](#normal-execution)), and 
-(a shorter) one describing the different sequence followed in case the task is cancelled (see [Interrupted Execution](#interrupted-execution)), 
-either manually, or due some other reason, *e.g.* an exception thrown during execution.
-
-### Normal Execution
-
-The steps a task goes through when executed until completion without being interrupted are illustrated below:
-
-        TASK::setInitialState
-        TASK::invoke
-            create basic utils (config, etc) and load the chain of operators
-            setup-operators
-            task-specific-init
-            initialize-operator-states
-            open-operators
-            run
-            finish-operators
-            close-operators
-            task-specific-cleanup
-            common-cleanup
-
-As shown above, after recovering the task configuration and initializing some important runtime parameters, the very 
-first step for the task is to retrieve its initial, task-wide state. This is done in the `setInitialState()`, and it is 
-particularly important in two cases:
-
-1. when the task is recovering from a failure and restarts from the last successful checkpoint
-2. when resuming from a [savepoint]({{< ref "docs/ops/state/savepoints" >}}). 
-
-If it is the first time the task is executed, the initial task state is empty. 
-
-After recovering any initial state, the task goes into its `invoke()` method. There, it first initializes the operators 
-involved in the local computation by calling the `setup()` method of each one of them and then performs its task-specific 
-initialization by calling the local `init()` method. By task-specific, we mean that depending on the type of the task 
-(`SourceTask`, `OneInputStreamTask` or `TwoInputStreamTask`, etc), this step may differ, but in any case, here is where 
-the necessary task-wide resources are acquired. As an example, the `OneInputStreamTask`, which represents a task that 
-expects to have a single input stream, initializes the connection(s) to the location(s) of the different partitions of 
-the input stream that are relevant to the local task.
-
-Having acquired the necessary resources, it is time for the different operators and user-defined functions to acquire 
-their individual state from the task-wide state retrieved above. This is done in the `initializeState()` method, which 
-calls the `initializeState()` of each individual operator. This method should be overridden by every stateful operator 
-and should contain the state initialization logic, both for the first time a job is executed, and also for the case when 
-the task recovers from a failure or when using a savepoint.
-
-Now that all operators in the task have been initialized, the `open()` method of each individual operator is called by 
-the `openAllOperators()` method of the `StreamTask`. This method performs all the operational initialization, 
-such as registering any retrieved timers with the timer service. A single task may be executing multiple operators with one 
-consuming the output of its predecessor. In this case, the `open()` method is called from the last operator, *i.e.* the 
-one whose output is also the output of the task itself, to the first. This is done so that when the first operator starts 
-processing the task's input, all downstream operators are ready to receive its output.
+当所有初始化都完成之后,算子开始处理流入的数据。流入的数据可以分为三种类型:用户数据、watermark 和 checkpoint barriers。每种类型的数据都有单独的方法来处理。用户数据通过 `processElement()` 方法来处理,watermark 通过 `processWatermark()` 来处理,checkpoint barriers 会调用(异步)`snapshotState()` 方法触发 checkpoint。对于每个流入的数据,根据其类型调用上述相应的方法。注意,`processElement()` 方法也是用户自定义函数逻辑执行的地方,比如用户自定义 `MapFunction` 里的  `map()` 方法。
+
+最后,在算子正常无故障的情况下(比如,如果流式数据是有限的,并且最后一个数据已经到达),会调用 `finish()` 方法结束算子并进行必要的清理工作(比如刷新所有缓冲数据,或发送处理结束的标记数据)。在这之后会调用 `close()` 方法来释放算子持有的资源(比如算子数据持有的本地内存)。
+
+在作业失败或手动取消的情况下,会略过从算子异常位置到 `close()` 中间的所有步骤,直接跳到 `close()` 方法结束算子。
+
+**Checkpoints:** 算子的 `snapshotState()` 方法是在收到 checkpoint barrier 后异步调用的。Checkpoint 在处理阶段执行,即算子打开之后,结束之前的这个阶段。这个方法的职责是存储算子的当前状态到一个特定的[状态后端]({{< ref "docs/ops/state/state_backends" >}}),当作业失败后恢复执行时会从这个后端恢复状态数据。下面我们简要描述了 Flink 的 checkpoint 机制,如果想了解更多 Flink checkpoint 相关的原理,可以读一读 [数据流容错]({{< ref "docs/learn-flink/fault_tolerance" >}})。
+
+<a name="task-lifecycle-1"> </a>
+
+## Task 生命周期
+
+在上文对算子主要阶段的简要介绍之后,本节将详细介绍 task 在集群执行期间是如何调用相关方法的。这里所说的阶段主要包含在 `StreamTask` 类的 `invoke()` 方法里。本文档的剩余部分会分成两个子章节,其中一节描述了 task 在常规没有失败情况下执行的阶段(请参考 [常规执行](#normal-execution)),另外一节描述了 task 取消之后执行的阶段(请参考 [中断执行](#interrupted-execution)),不管是手动取消还是其他原因(比如执行期间遇到异常)导致的取消。
+
+<a name="normal-execution"> </a>

Review comment:
       ok




-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org