Skip to content

[SPARK-30387] Improving stop hook log message #27049

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

Closed
wants to merge 2 commits into from

Conversation

jobitmathew
Copy link
Contributor

What changes were proposed in this pull request?

ShutdownHook of YarnClientSchedulerBackend prints just "Stopped" which can be improved to "YarnClientSchedulerBackend Stopped" for better understanding.

Why are the changes needed?

While stopping or gracefully exiting the spark-shell/spark-sql --master yarn, only printing stopped is useless.

Does this PR introduce any user-facing change?

Yes. Log info message change.

How was this patch tested?

Manually

@@ -164,7 +164,7 @@ private[spark] class YarnClientSchedulerBackend(

super.stop()
client.stop()
logInfo("Stopped")
logInfo("YarnClientSchedulerBackend Stopped")
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't YarnClientSchedulerBackend added to full of log message, as in most case the format contains the logger name (mostly same as class name)?

Copy link
Contributor

Choose a reason for hiding this comment

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

Current log message is

2019-12-27 20:23:26,613 | INFO | [main] | Stopped | org.apache.spark.internal.Logging$class.logInfo(Logging.scala:54)

Copy link
Contributor

Choose a reason for hiding this comment

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

You must be using a custom logging file because by default you get:

19/12/31 10:47:28 INFO YarnClientSchedulerBackend: Stopped

Copy link
Contributor

Choose a reason for hiding this comment

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

Look at the spark conf/log4j.properties.template file for the format used there

Copy link
Member

Choose a reason for hiding this comment

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

If true, and I suspect you're right, is there much harm in just adding to the log message anyway?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also on other places we are using descriptive log message. Like,

ShutdownHookManager.addShutdownHook { () =>
logInfo("Shutting down shuffle service.")
server.stop()

Copy link
Contributor

Choose a reason for hiding this comment

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

no harm, I'm ok with the change, there may just be other places in the code that aren't clear without it so you may want to look at your logging config anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

Same as @tgravescs, I think log4j format matters, but agree no harm with this.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should necessarily add it.

because by default you get:

19/12/31 10:47:28 INFO YarnClientSchedulerBackend: Stopped

Also, by default, seems showing the logs fine. Otherwise, we should fix so many places as @tgravescs pointed out. If class names should be shown, that should properly configured for such places.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. as @tgravescs pointed out, here logs can be improved by changing log4j conversion pattern.

@srowen
Copy link
Member

srowen commented Dec 31, 2019

Jenkins test this please

@SparkQA
Copy link

SparkQA commented Dec 31, 2019

Test build #115993 has finished for PR 27049 at commit 9e71efe.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@@ -164,7 +164,7 @@ private[spark] class YarnClientSchedulerBackend(

super.stop()
client.stop()
logInfo("Stopped")
logInfo("YarnClientSchedulerBackend Stopped")
Copy link
Member

Choose a reason for hiding this comment

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

@amanomer, why don't you just make the log better just by not using class name directly like the reference you pointed out? e.g.) YARN client scheduler backend stopped.

Copy link
Contributor

Choose a reason for hiding this comment

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

@jobitmathew please update the log message.

Choose a reason for hiding this comment

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

@amanomer
@HyukjinKwon
@srowen
@tgravescs
changes done as per HyukjinKwon's suggestion.Could you please check.

@SparkQA
Copy link

SparkQA commented Jan 2, 2020

Test build #4981 has finished for PR 27049 at commit b6577cb.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@srowen srowen closed this in 1b0570c Jan 2, 2020
@srowen
Copy link
Member

srowen commented Jan 2, 2020

Merged to master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants