Repository: flink Updated Branches: refs/heads/master 825ef3be3 -> 8c7c42f0e
[FLINK-4677] fail if user jar contains no executions This closes #2548. Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/8c7c42f0 Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/8c7c42f0 Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/8c7c42f0 Branch: refs/heads/master Commit: 8c7c42f0e91aa3fa2016650e541bbb668e6b79db Parents: 825ef3b Author: Maximilian Michels <[email protected]> Authored: Fri Sep 30 15:00:32 2016 +0200 Committer: Maximilian Michels <[email protected]> Committed: Wed Oct 5 16:07:25 2016 +0200 ---------------------------------------------------------------------- .../java/org/apache/flink/client/program/ClusterClient.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/8c7c42f0/flink-clients/src/main/java/org/apache/flink/client/program/ClusterClient.java ---------------------------------------------------------------------- diff --git a/flink-clients/src/main/java/org/apache/flink/client/program/ClusterClient.java b/flink-clients/src/main/java/org/apache/flink/client/program/ClusterClient.java index 1ef8fe1..5be6650 100644 --- a/flink-clients/src/main/java/org/apache/flink/client/program/ClusterClient.java +++ b/flink-clients/src/main/java/org/apache/flink/client/program/ClusterClient.java @@ -320,6 +320,10 @@ public abstract class ClusterClient { try { // invoke main method prog.invokeInteractiveModeForExecution(); + if (lastJobExecutionResult == null && factory.getLastEnvCreated() == null) { + throw new ProgramInvocationException("The program didn't contain Flink jobs. " + + "Perhaps you forgot to call execute() on the execution environment."); + } if (isDetached()) { // in detached mode, we execute the whole user code to extract the Flink job, afterwards we run it here return ((DetachedEnvironment) factory.getLastEnvCreated()).finalizeExecute(); @@ -334,7 +338,7 @@ public abstract class ClusterClient { } } else { - throw new RuntimeException("PackagedProgram does not have a valid invocation mode."); + throw new ProgramInvocationException("PackagedProgram does not have a valid invocation mode."); } }
