[
https://issues.apache.org/jira/browse/BEAM-8996?focusedWorklogId=361595&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-361595
]
ASF GitHub Bot logged work on BEAM-8996:
----------------------------------------
Author: ASF GitHub Bot
Created on: 20/Dec/19 11:20
Start Date: 20/Dec/19 11:20
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_r360320926
##########
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:
Have you considered using some html builder libraries/template engines for
java that could do the task for you? We could generate the changing part (the
pipelineOptionsTable) and then insert it to a template. The advantage is that
if webpage code, style, indentation rules etc. change, we can adapt easily and
change just the template code (not digging into this class' logic).
If for some reason we don't want to use a templating engine, it's maybe
still better to use String builder, and a template file, like here:
https://stackoverflow.com/a/9909951
----------------------------------------------------------------
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: 361595)
Time Spent: 20m (was: 10m)
> 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
> Time Spent: 20m
> 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)