Github user rmetzger commented on the pull request:

    https://github.com/apache/flink/pull/331#issuecomment-71467375
  
    I think it would be better not to print the help if the user specified 
something incorrectly. Maybe just the error message and a note that -h prints 
the help?
    
    I've tried out the change, but now, the message is as the very bottom of 
the output. Its now probably even harder to find it.
    
    **Bad** (see below for *Good*)
    
    ```
    robert@robert-da ~/flink-workdir/flink2/build-target (git)-[flink-1436] % 
./bin/flink ./examples/flink-java-examples-0.9-SNAPSHOT-WordCount.jar 
    
    Action "run" compiles and runs a program.
    
      Syntax: run [OPTIONS] <jar-file> <arguments>
      "run" action options:
         -c,--class <classname>           Class with the program entry point 
("main"
                                          method or "getPlan()" method. Only 
needed
                                          if the JAR file does not specify the 
class
                                          in its manifest.
         -m,--jobmanager <host:port>      Address of the JobManager (master) to
                                          which to connect. Specify 
'yarn-cluster'
                                          as the JobManager to deploy a YARN 
cluster
                                          for the job. Use this flag to connect 
to a
                                          different JobManager than the one
                                          specified in the configuration.
         -p,--parallelism <parallelism>   The parallelism with which to run the
                                          program. Optional flag to override the
                                          default value specified in the
                                          configuration.
      Additional arguments if -m yarn-cluster is set:
         -yD <arg>                            Dynamic properties
         -yj,--yarnjar <arg>                  Path to Flink jar file
         -yjm,--yarnjobManagerMemory <arg>    Memory for JobManager Container 
[in
                                              MB]
         -yn,--yarncontainer <arg>            Number of YARN container to 
allocate
                                              (=Number of Task Managers)
         -yq,--yarnquery                      Display available YARN resources
                                              (memory, cores)
         -yqu,--yarnqueue <arg>               Specify YARN queue.
         -ys,--yarnslots <arg>                Number of slots per TaskManager
         -yt,--yarnship <arg>                 Ship files in the specified 
directory
                                              (t for transfer)
         -ytm,--yarntaskManagerMemory <arg>   Memory per TaskManager Container 
[in
                                              MB]
    
    Invalid action: "./examples/flink-java-examples-0.9-SNAPSHOT-WordCount.jar"
    1 robert@robert-da ~/flink-workdir/flink2/build-target (git)-[flink-1436]
    ```
    
    The "info" command is over-engineered in my optionion. It contains only one 
possible option, which is "-e" for execution plan. I would vote to remove the 
info action and call it "plan" or so. 
    Or keep its "info" name and print the plan by default (this is not @mxm's 
fault .. but it would be nice to fix this with the PR)
    ```
     ./bin/flink info  
./examples/flink-java-examples-0.9-SNAPSHOT-WordCount.jar  
    
    Action "info" displays information about a program.
    
      Syntax: info [OPTIONS] <jar-file> <arguments>
      "info" action options:
         -c,--class <classname>           Class with the program entry point 
("main"
                                          method or "getPlan()" method. Only 
needed
                                          if the JAR file does not specify the 
class
                                          in its manifest.
         -e,--executionplan               Show optimized execution plan of the
                                          program (JSON)
         -m,--jobmanager <host:port>      Address of the JobManager (master) to
                                          which to connect. Specify 
'yarn-cluster'
                                          as the JobManager to deploy a YARN 
cluster
                                          for the job. Use this flag to connect 
to a
                                          different JobManager than the one
                                          specified in the configuration.
         -p,--parallelism <parallelism>   The parallelism with which to run the
                                          program. Optional flag to override the
                                          default value specified in the
                                          configuration.
    
    Error: Specify one of the above options to display information.
    ```
    
    **Good**
    
    What I liked was the error reporting when passing an invalid file as the 
jar file:
    ```
    robert@robert-da ~/flink-workdir/flink2/build-target (git)-[flink-1436] % 
./bin/flink run ../flink-yarn-0.9-SNAPSHOT/LICENSE
    
    Action "run" compiles and runs a program.
    
      Syntax: run [OPTIONS] <jar-file> <arguments>
      "run" action options:
         -c,--class <classname>           Class with the program entry point 
("main"
                                          method or "getPlan()" method. Only 
needed
                                          if the JAR file does not specify the 
class
                                          in its manifest.
         -m,--jobmanager <host:port>      Address of the JobManager (master) to
                                          which to connect. Specify 
'yarn-cluster'
                                          as the JobManager to deploy a YARN 
cluster
                                          for the job. Use this flag to connect 
to a
                                          different JobManager than the one
                                          specified in the configuration.
         -p,--parallelism <parallelism>   The parallelism with which to run the
                                          program. Optional flag to override the
                                          default value specified in the
                                          configuration.
      Additional arguments if -m yarn-cluster is set:
         -yD <arg>                            Dynamic properties
         -yj,--yarnjar <arg>                  Path to Flink jar file
         -yjm,--yarnjobManagerMemory <arg>    Memory for JobManager Container 
[in
                                              MB]
         -yn,--yarncontainer <arg>            Number of YARN container to 
allocate
                                              (=Number of Task Managers)
         -yq,--yarnquery                      Display available YARN resources
                                              (memory, cores)
         -yqu,--yarnqueue <arg>               Specify YARN queue.
         -ys,--yarnslots <arg>                Number of slots per TaskManager
         -yt,--yarnship <arg>                 Ship files in the specified 
directory
                                              (t for transfer)
         -ytm,--yarntaskManagerMemory <arg>   Memory per TaskManager Container 
[in
                                              MB]
    
    org.apache.flink.client.program.ProgramInvocationException: Error while 
opening jar file '../flink-yarn-0.9-SNAPSHOT/LICENSE'. error in opening zip file
        at 
org.apache.flink.client.program.PackagedProgram.getEntryPointClassNameFromJar(PackagedProgram.java:466)
        at 
org.apache.flink.client.program.PackagedProgram.<init>(PackagedProgram.java:134)
        at 
org.apache.flink.client.program.PackagedProgram.<init>(PackagedProgram.java:102)
        at 
org.apache.flink.client.CliFrontend.buildProgram(CliFrontend.java:731)
        at org.apache.flink.client.CliFrontend.run(CliFrontend.java:332)
        at 
org.apache.flink.client.CliFrontend.parseParameters(CliFrontend.java:1078)
        at org.apache.flink.client.CliFrontend.main(CliFrontend.java:1102)
    Caused by: java.util.zip.ZipException: error in opening zip file
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(ZipFile.java:215)
        at java.util.zip.ZipFile.<init>(ZipFile.java:145)
        at java.util.jar.JarFile.<init>(JarFile.java:154)
        at java.util.jar.JarFile.<init>(JarFile.java:118)
        at 
org.apache.flink.client.program.PackagedProgram.getEntryPointClassNameFromJar(PackagedProgram.java:464)
        ... 6 more
    
    The exception above occurred while trying to run your command.
    ```


---
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