flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-2021) Rework examples to use ParameterTool
Date Tue, 26 Jan 2016 11:08:39 GMT

    [ https://issues.apache.org/jira/browse/FLINK-2021?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15117069#comment-15117069
] 

ASF GitHub Bot commented on FLINK-2021:
---------------------------------------

Github user fhueske commented on the pull request:

    https://github.com/apache/flink/pull/1536#issuecomment-174959098
  
    The examples handle inputs differently than most other DataSet programs because they use
default input data if no input paths are specified. This adds complexity which is not present
in common programs. 
    
    I agree that reading input is an important aspect of a DataSet program, but adding 15
lines for each input to each example seems unnecessary to me.
    
    Extracting code into methods can be good practice, even if a method is only called once.
Reading code can become a lot easier if it is clear what a method does (good method name +
comments) because it can hide all little nasty details and helps to focus on the relevant
parts. 
    The only question is how do we define relevance ;-)
    
    @stefanobaghino, I think this is a good idea. I would keep the parameter parsing in the
main function of the examples, but only move the code to either read a CSV file or get a collection
DataSource to a method.


> Rework examples to use ParameterTool
> ------------------------------------
>
>                 Key: FLINK-2021
>                 URL: https://issues.apache.org/jira/browse/FLINK-2021
>             Project: Flink
>          Issue Type: Improvement
>          Components: Examples
>    Affects Versions: 0.9
>            Reporter: Robert Metzger
>            Priority: Minor
>              Labels: starter
>
> In FLINK-1525, we introduced the {{ParameterTool}}.
> We should port the examples to use the tool.
> The examples could look like this (we should maybe discuss it first on the mailing lists):
> {code}
> public static void main(String[] args) throws Exception {
>     ParameterTool pt = ParameterTool.fromArgs(args);
>     boolean fileOutput = pt.getNumberOfParameters() == 2;
>     String textPath = null;
>     String outputPath = null;
>     if(fileOutput) {
>         textPath = pt.getRequired("input");
>         outputPath = pt.getRequired("output");
>     }
>     // set up the execution environment
>     final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
>     env.getConfig().setUserConfig(pt);
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message