[ 
https://issues.apache.org/jira/browse/BEAM-8996?focusedWorklogId=361629&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-361629
 ]

ASF GitHub Bot logged work on BEAM-8996:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 20/Dec/19 12:27
            Start Date: 20/Dec/19 12:27
    Worklog Time Spent: 10m 
      Work Description: lgajowy commented on pull request #10424: [BEAM-8996] 
Auto-generate pipeline options documentation for FlinkRunner
URL: https://github.com/apache/beam/pull/10424#discussion_r360352393
 
 

 ##########
 File path: 
runners/flink/src/test/java/org/apache/beam/runners/flink/website/PipelineOptionsTableGenerator.java
 ##########
 @@ -0,0 +1,179 @@
+/*
+ * 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.beam.runners.flink.website;
+
+import edu.umd.cs.findbugs.annotations.Nullable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Optional;
+import org.apache.beam.runners.flink.FlinkPipelineOptions;
+import org.apache.beam.sdk.options.Default;
+import org.apache.beam.sdk.options.Description;
+import 
org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.CaseFormat;
+import 
org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableList;
+
+/**
+ * A main class which is called by the Gradle generatePipelineOptionsTable* 
tasks to update the list
+ * of available pipeline options for the Beam website.
+ */
+public class PipelineOptionsTableGenerator {
+
+  private static final List<String> supportedLanguages = 
ImmutableList.of("java", "python");
+
+  private static class Option {
+    String name;
+    String description;
+    @Nullable String defaultValue;
+
+    public Option(String name, String description, @Nullable String 
defaultValue) {
+      this.name = name;
+      this.description = description;
+      this.defaultValue = defaultValue;
+    }
+  }
+
+  public static void main(String[] args) {
+    if (args.length != 1) {
+      throw new RuntimeException(
+          "Please specify the language (" + supportedLanguages + ") as the 
only argument.");
+    }
+    String arg = args[0].toLowerCase();
+    if (!supportedLanguages.contains(arg)) {
+      throw new RuntimeException("The language is not supported: " + arg);
+    }
+    boolean isPython = arg.equals("python");
+
+    printHeader();
+    List<Option> options = extractOptions(isPython);
+    printOptionsTable(options);
 
 Review comment:
   I must disagree. Using at least a template and reading it with StringBuilder 
would simplify the code in this class by separating the view from the 
generation logic - this alone is a big benefit. Other, previously mentioned 
points above are still valid too. At the same time, adding the template alone 
(even only with the StringBuilder reading it) is relatively easy to do.
   
   Right now, future contributors that will need/want to extend/fix this code 
have to deal with the complexity that otherwise would not be there. It will be 
therefore harder to generify the solution and adapt it to other runners later 
and it will probably discourage some to do so. 
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 361629)
    Time Spent: 2.5h  (was: 2h 20m)

> Auto-generate pipeline options documentation for FlinkRunner
> ------------------------------------------------------------
>
>                 Key: BEAM-8996
>                 URL: https://issues.apache.org/jira/browse/BEAM-8996
>             Project: Beam
>          Issue Type: Improvement
>          Components: runner-flink
>            Reporter: Maximilian Michels
>            Assignee: Maximilian Michels
>            Priority: Major
>             Fix For: 2.19.0
>
>          Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> The documentation on the pipeline options on the [runner 
> page|https://beam.apache.org/documentation/runners/flink/] easily becomes 
> outdated. In order for them to stay up to date, we should auto-generate the 
> documentation from the {{FlinkPipelineOptions}} class. This should be done 
> for both Java and Python.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to