-
Notifications
You must be signed in to change notification settings - Fork 2
[SPARK-6980] [CORE] [WIP] Creating wrapper for Akka timeout exceptions to get better information using conf (RPC Layer) #2
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -264,9 +264,15 @@ object RpcTimeout { | |
| require(timeoutPropList.nonEmpty) | ||
|
|
||
| // Find the first set property or use the default value with the first property | ||
| val foundProp = timeoutPropList.view.map(x => (x, conf.getOption(x))).filter(_._2.isDefined). | ||
| map(y => (y._1, y._2.get)).headOption.getOrElse(timeoutPropList.head, defaultValue) | ||
|
|
||
| val itr = timeoutPropList.iterator | ||
| var foundProp = (timeoutPropList.head,defaultValue) | ||
| while (itr.hasNext && (foundProp == (timeoutPropList.head,defaultValue))){ | ||
| val propKey = itr.next() | ||
| conf.getOption(propKey) match { | ||
| case Some(prop) => foundProp = (propKey,prop) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this logic is a little different than the original -- it'll take the last set property, rather than the first.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for noticing @squito . Made the changes accordingly. :) |
||
| case None => | ||
| } | ||
| } | ||
| val timeout = { Utils.timeStringAsSeconds(foundProp._2) seconds } | ||
| new RpcTimeout(timeout, messagePrefix + foundProp._1) | ||
| } | ||
|
|
||
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.
@hardmettle not to nitpick, this should work fine, but comparing tuples of strings to check if it's found yet seems a little unnecessary. What do you think about just defining a Boolean and mark it as true once the property is found, then stop the loop?
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.
I have got no issues with that. I was anyways not convinced with the idea of using a "var" and an idiomatic way to loop . I thought of keeping it as little messy as I could by avoiding another boolean variable.What do you think @BryanCutler & @squito ?
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.
It's up to you. For me, I think the loop might be a little cleaner by using an Option like this:
Then get the final result with
foundProp.getOrElse(timeoutPropList.head, defaultValue). It's probably not a big deal so if you prefer the way it is now, I can merge that.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.
@BryanCutler Thank you for the suggestion , made the changes the way you described.