[ 
https://issues.apache.org/jira/browse/FLINK-5982?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Wei-Che Wei updated FLINK-5982:
-------------------------------
    Description: 
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.
#* Remove {{setEnvironment(env)}} and change {{AbstractInvokable}} to have one 
argument constructor with {{Environment}}.
#* Remove {{setInitialState}} and create a new abstract class 
{{AbstractStatefulInvokable}} to inherit {{AbstractInvokable}} and implement 
{{StatefulTask}}. Make {{AbstractStatefulInvokable}} have a two argument 
constructor with {{Environment}} and {{TaskStateHandles}}.
# Update all subclass
#* Make all subclass of only {{AbstractInvokable}} have an one argument 
constructor and call the constructor in {{AbstractInvokable}}.
#* Make all subclass of {{AbstractInvokable}} and {{StatefulTask}} to inherit 
{{AbstractStatefulInvokable}} and have two two argument constructor.
# Change the creation of the invokables 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.

  was:
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.
#* Remove {{setEnvironment(env)}} and change {{AbstractInvokable}} to have one 
argument constructor with {{Environment}}.
#* Remove {{setInitialState}} and create a new abstract class 
{{AbstractStatefulInvokable}} to inherit {{AbstractInvokable}} and implement 
{{StatefulTask}}. Make {{AbstractStatefulInvokable}} have a two argument 
constructor with {{Environment}} and {{TaskStateHandles}}.
# Update all subclass
#* Make all subclass of only {{AbstractInvokable}} have an one argument 
constructor and call the constructor in {{AbstractInvokable}}.
#* Make all subclass of {{AbstractInvokable}} and {{StatefulTask}} to inherit 
{{AbstractStatefulInvokable}} and have two two argument constructor.
# Change the creation of the invokables to call that constructor, update all 
the tests


> 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.
> #* Remove {{setEnvironment(env)}} and change {{AbstractInvokable}} to have 
> one argument constructor with {{Environment}}.
> #* Remove {{setInitialState}} and create a new abstract class 
> {{AbstractStatefulInvokable}} to inherit {{AbstractInvokable}} and implement 
> {{StatefulTask}}. Make {{AbstractStatefulInvokable}} have a two argument 
> constructor with {{Environment}} and {{TaskStateHandles}}.
> # Update all subclass
> #* Make all subclass of only {{AbstractInvokable}} have an one argument 
> constructor and call the constructor in {{AbstractInvokable}}.
> #* Make all subclass of {{AbstractInvokable}} and {{StatefulTask}} to inherit 
> {{AbstractStatefulInvokable}} and have two two argument constructor.
> # Change the creation of the invokables 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)

Reply via email to