-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from petro-rudenko/spark-3.0-support_2
[CORE] Spark-3.0 mapper writer plugin implementation.
- Loading branch information
Showing
3 changed files
with
106 additions
and
5 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
src/main/scala/org/apache/spark/shuffle/compat/spark_3_0/UcxLocalDiskShuffleDataIO.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright (C) Mellanox Technologies Ltd. 2020. ALL RIGHTS RESERVED. | ||
* See file LICENSE for terms. | ||
*/ | ||
package org.apache.spark.shuffle.compat.spark_3_0 | ||
|
||
import org.apache.spark.SparkConf | ||
import org.apache.spark.internal.Logging | ||
import org.apache.spark.shuffle.api.ShuffleExecutorComponents | ||
import org.apache.spark.shuffle.sort.io.LocalDiskShuffleDataIO | ||
|
||
/** | ||
* Ucx local disk IO plugin to handle logic of writing to local disk and shuffle memory registration. | ||
*/ | ||
case class UcxLocalDiskShuffleDataIO(sparkConf: SparkConf) extends LocalDiskShuffleDataIO(sparkConf) with Logging { | ||
|
||
override def executor(): ShuffleExecutorComponents = { | ||
new UcxLocalDiskShuffleExecutorComponents(sparkConf) | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...ala/org/apache/spark/shuffle/compat/spark_3_0/UcxLocalDiskShuffleExecutorComponents.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (C) Mellanox Technologies Ltd. 2020. ALL RIGHTS RESERVED. | ||
* See file LICENSE for terms. | ||
*/ | ||
package org.apache.spark.shuffle.compat.spark_3_0 | ||
|
||
import java.util | ||
import java.util.Optional | ||
|
||
import org.apache.spark.internal.Logging | ||
import org.apache.spark.{SparkConf, SparkEnv} | ||
import org.apache.spark.shuffle.sort.io.{LocalDiskShuffleExecutorComponents, LocalDiskShuffleMapOutputWriter, LocalDiskSingleSpillMapOutputWriter} | ||
import org.apache.spark.shuffle.UcxShuffleManager | ||
import org.apache.spark.shuffle.api.{ShuffleMapOutputWriter, SingleSpillShuffleMapOutputWriter} | ||
|
||
/** | ||
* Entry point to UCX executor. | ||
*/ | ||
class UcxLocalDiskShuffleExecutorComponents(sparkConf: SparkConf) | ||
extends LocalDiskShuffleExecutorComponents(sparkConf) with Logging{ | ||
|
||
private var blockResolver: UcxShuffleBlockResolver = _ | ||
|
||
override def initializeExecutor(appId: String, execId: String, extraConfigs: util.Map[String, String]): Unit = { | ||
val ucxShuffleManager = SparkEnv.get.shuffleManager.asInstanceOf[UcxShuffleManager] | ||
ucxShuffleManager.startUcxNodeIfMissing() | ||
blockResolver = ucxShuffleManager.shuffleBlockResolver | ||
} | ||
|
||
override def createMapOutputWriter(shuffleId: Int, mapTaskId: Long, numPartitions: Int): ShuffleMapOutputWriter = { | ||
if (blockResolver == null) { | ||
throw new IllegalStateException( | ||
"Executor components must be initialized before getting writers.") | ||
} | ||
new LocalDiskShuffleMapOutputWriter( | ||
shuffleId, mapTaskId, numPartitions, blockResolver, sparkConf) | ||
} | ||
|
||
override def createSingleFileMapOutputWriter(shuffleId: Int, mapId: Long): Optional[SingleSpillShuffleMapOutputWriter] = { | ||
if (blockResolver == null) { | ||
throw new IllegalStateException( | ||
"Executor components must be initialized before getting writers.") | ||
} | ||
Optional.of(new LocalDiskSingleSpillMapOutputWriter(shuffleId, mapId, blockResolver)) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters