Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ private[spark] class ApplicationMaster(args: ApplicationMasterArguments) extends
@volatile private var finished = false
@volatile private var finalStatus = getDefaultFinalStatus
@volatile private var finalMsg: String = ""
private val finalMsgLimitSize = sparkConf.get(AM_FINAL_MSG_LIMIT).toInt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: move this to L165? just for code clean.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Better to just read the value at the point where it's needed, given there's only one use.

@volatile private var userClassThread: Thread = _

@volatile private var reporterThread: Thread = _
Expand Down Expand Up @@ -368,7 +369,11 @@ private[spark] class ApplicationMaster(args: ApplicationMasterArguments) extends
}
logInfo(s"Final app status: $finalStatus, exitCode: $exitCode" +
Option(msg).map(msg => s", (reason: $msg)").getOrElse(""))
finalMsg = msg
finalMsg = if (msg == null || msg.length <= finalMsgLimitSize) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

StringUtils.abbreviate seems simpler.

Copy link
Copy Markdown
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, thanks

msg
} else {
msg.substring(0, finalMsgLimitSize)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe the message in last finalMsgLimitSize is more useful.

}
finished = true
if (!inShutdown && Thread.currentThread() != reporterThread && reporterThread != null) {
logDebug("shutting down reporter thread")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ package object config {
.toSequence
.createWithDefault(Nil)

private[spark] val AM_FINAL_MSG_LIMIT = ConfigBuilder("spark.yarn.am.finalMessageLimit")
.doc("The limit size of final diagnostic message for our ApplicationMaster to unregister from" +
" the ResourceManager.")
.bytesConf(ByteUnit.BYTE)
.createWithDefaultString("1m")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry for leaving a comment late, and nitpicking but shouldn't we better leave this unlimited by default?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

in https://issues.apache.org/jira/browse/YARN-6125 yarn.app.attempt.diagnostics.limit.kc 's default value is 64K. I guess 1m here is enough


/* Client-mode AM configuration. */

private[spark] val AM_CORES = ConfigBuilder("spark.yarn.am.cores")
Expand Down