[
https://issues.apache.org/jira/browse/FLINK-5982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15945161#comment-15945161
]
ASF GitHub Bot commented on FLINK-5982:
---------------------------------------
GitHub user tony810430 opened a pull request:
https://github.com/apache/flink/pull/3633
[FLINK-5982] [runtime] Refactor AbstractInvokable and StatefulTask
This PR wants to merge `AbstractInvokable` and `StatefulTask` to eliminate
"lazy initialization" in `Task`.
The following are what I did in this PR:
1. Merge `AbstractInvokable` and `StatefulTask` and use constructor to
initialize `Environment` and `TaskStateHandles` in `AbstractInvokable`.
2. Update all subclasses and corresponding tests. For now, batch tasks are
still not stateful, so I added `IllegalStateException()` in constructor and
`UnsupportedOperationException()` in the methods for supporting stateful task.
3. Update the behavior of `AbstractInvokable` in `Task`, including
`loadAndInstantiateInvokable()`, `triggerCheckpointBarrier()` and
`notifyCheckpointComplete()`.
4. Add tests for modification in `Task` and tests the constructors'
behavior for all concrete subclasses which inherit `AbstractInvokable`.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/tony810430/flink FLINK-5982
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/3633.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #3633
----
commit 31748905eaa3b4897f0b02473526b7fa05c2304e
Author: Tony Wei <[email protected]>
Date: 2017-03-15T03:13:41Z
[FLINK-5982] Refactor AbstractInvokable and StatefulTask
----
> Refactor AbstractInvokable and StatefulTask
> -------------------------------------------
>
> Key: FLINK-5982
> URL: https://issues.apache.org/jira/browse/FLINK-5982
> Project: Flink
> Issue Type: Improvement
> Components: Distributed Coordination, State Backends, Checkpointing
> Affects Versions: 1.2.0
> Reporter: Wei-Che Wei
> Assignee: Wei-Che Wei
>
> Currently, running a invokable in {{Task}} needs to call
> {{setEnvironment(env)}} and {{invoke()}}. If the invokable is also a
> {{StatefulTask}}, it need to call {{setInitialState(state)}}. That makes the
> difficulty in doing the eager initialization on invokable during
> {{DEPLOYING}} state. One solution discussed in FLINK-4714 is to separate
> {{invoke()}} into {{open()}} and {{invoke()}}, but that makes the complexity
> for running it in {{Task}}.
> This task wants to refactor {{AbstractInvokable}} and {{StatefulTask}} to
> make it easier to construct and run an invokable.
> # Refactor abstract class to have one default constructor.
> #* Drop {{StatefulTask}} and assume all subclasses of {{AbstractInvokable}}
> are stateful.
> #* Remove {{setEnvironment(env)}} and {{setInitialState(state)}}. Make
> {{AbstractInvokable}} have a two argument constructor with {{Environment}}
> and {{TaskStateHandles}}.
> # Update all subclass
> #* Make all subclass of {{AbstractInvokable}} have a two argument constructor
> and call the constructor in {{AbstractInvokable}}.
> #* Throw an error in {{BatchTask}} if the initial state is not null. (This
> will be removed after {{BatchTask}} have been stateful.)
> # Change the creation of the invokable to call that constructor, update all
> the tests.
> Then, we can simplify the logic to run an invokable by using constructor and
> {{invoke()}}. The eager initialization can easily be placed in the
> constructor to fulfill the requirement such as FLINK-4714.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)