flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmetzger <...@git.apache.org>
Subject [GitHub] flink pull request: [FLINK-2017] Add predefined required parameter...
Date Sun, 22 Nov 2015 14:58:51 GMT
Github user rmetzger commented on the pull request:

    https://github.com/apache/flink/pull/1097#issuecomment-158765143
  
    I've tested the PR again. 
    I found a minor issue with the alternative arguments.
    input: `--input abc --p 12`,
    code:
    ```java
    RequiredParameters rq = new RequiredParameters();
    		rq.add("input");
    		rq.add(new Option("parallelism").alt("p").defaultValue("1").type(OptionType.INTEGER));
    		ParameterTool pt = ParameterTool.fromArgs(args);
    		rq.applyTo(pt);
    
    		String in = pt.get("input");
    		System.out.println("In = "+in + " parallelism = "+pt.getInt("parallelism") + " p="+pt.getInt("p"));
    
    		System.exit(0);
    ```
    
    error 
    ```
    Exception in thread "main" java.lang.RuntimeException: No data for required key 'p'
    	at org.apache.flink.api.java.utils.ParameterTool.getRequired(ParameterTool.java:236)
    	at org.apache.flink.api.java.utils.ParameterTool.getInt(ParameterTool.java:272)
    	at org.apache.flink.examples.java.wordcount.WordCount.main(WordCount.java:69)
    ```
    
    I think we need to set the (default) value for the long and the short variant.


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

Mime
View raw message