-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-16148] [Scheduler] Allow for underscores in TaskLocation in the Executor ID #13858
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 all commits
c0b108b
c2f0a2c
0aed80a
ee4708d
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 |
|---|---|---|
|
|
@@ -64,18 +64,18 @@ private[spark] object TaskLocation { | |
|
|
||
| /** | ||
| * Create a TaskLocation from a string returned by getPreferredLocations. | ||
| * These strings have the form [hostname] or hdfs_cache_[hostname], depending on whether the | ||
| * location is cached. | ||
| * These strings have the form executor_[hostname]_[executorid], [hostname], or | ||
| * hdfs_cache_[hostname], depending on whether the location is cached. | ||
| */ | ||
| def apply(str: String): TaskLocation = { | ||
| val hstr = str.stripPrefix(inMemoryLocationTag) | ||
| if (hstr.equals(str)) { | ||
| if (str.startsWith(executorLocationTag)) { | ||
| val splits = str.split("_") | ||
| if (splits.length != 3) { | ||
| throw new IllegalArgumentException("Illegal executor location format: " + str) | ||
| } | ||
| new ExecutorCacheTaskLocation(splits(1), splits(2)) | ||
| val hostAndExecutorId = str.stripPrefix(executorLocationTag) | ||
| val splits = hostAndExecutorId.split("_", 2) | ||
| require(splits.length == 2, "Illegal executor location format: " + str) | ||
|
Member
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. You can use string interpolation here but not worth changing if that's the only thing left |
||
| val Array(host, executorId) = splits | ||
|
Contributor
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. it's usually better to just do splits(0) and splits(1) rather than using pattern matching here. |
||
| new ExecutorCacheTaskLocation(host, executorId) | ||
| } else { | ||
| new HostTaskLocation(str) | ||
| } | ||
|
|
||
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.
Not related to your change, but this method could be further clarified, like by just checking upfront whether the string starts with inMemoryLocationTag and returning that case straight away. Not required here. The logic looks sound now that the comments are updated.