New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FLINK-14494][docs] Add ConfigOption type to the documentation generator #10117
Conversation
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Automated ChecksLast check on commit 43b2c07 (Wed Dec 04 15:08:06 UTC 2019) Warnings:
Mention the bot in a comment to re-run the automated checks. Review Progress
Please see the Pull Request Review Guide for a full explanation of the review process. The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commandsThe @flinkbot bot supports the following commands:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something I immediately stumbled on was that quite a lot of types are defined as Strings, where this is more generic that it should be. While we can't fix it for port ranges, paths and classes, for durations and memory sizes it should be possible to provide a better type.
Can we get a screenshot for how type column looks like for an enum?
The completeness check is also failing:
16:50:29.360 [INFO] Running org.apache.flink.docs.configuration.ConfigOptionsDocsCompletenessITCase
16:50:29.659 [ERROR] Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.296 s <<< FAILURE! - in org.apache.flink.docs.configuration.ConfigOptionsDocsCompletenessITCase
16:50:29.659 [ERROR] testFullReferenceCompleteness(org.apache.flink.docs.configuration.ConfigOptionsDocsCompletenessITCase) Time elapsed: 0.227 s <<< FAILURE!
java.lang.AssertionError:
Documentation is outdated, please regenerate it according to the instructions in flink-docs/README.md.
Problems:
Documented default of yarn.per-job-cluster.include-user-jar in class org.apache.flink.yarn.configuration.YarnConfigOptions is outdated. Expected: "ORDER" Actual: ORDER
at org.apache.flink.docs.configuration.ConfigOptionsDocsCompletenessITCase.compareDocumentedAndExistingOptions(ConfigOptionsDocsCompletenessITCase.java:120)
at org.apache.flink.docs.configuration.ConfigOptionsDocsCompletenessITCase.testFullReferenceCompleteness(ConfigOptionsDocsCompletenessITCase.java:78)
16:50:29.981 [INFO]
16:50:29.981 [INFO] Results:
16:50:29.981 [INFO]
16:50:29.981 [ERROR] Failures:
16:50:29.981 [ERROR] ConfigOptionsDocsCompletenessITCase.testFullReferenceCompleteness:78->compareDocumentedAndExistingOptions:120 Documentation is outdated, please regenerate it according to the instructions in flink-docs/README.md.
Problems:
Documented default of yarn.per-job-cluster.include-user-jar in class org.apache.flink.yarn.configuration.YarnConfigOptions is outdated. Expected: "ORDER" Actual: ORDER
return clazz; | ||
} | ||
|
||
boolean isList() { | ||
public boolean isList() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless we believe that these methods provide value to users I'm actually inclined to call these via reflection.
@@ -69,6 +71,8 @@ | |||
}; | |||
|
|||
static final Set<String> EXCLUSIONS = new HashSet<>(Arrays.asList( | |||
"org.apache.flink.configuration.ReadableConfig", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this actually related to the PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and no. This should've been part of the https://issues.apache.org/jira/browse/FLINK-14493
Unfortunately I was not aware of this logic and that the ReadableConfig
and WritableConfig
will be picked up by the documentation generator. Those are new read-only, write-only interfaces for Configuration
. Config tables should not be generated for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I'd move this change into a separate commit.
" <td>" + formatter.format(option.description()) + "</td>\n" + | ||
" </tr>\n"; | ||
} | ||
|
||
static String typeToHtml(OptionWithMetaInfo optionWithMetaInfo) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VisibleForTesting
if (option.getClazz().isEnum()) { | ||
return String.format( | ||
"<p>%s</p>Possible values: %s", | ||
escapeCharacters(type), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the actual class name is overkill imo and mostly an implementation detail; I'd just stick to Enum: Possible values: ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only two cents on this one are that if in the future we want users to be able to specify these options also programatically, it would make sense to also have the name of the class.
But I am not so sure about the final result so I am also willing to leave it like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm with @zentol on that one. I think for programmatic approach its enough that we have that type encoded in the ConfigOption
. These docs are rather for defining options from config files.
Thank you @zentol for your review. Here is a screenshot of an enum option: Also I am sorry for the failed test. Forgot to regenerate the docs after reverting a temporary change to one of the options The problem with |
static String typeToHtml(OptionWithMetaInfo optionWithMetaInfo) { | ||
ConfigOption<?> option = optionWithMetaInfo.option; | ||
Class<?> clazz = getClazz(option); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we expect to have a list of enums or of maps (i.e. any level of "nesting")? If yes, what do we expect to have as the result for the docs here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point I forgot about. We do support a single level of nesting. So there might be a List or List. I improved the doc generator to handle those cases as well.
0a6385f
to
0fda59d
Compare
Could you have another look @zentol when you have some time? What do you think about my answers to the remaining questions. |
Ok, so must duration/memorysize options are still based on Strings. In that case I would suggest to still add in the hooks for displaying the type, and sticking with String for the time being, and file follow-up tickets for updating these options to not be based on Strings. |
0fda59d
to
43b2c07
Compare
What is the purpose of the change
It adds generating type column to
ConfigOptionsDocGenerator
Verifying this change
org.apache.flink.docs.configuration.ConfigOptionsDocGeneratorTest#testCreatingTypes
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: (yes / no)Documentation