-
Notifications
You must be signed in to change notification settings - Fork 28.7k
[SPARK-12399] Display correct error message when accessing REST API with an unknown app Id #10352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
val ui = appCache.get(appKey) | ||
Some(ui) | ||
} catch { | ||
case e: Exception => e.getCause() match { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case NonFatal(e)
Test build #47915 has finished for PR 10352 at commit
|
retest this please |
Test build #47971 has finished for PR 10352 at commit
|
retest this please |
Test build #47990 has finished for PR 10352 at commit
|
@@ -115,7 +117,17 @@ class HistoryServer( | |||
} | |||
|
|||
def getSparkUI(appKey: String): Option[SparkUI] = { | |||
Option(appCache.get(appKey)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it a better fix to do appCache.getIfPresent
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
appCache.getIfPresent
returns null if there is no cached value for the appKey. But appCache.get
will try to obtain that value from a CacheLoader
, cache it and return it. So I think we still need use appCache.get
here and handle the exception.
LGTM, merging to master and 1.6. Thanks! |
…ith an unknown app Id I got an exception when accessing the below REST API with an unknown application Id. `http://<server-url>:18080/api/v1/applications/xxx/jobs` Instead of an exception, I expect an error message "no such app: xxx" which is a similar error message when I access `/api/v1/applications/xxx` ``` org.spark-project.guava.util.concurrent.UncheckedExecutionException: java.util.NoSuchElementException: no app with key xxx at org.spark-project.guava.cache.LocalCache$Segment.get(LocalCache.java:2263) at org.spark-project.guava.cache.LocalCache.get(LocalCache.java:4000) at org.spark-project.guava.cache.LocalCache.getOrLoad(LocalCache.java:4004) at org.spark-project.guava.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4874) at org.apache.spark.deploy.history.HistoryServer.getSparkUI(HistoryServer.scala:116) at org.apache.spark.status.api.v1.UIRoot$class.withSparkUI(ApiRootResource.scala:226) at org.apache.spark.deploy.history.HistoryServer.withSparkUI(HistoryServer.scala:46) at org.apache.spark.status.api.v1.ApiRootResource.getJobs(ApiRootResource.scala:66) ``` Author: Carson Wang <[email protected]> Closes #10352 from carsonwang/unknownAppFix. (cherry picked from commit b244297) Signed-off-by: Marcelo Vanzin <[email protected]>
I got an exception when accessing the below REST API with an unknown application Id.
http://<server-url>:18080/api/v1/applications/xxx/jobs
Instead of an exception, I expect an error message "no such app: xxx" which is a similar error message when I access
/api/v1/applications/xxx