Github user squito commented on a diff in the pull request:
https://github.com/apache/spark/pull/20474#discussion_r165379694
--- Diff:
core/src/main/scala/org/apache/spark/status/api/v1/OneApplicationResource.scala
---
@@ -51,6 +52,21 @@ private[v1] class AbstractApplicationResource extends
BaseAppResource {
@Path("executors")
def executorList(): Seq[ExecutorSummary] =
withUI(_.store.executorList(true))
+ @GET
+ @Path("executors/{executorId}/threads")
+ def threadDump(@PathParam("executorId") executorId: String):
+ Option[Array[ThreadStackTrace]] = withUI { ui =>
+ val safeExecutorId =
+ Option(UIUtils.stripXSS(executorId)).map { executorId =>
+ UIUtils.decodeURLParameter(executorId)
+ }.getOrElse {
+ throw new IllegalArgumentException(s"Missing executorId parameter")
+ }
+ ui.sc.flatMap { sc =>
+ sc.getExecutorThreadDump(safeExecutorId)
--- End diff --
what happens if you give a bad executor Id? Looks like you'll just return
an empty response, but I think an error might be more appropriate?
In fact would be nice if the error distinguished between a totally bogus
executorId vs. an executorId which is dead vs. calling this on the history
server, where its totally unavailable. Here's an example of that kind of error
handling for the opposite case, where the endpoint is *only* available on the
history server:
https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/status/api/v1/ApiRootResource.scala?utf8=%E2%9C%93#L90-L95
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]