[ 
https://issues.apache.org/jira/browse/FLINK-2646?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14742379#comment-14742379
 ] 

chenliang613 edited comment on FLINK-2646 at 9/13/15 8:02 AM:
--------------------------------------------------------------

@Stephan Ewen
1.Can you help me to quickly understand "The runtime is the changed to call 
close() as part of the regular execution and closeAfterFailure() in case of an 
irregular exit.".

2.Just i checked source code, the ChainedAllReduceDriver.java(one of runtime 
Driver) already have cancelTask() method for irregular exit. 
(ChainedFlatMapDriver,ChainedMapDriver etc. are same)

@Override
        public void closeTask() throws Exception {
                RegularPactTask.closeUserCode(this.reducer);
        }
//chenliang613 remark: "RegularPactTask.closeUserCode(this.reducer)" also will 
invoke "FunctionUtils.closeFunction(this.reducer)"

        @Override
        public void cancelTask() {
                try {
                        FunctionUtils.closeFunction(this.reducer);
                } catch (Throwable t) {
                }
        }


was (Author: chenliang613):
@Stephan Ewen
1.Can you help me to quickly understand "The runtime is the changed to call 
close() as part of the regular execution and closeAfterFailure() in case of an 
irregular exit.".

2.Just i checked source code, the ChainedAllReduceDriver(one of runtime Driver) 
already have cancelTask() method for irregular exit.

@Override
        public void closeTask() throws Exception {
                RegularPactTask.closeUserCode(this.reducer);
        }
//chenliang613 remark: "RegularPactTask.closeUserCode(this.reducer)" also will 
invoke "FunctionUtils.closeFunction(this.reducer)"

        @Override
        public void cancelTask() {
                try {
                        FunctionUtils.closeFunction(this.reducer);
                } catch (Throwable t) {
                }
        }

> Rich functions should provide a method "closeAfterFailure()"
> ------------------------------------------------------------
>
>                 Key: FLINK-2646
>                 URL: https://issues.apache.org/jira/browse/FLINK-2646
>             Project: Flink
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 0.10
>            Reporter: Stephan Ewen
>            Assignee: chenliang613
>             Fix For: 0.10
>
>
> Right now, the {{close()}} method of rich functions is invoked in case of 
> proper completion, and in case of canceling in case of error (to allow for 
> cleanup).
> In certain cases, the user function needs to know why it is closed, whether 
> the task completed in a regular fashion, or was canceled/failed.
> I suggest to add a method {{closeAfterFailure()}} to the {{RichFunction}}. By 
> default, this method calls {{close()}}. The runtime is the changed to call 
> {{close()}} as part of the regular execution and {{closeAfterFailure()}} in 
> case of an irregular exit.
> Because by default all cases call {{close()}} the change would not be API 
> breaking.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to