srowen commented on a change in pull request #31204:
URL: https://github.com/apache/spark/pull/31204#discussion_r604203453
##########
File path:
core/src/main/scala/org/apache/spark/status/api/v1/StagesResource.scala
##########
@@ -28,8 +31,33 @@ import org.apache.spark.util.Utils
private[v1] class StagesResource extends BaseAppResource {
@GET
- def stageList(@QueryParam("status") statuses: JList[StageStatus]):
Seq[StageData] = {
- withUI(_.store.stageList(statuses))
+ def stageList(
+ @QueryParam("status") statuses: JList[StageStatus],
+ @QueryParam("details") @DefaultValue("false") details: Boolean,
+ @QueryParam("withSummaries") @DefaultValue("false") withSummaries:
Boolean,
+ @QueryParam("quantiles") @DefaultValue("0.0,0.25,0.5,0.75,1.0")
quantileString: String,
+ @QueryParam("taskStatus") taskStatus: JList[TaskStatus])
+ : Seq[StageData] = {
Review comment:
Nit: pull this onto the previous line.
##########
File path:
core/src/main/scala/org/apache/spark/status/api/v1/StagesResource.scala
##########
@@ -28,17 +31,50 @@ import org.apache.spark.util.Utils
private[v1] class StagesResource extends BaseAppResource {
@GET
- def stageList(@QueryParam("status") statuses: JList[StageStatus]):
Seq[StageData] = {
- withUI(_.store.stageList(statuses))
+ def stageList(
+ @QueryParam("status") statuses: JList[StageStatus],
+ @QueryParam("details") @DefaultValue("false") details: Boolean,
+ @QueryParam("withSummaries") @DefaultValue("false") withSummaries:
Boolean,
+ @QueryParam("quantiles") @DefaultValue("0.0,0.25,0.5,0.75,1.0")
quantileString: String,
+ @QueryParam("taskStatus") taskStatus: JList[TaskStatus])
+ : Seq[StageData] = {
+ withUI {
+ val quantiles = quantileString.split(",").map { s =>
+ try {
+ s.toDouble
+ } catch {
+ case nfe: NumberFormatException =>
+ throw new BadParameterException("quantiles", "double", s)
+ }
+ }
+ ui => {
+ ui.store.stageList(statuses, details, withSummaries,
Option(quantiles), taskStatus)
+ .filter { stage =>
+ if (details) {
+ taskStatus.asScala.exists {
+ case FAILED => stage.numFailedTasks > 0
+ case KILLED => stage.numKilledTasks > 0
+ case RUNNING => stage.numActiveTasks > 0
+ case SUCCESS => stage.numCompleteTasks > 0
+ case UNKNOWN => stage.numTasks - stage.numFailedTasks -
stage.numKilledTasks -
+ stage.numActiveTasks - stage.numCompleteTasks > 0
+ }
+ } else {
+ true
+ }
+ }
+ }
+ }
}
Review comment:
Do we still need a simple test here?
##########
File path: docs/monitoring.md
##########
@@ -473,6 +473,10 @@ can be identified by their `[attempt-id]`. In the API
listed below, when running
<td>
A list of all stages for a given application.
<br><code>?status=[active|complete|pending|failed]</code> list only
stages in the state.
+ <br><code>?details=true</code> lists stages with the task data.
Review comment:
Just checking, these docs are now up to date given the PRs that have
been merged?
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]