You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/07/01 13:24:23 UTC

[GitHub] [spark] LantaoJin edited a comment on issue #24984: [SPARK-28183][CORE][UI] Add a task status filter for taskList in REST API

LantaoJin edited a comment on issue #24984: [SPARK-28183][CORE][UI] Add a task status filter for taskList in REST API
URL: https://github.com/apache/spark/pull/24984#issuecomment-507262506
 
 
   @vanzin I follow your comment https://github.com/apache/spark/pull/24982#issuecomment-506782293. But it doesn't work. Could you point me what did I miss?
   All code changes looks like here:
   ```scala
     def taskList(
         stageId: Int,
         stageAttemptId: Int,
         offset: Int,
         length: Int,
         sortBy: v1.TaskSorting,
         status: Option[String]): Seq[v1.TaskData] = {
       val (indexName, ascending) = sortBy match {
         case v1.TaskSorting.ID =>
           (None, true)
         case v1.TaskSorting.INCREASING_RUNTIME =>
           (Some(TaskIndexNames.EXEC_RUN_TIME), true)
         case v1.TaskSorting.DECREASING_RUNTIME =>
           (Some(TaskIndexNames.EXEC_RUN_TIME), false)
         case v1.TaskSorting.STATUS => // <=======add a new index for status
           (Some(TaskIndexNames.STATUS), true)
       }
       taskList(stageId, stageAttemptId, offset, length, indexName, ascending, status)
     }
   
     def taskList(
         stageId: Int,
         stageAttemptId: Int,
         offset: Int,
         length: Int,
         sortBy: Option[String],
         ascending: Boolean,
         status: Option[String] = None): Seq[v1.TaskData] = {
       val stageKey = Array(stageId, stageAttemptId)
       val base = store.view(classOf[TaskDataWrapper])
       val indexed = sortBy match {
         case Some(index) if status.isDefined =>
           // <================Only includes the matched status.
           base.index(status.get.toUpperCase(Locale.ROOT)).index(index).parent(stageKey)
         case Some(index) =>
           base.index(index).parent(stageKey)
         case _ =>
           // Sort by ID, which is the "stage" index.
           base.index("stage").first(stageKey).last(stageKey)
       }
   
       val ordered = if (ascending) indexed else indexed.reverse()
       val taskDataWrapperIter = ordered.skip(offset).max(length).asScala
       constructTaskDataList(taskDataWrapperIter)
     }
   ```
   
   Here is a simple test, there is always only one RUNNING task in local mode:
   ```scala
   val df = spark.range(10000).repartition(10000).toDF()
   val df2 = df.as("d1")
   val df2 = df.as("d2")
   df1.intersect(df2).show
   ```
   What I want is to query out this RUNNING task only via:
   http://localhost:4040/api/v1/applications/local-1561986606530/stages/3/0/taskList?offset=0&length=10&sortBy=status&status=RUNNING
   But the result still contains one RUNNING task and nine SUCCESS tasks.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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