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

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

GitHub user stefanobaghino opened a pull request:

    https://github.com/apache/flink/pull/1536

    [FLINK-2021] Rework examples to use ParameterTool (K-Means)

    I've reworked the K-Means examples in Java and Scala to get a feeling of 
what it would mean on the whole examples code base. Just a remark: I've caught 
the `RequiredParametersException` on the requirements application but not on 
their definition because I've felt the errors are different in nature (the 
application depends on user input while the definition should be somehow caught 
sooner — it would be great to have a way to catch it at compile-time).

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/radicalbit/flink 2021

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/1536.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 #1536
    
----
commit f68cb95af1c27dd8bf99e1a2374969915dd567f9
Author: Stefano Baghino <[email protected]>
Date:   2016-01-21T11:20:49Z

    [FLINK-2021] Rework the K-Means examples to use built-in argument parsing 
facilities instead of ad-hoc functions

commit a432cc204741dd0a2d505886b987c4113e781c84
Author: Stefano Baghino <[email protected]>
Date:   2016-01-21T11:33:15Z

    [FLINK-2021] Renamed user-facing names for options

----


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

Reply via email to