flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fhueske <...@git.apache.org>
Subject [GitHub] flink pull request #3429: [FLINK-5937] [doc] Add documentation about the str...
Date Tue, 28 Feb 2017 16:01:41 GMT
Github user fhueske commented on a diff in the pull request:

    --- Diff: docs/internals/task_lifecycle.md ---
    @@ -0,0 +1,149 @@
    +title:  "Task Lifecycle"
    +nav-title: Task Lifecycle
    +nav-parent_id: internals
    +nav-pos: 5
    +Licensed to the Apache Software Foundation (ASF) under one
    +or more contributor license agreements.  See the NOTICE file
    +distributed with this work for additional information
    +regarding copyright ownership.  The ASF licenses this file
    +to you under the Apache License, Version 2.0 (the
    +"License"); you may not use this file except in compliance
    +with the License.  You may obtain a copy of the License at
    +  http://www.apache.org/licenses/LICENSE-2.0
    +Unless required by applicable law or agreed to in writing,
    +software distributed under the License is distributed on an
    +KIND, either express or implied.  See the License for the
    +specific language governing permissions and limitations
    +under the License.
    +A task in Flink is the basic unit of execution. This is the place where each parallel
instance of your operators gets executed. 
    +This document goes through the different phases in the lifecycle of the `StreamTask`,
which is the base for all different task sub-types in Flink's streaming engine. 
    +* This will be replaced by the TOC
    +## Operator Lifecycle in a nutshell
    +As the task is the entity that executes your operators, its lifecycle is tightly integrated
with that of an operator. Given this, it is worth spending a few lines 
    +simply mentioning 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 they are called. These are:
    +        // initialization
    +	    initializeState()
    +	    setup()
    +	    open()
    +	    // processing
    +	    processElement()
    +	    processWatermark()
    +	    // termination
    +	    close()
    +	    dispose()
    +        // checkpointing
    +        snapshotState()
    +In a nutshell, the `initializeState()` gives an operator its initial state. After obtaining
it, the `setup()` is called to initialize some operator specific 
    +machinery, such as its `RuntimContext` and its metric collection data-structures, and
the `open()` executes any operator-specific initialization, such as
    +opening the user-defined function in the case of the `AbstractUdfStreamOperator`. 
    +Now that everything is set, the operator is ready to process fresh incoming data. This
is done by invoking the `processElement()` and `processWatermark()` methods which
    +contain the logic for processing elements and watermark respectively.
    +Finally, in the case of normal, fault-free termination of the operator (*e.g.* if the
stream is finite and its end is reached), the `close()` method is called to 
    +perform any final bookkeeping action required by the operator's logic, and the `dispose()`
is called after that to free any resources held by the operator. 
    +In the case of termination due to a failure or due to manual cancellation, the execution
jumps directly to the `dispose()`, and skips any intermediate phases between
    +the phase the operator was in when the failure happened and the `dispose` one.
    +**Checkpoints:** The `snapshotState()` method of the operator is called asynchronously
to the rest of the methods described above, whenever a checkpoint barrier is received. 
    +Its responsibility is to store the current state of the operator to the specified [state
backend]({{ site.baseurl }}/ops/state_backends.html) from where it is going to be 
    +retrieved when the job resumes execution after a failure. For a bried description of
Flink's checkpointing mechanism please keep on reading, and for a more detailed discussion

    --- End diff --
    "bried" -> "brief"

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message