Github user squito commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20474#discussion_r167917613
  
    --- Diff: 
core/src/main/scala/org/apache/spark/status/api/v1/OneApplicationResource.scala 
---
    @@ -51,6 +51,29 @@ 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") execId: String): 
Array[ThreadStackTrace] = withUI { ui =>
    +    if (execId != SparkContext.DRIVER_IDENTIFIER && 
!execId.forall(Character.isDigit)) {
    +      throw new BadParameterException(
    +        s"Invalid executorId: neither '${SparkContext.DRIVER_IDENTIFIER}' 
nor number.")
    +    }
    +
    +    val safeSparkContext = ui.sc.getOrElse {
    +      throw new ServiceUnavailable("Thread dumps not available through the 
history server.")
    +    }
    +
    +    ui.store.asOption(ui.store.executorSummary(execId)) match {
    +      case Some(executorSummary) if executorSummary.isActive =>
    +          val safeThreadDump = 
safeSparkContext.getExecutorThreadDump(execId).getOrElse {
    +            throw new NotFoundException("No thread dump is available.")
    +          }
    +          return safeThreadDump
    --- End diff --
    
    you don't need `return` here


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to