AngersZhuuuu opened a new pull request #33457:
URL: https://github.com/apache/spark/pull/33457


   ### What changes were proposed in this pull request?
   When we use prometheus to fetch metrics, always pull data before application 
started.
   
   Then throw a lot of exception not of NoSuchElementException
   ```
   21/07/19 04:53:37 INFO Client: Preparing resources for our AM container
   21/07/19 04:53:37 INFO Client: Uploading resource 
hdfs://tl3/packages/jars/spark-2.4-archive.tar.gz -> 
hdfs://R2/user/xiaoke.zhou/.sparkStaging/application_1624456325569_7143920/spark-2.4-archive.tar.gz
   21/07/19 04:53:37 WARN JettyUtils: GET /jobs/ failed: 
java.util.NoSuchElementException: Failed to get the application information. If 
you are starting up Spark, please wait a while until it's ready.
   java.util.NoSuchElementException: Failed to get the application information. 
If you are starting up Spark, please wait a while until it's ready.
        at 
org.apache.spark.status.AppStatusStore.applicationInfo(AppStatusStore.scala:43)
        at org.apache.spark.ui.jobs.AllJobsPage.render(AllJobsPage.scala:275)
        at org.apache.spark.ui.WebUI$$anonfun$2.apply(WebUI.scala:90)
        at org.apache.spark.ui.WebUI$$anonfun$2.apply(WebUI.scala:90)
        at org.apache.spark.ui.JettyUtils$$anon$3.doGet(JettyUtils.scala:90)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at 
org.spark_project.jetty.servlet.ServletHolder.handle(ServletHolder.java:848)
        at 
org.spark_project.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
        at 
org.spark_project.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
        at 
org.spark_project.jetty.servlet.ServletHandler.doScope(ServletHandler.java:513)
        at 
org.spark_project.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
        at 
org.spark_project.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
        at 
org.spark_project.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:493)
        at 
org.spark_project.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
        at 
org.spark_project.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
        at org.spark_project.jetty.server.Server.handle(Server.java:539)
        at org.spark_project.jetty.server.HttpChannel.handle(Htt
   [2021-07-19 04:54:55,111] INFO - pChannel.java:333)
        at 
org.spark_project.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
        at 
org.spark_project.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
        at 
org.spark_project.jetty.io.FillInterest.fillable(FillInterest.java:108)
        at 
org.spark_project.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
        at 
org.spark_project.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
        at 
org.spark_project.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
        at 
org.spark_project.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
        at 
org.spark_project.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
        at 
org.spark_project.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
        at java.lang.Thread.run(Thread.java:748)
   ```
   
   Have check origin pr, we need to start server and bind port before 
taskScheduler started for client mode since we need to pass web url to register 
application master. But when we attach and start handler this time, we can 
provide restful API to user, but during this time, application is not started 
so we always return such error.
   
   We should expose restful after we started applications.
   
   ### Why are the changes needed?
   Improve the SparkUI start logical
   
   
   ### Does this PR introduce _any_ user-facing change?
   Spark will expose restful API only when application started
   
   ### How was this patch tested?
   Existed


-- 
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]

Reply via email to