File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
main/scala/org/apache/spark/scheduler
test/scala/org/apache/spark/scheduler Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -64,18 +64,21 @@ private[spark] object TaskLocation {
6464
6565 /**
6666 * Create a TaskLocation from a string returned by getPreferredLocations.
67- * These strings have the form [executorLocationTag][ hostname][executorid], [hostname], or
67+ * These strings have the form executor_[ hostname]_ [executorid], [hostname], or
6868 * hdfs_cache_[hostname], depending on whether the location is cached.
6969 */
7070 def apply (str : String ): TaskLocation = {
7171 val hstr = str.stripPrefix(inMemoryLocationTag)
7272 if (hstr.equals(str)) {
7373 if (str.startsWith(executorLocationTag)) {
74- val splits = str.split(" _" , 3 )
75- if (splits.length != 3 ) {
74+ val hostAndExecutorId = str.stripPrefix(executorLocationTag)
75+ val splits = hostAndExecutorId.split(" _" , 2 )
76+ if (splits.length != 2 ) {
7677 throw new IllegalArgumentException (" Illegal executor location format: " + str)
7778 }
78- new ExecutorCacheTaskLocation (splits(1 ), splits(2 ))
79+ val host = splits(0 )
80+ val executorId = splits(1 )
81+ new ExecutorCacheTaskLocation (host, executorId)
7982 } else {
8083 new HostTaskLocation (str)
8184 }
Original file line number Diff line number Diff line change @@ -789,6 +789,8 @@ class TaskSetManagerSuite extends SparkFunSuite with LocalSparkContext with Logg
789789 assert(TaskLocation (" host1" ) === HostTaskLocation (" host1" ))
790790 assert(TaskLocation (" hdfs_cache_host1" ) === HDFSCacheTaskLocation (" host1" ))
791791 assert(TaskLocation (" executor_host1_3" ) === ExecutorCacheTaskLocation (" host1" , " 3" ))
792+ assert(TaskLocation (" executor_some.host1_executor_task_3" ) ===
793+ ExecutorCacheTaskLocation (" some.host1" , " executor_task_3" ))
792794 }
793795
794796 test(" Kill other task attempts when one attempt belonging to the same task succeeds" ) {
You can’t perform that action at this time.
0 commit comments