You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by greghogan <gi...@git.apache.org> on 2016/10/19 18:05:19 UTC
[GitHub] flink pull request #2662: [FLINK-4824] [client] CliFrontend shows misleading...
GitHub user greghogan opened a pull request:
https://github.com/apache/flink/pull/2662
[FLINK-4824] [client] CliFrontend shows misleading error message
When a Flink program throws `ProgramParametrizationException` the optional message is printed to stderr and the stacktrace is ignored.
I modified Gelly's `JaccardIndex` driver to use this functionality as an example.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/greghogan/flink 4824_clifrontend_shows_misleading_error_message_when_main_method_returns_before_env_execute
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/2662.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 #2662
----
commit af0b2223a4fe03016f223e2605e12d00e177999c
Author: Greg Hogan <co...@greghogan.com>
Date: 2016-10-13T16:40:53Z
[FLINK-4824] [client] CliFrontend shows misleading error message
When a Flink program throws ProgramParametrizationException the
optional message is printed to stderr and the stacktrace is ignored.
----
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] flink pull request #2662: [FLINK-4824] [client] CliFrontend shows misleading...
Posted by mxm <gi...@git.apache.org>.
Github user mxm commented on a diff in the pull request:
https://github.com/apache/flink/pull/2662#discussion_r84448541
--- Diff: flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java ---
@@ -975,6 +981,32 @@ private int handleArgException(Exception e) {
}
/**
+ * Displays an optional exception message for incorrect program parametrization.
+ *
+ * @param e The exception to display.
+ * @return The return code for the process.
+ */
+ private int handleParametrizationException(ProgramParametrizationException e) {
+ String message = e.getMessage();
+ if (message != null) {
+ System.err.println(message);
+ }
--- End diff --
This block could be removed if we got rid of the zero-args constructor in `ProgramParametrizationException`.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] flink pull request #2662: [FLINK-4824] [client] CliFrontend shows misleading...
Posted by mxm <gi...@git.apache.org>.
Github user mxm commented on a diff in the pull request:
https://github.com/apache/flink/pull/2662#discussion_r84448442
--- Diff: flink-clients/src/main/java/org/apache/flink/client/program/ProgramParametrizationException.java ---
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.client.program;
+
+/**
+ * Exception used to indicate that there is an error in the parametrization of a Flink program.
+ */
+public class ProgramParametrizationException extends RuntimeException {
+ /**
+ * Serial version UID for serialization interoperability.
+ */
+ private static final long serialVersionUID = 909054589029890262L;
+
+ /**
+ * Creates a <tt>ProgramParametrizationException</tt>.
+ */
+ public ProgramParametrizationException() {
+ super();
--- End diff --
I think we should not even allow to skip the message here. This will simplify the code further and display some message for the user.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] flink issue #2662: [FLINK-4824] [client] CliFrontend shows misleading error ...
Posted by greghogan <gi...@git.apache.org>.
Github user greghogan commented on the issue:
https://github.com/apache/flink/pull/2662
@mxm thanks for the review. I added a second commit which I think satisfies your request. When no job is executed then the message is printed to stderr without a stacktrace.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] flink pull request #2662: [FLINK-4824] [client] CliFrontend shows misleading...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/flink/pull/2662
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] flink issue #2662: [FLINK-4824] [client] CliFrontend shows misleading error ...
Posted by mxm <gi...@git.apache.org>.
Github user mxm commented on the issue:
https://github.com/apache/flink/pull/2662
Thanks for the PR @greghogan! Having a custom exception for missing arguments to a user program is a good approach. However, it requires the author of the program to use the custom exception. At least, we would have to adapt all the included examples. Additionally, it would be nice to throw another custom exception when no Flink job was generated during execution of the jar (which might be because of missing arguments). Currently, we simply throw a `ProgramInvocationException` which could look like a serious error to the user when merely arguments are missing.
So +1 but we might do some follow-ups to fully solve the issue.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---