Skip to content
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

Merged
merged 3 commits into from Nov 14, 2019

Conversation

dawidwys
Copy link
Contributor

@dawidwys dawidwys commented Nov 7, 2019

What is the purpose of the change

It adds generating type column to ConfigOptionsDocGenerator

Verifying this change

  • Added org.apache.flink.docs.configuration.ConfigOptionsDocGeneratorTest#testCreatingTypes
  • All previous tests should run

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (yes / no)
  • The serializers: (yes / no / don't know)
  • The runtime per-record code paths (performance sensitive): (yes / no / don't know)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (yes / no / don't know)
  • The S3 file system connector: (yes / no / don't know)

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

@dawidwys
Copy link
Contributor Author

dawidwys commented Nov 7, 2019

I would appreciate if you had a look @zentol @kl0u

@flinkbot
Copy link
Collaborator

flinkbot commented Nov 7, 2019

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit 43b2c07 (Wed Dec 04 15:08:06 UTC 2019)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

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 commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@kl0u kl0u self-assigned this Nov 7, 2019
@flinkbot
Copy link
Collaborator

flinkbot commented Nov 7, 2019

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run travis re-run the last Travis build

Copy link
Contributor

@zentol zentol left a 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() {
Copy link
Contributor

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",
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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) {
Copy link
Contributor

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),
Copy link
Contributor

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: ...

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@dawidwys
Copy link
Contributor Author

dawidwys commented Nov 8, 2019

Thank you @zentol for your review. Here is a screenshot of an enum option:

image

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 String in most of the rows is that the value of this column is based on the functionality introduced in https://issues.apache.org/jira/browse/FLINK-14493, where we should provide the type explicitly. So far all the memory, duration options were actually of type string and the parsing happened in place where the option was accessed. I can not see a way to change the type automatically without changing the corresponding ConfigOption and all the places it is accessed. A workaround I can see is to enable this column manually only for groups that have all the ConfigOptions updated. Do you think this would be a better approach?

static String typeToHtml(OptionWithMetaInfo optionWithMetaInfo) {
ConfigOption<?> option = optionWithMetaInfo.option;
Class<?> clazz = getClazz(option);

Copy link
Contributor

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?

Copy link
Contributor Author

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.

@dawidwys
Copy link
Contributor Author

Could you have another look @zentol when you have some time? What do you think about my answers to the remaining questions.

@zentol
Copy link
Contributor

zentol commented Nov 13, 2019

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.

@dawidwys dawidwys merged commit 381892f into apache:master Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants