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-17819][yarn] Fix error msg for yarn deployments when hadoop not in classpath #12317

Closed
wants to merge 3 commits into from

Conversation

kl0u
Copy link
Contributor

@kl0u kl0u commented May 25, 2020

What is the purpose of the change

This PR simply changes the error message presented to the user when he/she is trying to submit to Yarn but hadoop is not in the classpath. The new message will be:

No Executor found. Please make sure to have hadoop in your classpath. For more information on how to do so refer to the "Deployment & Operations" section of the official Apache Flink documentation.

Brief change log

The changes are:

  1. a FallbackYarnSessionCli that will be loaded by the CliFrontend in case there is a loading error when the frontend tries to load the actual FlinkYarnSessionCli. This cli will simply throw an exception with the above message when it detects that the FlinkYarnSessionCli would be used but it failed to be loaded (the isActive method).
  2. change of the error message in the YarnJobClusterExecutorFactory and the YarnSessionClusterExecutorFactory when the executor cannot be instantiated. This is to cover for the case where the user tries to access a Yarn cluster through the ExecutorCLI.

Verifying this change

Was verified manually and also added the FallbackYarnSessionCliTest.

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, Kubernetes/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)

@kl0u kl0u requested a review from aljoscha May 25, 2020 08:29
@flinkbot
Copy link
Collaborator

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 284e50d (Mon May 25 08:32:42 UTC 2020)

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


throw new IllegalStateException(
"No valid command-line found. If you were targeting a Yarn cluster, please make sure to have " +
"hadoop in your classpath. For more information refer to the \"Deployment & Operations\" section " +
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"hadoop in your classpath. For more information refer to the \"Deployment & Operations\" section " +
"Hadoop in your classpath. For more information refer to the \"Deployment & Operations\" section " +

maybe also say sth aboutHADOOP_CLASSPATH 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.

Actually this is wrong now because we load the FallbackYarnSessionCLI so if we reach here, it is not simply because of the classpath.

throw new IllegalStateException(
"No ClusterClientFactory found to execute the application." +
" If you were targeting a Yarn cluster, please make sure to have " +
"hadoop in your classpath. For more information refer to the " +
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"hadoop in your classpath. For more information refer to the " +
"Hadoop in your classpath. For more information refer to the " +

same as above, also mention HADOOP_CLASSPATH

@flinkbot
Copy link
Collaborator

flinkbot commented May 25, 2020

CI report:

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

@kl0u
Copy link
Contributor Author

kl0u commented May 25, 2020

Thanks for the comments @aljoscha. I updated the PR accordingly. Let me know what you think.

Copy link
Contributor

@wangyang0918 wangyang0918 left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this PR. It will help our users a lot when the hadoop is not correctly configured.

For yarn-session.sh, it has the same problem. But the exception is easier to understand. Maybe it is already enough.

wangyang-pc:build-target danrtsey.wy$ ./bin/yarn-session.sh
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/yarn/exceptions/YarnException
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
	at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
	at java.lang.Class.getMethod0(Class.java:3018)
	at java.lang.Class.getMethod(Class.java:1784)
	at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.yarn.exceptions.YarnException
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 7 more

return false;
}

private boolean originalIsActive(CommandLine commandLine) {
Copy link
Contributor

Choose a reason for hiding this comment

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

So we are intentional to ignore the Yarn properties file here. Right?

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, the reason is that:

  1. we would have to copy more code
  2. I would assume that if we have the properties (hidden) file, it means that we created the Yarn cluster using the session CLI, so we already have hadoop in the classpath.

(In fact the solution here is already fragile, as whoever touches the isActive() should know to keep both methods in sync)

Do you agree @wangyang0918 ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, i agree with you that we do not need to add the logics for Yarn magic properties file here.

@wangyang0918
Copy link
Contributor

The changes looks really good to me. +1 for merging.

@kl0u kl0u closed this in c8ab94f May 28, 2020
kl0u added a commit that referenced this pull request May 28, 2020
kl0u added a commit to kl0u/flink that referenced this pull request May 28, 2020
zhangjun0x01 pushed a commit to zhangjun0x01/flink that referenced this pull request Jul 8, 2020
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.

5 participants