dongjoon-hyun opened a new pull request, #58287:
URL: https://github.com/apache/spark/pull/58287
### What changes were proposed in this pull request?
This PR makes the private helper `checkAndGetSparkContext()` in
`AbstractApplicationResource`
take the name of the feature requesting the live `SparkContext`:
```scala
private def checkAndGetSparkContext(feature: String): SparkContext = withUI
{ ui =>
ui.sc.getOrElse {
throw new ServiceUnavailable(s"$feature not available through the
history server.")
}
}
```
Both call sites, `threadDump` and `getTaskThreadDump`, pass `"Thread dumps"`.
### Why are the changes needed?
The helper hardcoded `"Thread dumps"` in its message, so only the two
thread-dump endpoints
could use it. Any other live-only endpoint needing the live `SparkContext`
had to inline its own
`ui.sc.getOrElse { throw new ServiceUnavailable(...) }` just to get a
correct message. Passing the
feature name keeps the shared `"... not available through the history
server."` wording in one place.
### Does this PR introduce _any_ user-facing change?
No. The existing error messages are unchanged.
### How was this patch tested?
Pass the CIs with the existing tests, including `UISeleniumSuite`, which
exercises the
thread-dump REST endpoint.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 5
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]