Github user sachingoel0101 commented on the pull request:

    https://github.com/apache/flink/pull/1214#issuecomment-146901927
  
    That won't suffice. Even if we allow one execute call, we cannot be sure 
that user won't try to access the `JobExecutionResult`. That also is an issue.
    Disallowing every program which doesn't implement the `Program` interface 
isn't a good solution. I'm not an expert but most people would usually have a 
main method. In that case, it doesn't make sense to have a detached mode if we 
cannot allow such executions.
    We might be able to detect the exact program structure by exploiting the 
Context Environment. Before actually executing the program, we instead first do 
a validation.
    1. On an execute call, instead of actually executing the program, we 
instead build the plan and store it. If another call to execute comes in, we 
fail.
    2. The `JobExecutionResult` can be wrapped in a `DetachedExecutionResult` 
which will fail if user tries to access, say accumulators.
    
    In the documentation for detached mode, we should specify that only 
programs with one execute call, and no usage of the execution result will be 
allowed. This handles the eager execution issue also.
    But I'm concerned this isn't the best possible design.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to