Skip to content

[FLINK-11781][yarn] Remove "DISABLED" as possible value for yarn.per-job-cluster.include-user-jar#7883

Merged
asfgit merged 2 commits intoapache:masterfrom
GJL:FLINK-11781
Mar 6, 2019
Merged

[FLINK-11781][yarn] Remove "DISABLED" as possible value for yarn.per-job-cluster.include-user-jar#7883
asfgit merged 2 commits intoapache:masterfrom
GJL:FLINK-11781

Conversation

@GJL
Copy link
Member

@GJL GJL commented Mar 3, 2019

What is the purpose of the change

This removes DISABLED as a possible value for the config option yarn.per-job-cluster.include-user-jar. Since Flink 1.5, this feature is broken.

Brief change log

  • See commits

Verifying this change

This change is a trivial rework / code cleanup without any test coverage.

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)

@flinkbot
Copy link
Collaborator

flinkbot commented Mar 3, 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.

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.

Details
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


/** @see YarnConfigOptions#CLASSPATH_INCLUDE_USER_JAR */
public enum UserJarInclusion {
DISABLED,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check where this is parsed to the enum and throw a meaningful exception explaining that DISABLED has been removed.

Copy link
Member Author

@GJL GJL Mar 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From Flink 1.5 to 1.7:

  • If DISABLED is set, the job keeps failing.
  • If an invalid value is set, the default value (ORDER) is used, and a warning is logged ("Configuration parameter {} was configured with an invalid value {}. Falling back to default ({}).").

If we would apply the PR as is, we would always log a warning (because DISABLED will be considered an invalid value). You are proposing to throw an exception with a customized message if DISABLED is set. This would help users that are upgrading from 1.4 to 1.8 directly. So I could do that but I think it makes sense to also propagate the exception for all other invalid values instead of logging a warning. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for throwing exception rather than just logging, when mismatch.

@GJL GJL force-pushed the FLINK-11781 branch 2 times, most recently from d157650 to af3e742 Compare March 5, 2019 14:58
Copy link
Contributor

@dawidwys dawidwys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing we should fix is the case sensitivity for Configuration#getAsEnum other than that I had just small suggestions. Overall it looks good.

Personally I like the approach that if a user configures the option, it has to be set correctly (or otherwise an exception will be thrown). This way we won't fallback silently to some other option in case of e.g. spelling mistake. So +1 for current behavior.


final String configValue = getString(configOption);
try {
return T.valueOf(enumClass, configValue);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
return T.valueOf(enumClass, configValue);
return Enum.valueOf(enumClass, configValue);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's better. Fixed it.

* be parsed as a value of the provided enum class.
*/
@PublicEvolving
public <T extends Enum<T>> T getAsEnum(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This would be more consistent with other getters.

Suggested change
public <T extends Enum<T>> T getAsEnum(
public <T extends Enum<T>> T getEnum(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are right. It differs a bit though in the sense that ConfigOption<Enum> is not possible. On the other hand there is getBytes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see... then I am ok with both actually.

} catch (final IllegalArgumentException | NullPointerException e) {
final String errorMessage = String.format("Value for config option %s must be one of %s (was %s)",
configOption.key(),
Arrays.asList(enumClass.getEnumConstants()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
Arrays.asList(enumClass.getEnumConstants()),
Arrays.toString(enumClass.getEnumConstants()),

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's better. Fixed it.

configuration.getAsEnum(TestEnum.class, validOption);
fail("Expected exception not thrown");
} catch (IllegalArgumentException e) {
final String expectedMessage = "Value for config option " +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Personally prefer the approach with @Rule

	@Rule
	public ExpectedException thrown = ExpectedException.none();

    @Test
     public testMethod() {
       ...
       thrown.expect(IllegalArgumentException.class);
       thrown.message(....);
      }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current solution is legible, and frequently used in Flink and elsewhere. I'll leave it as is.

true);
fail("Expected exception not thrown");
} catch (final IllegalArgumentException e) {
assertThat(e.getMessage(), containsString("cannot be set to DISABLED anymore"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: As before -> I prefer the @Rule approach.


final String configValue = getString(configOption);
try {
return T.valueOf(enumClass, configValue);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we call toUpperCase on configValue? At least for the scope of yarn.per-job-cluster.include-user-jar we tried to be case insensitive so far, which seems fair.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I added a test case for this.

@dawidwys
Copy link
Contributor

dawidwys commented Mar 5, 2019

@flinkbot approve-until architecture

@dawidwys
Copy link
Contributor

dawidwys commented Mar 5, 2019

@flinkbot approve all

+1 LGTM

GJL added a commit to GJL/flink that referenced this pull request Mar 5, 2019
…job-cluster.include-user-jar

Remove this feature because it is broken since Flink 1.5

This closes apache#7883.
GJL added a commit to GJL/flink that referenced this pull request Mar 5, 2019
…job-cluster.include-user-jar

Remove this feature because it is broken since Flink 1.5

This closes apache#7883.
@GJL
Copy link
Member Author

GJL commented Mar 5, 2019

Thanks for the review @dawidwys. Merging as soon as build is green.

GJL added a commit to GJL/flink that referenced this pull request Mar 5, 2019
…job-cluster.include-user-jar

Remove this feature because it is broken since Flink 1.5

This closes apache#7883.
GJL added 2 commits March 6, 2019 08:45
…job-cluster.include-user-jar

Remove this feature because it is broken since Flink 1.5

This closes apache#7883.
@asfgit asfgit merged commit 6f84008 into apache:master Mar 6, 2019
HuangZhenQiu pushed a commit to HuangZhenQiu/flink that referenced this pull request Apr 22, 2019
…job-cluster.include-user-jar

Remove this feature because it is broken since Flink 1.5

This closes apache#7883.
@GJL GJL deleted the FLINK-11781 branch September 3, 2019 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants