org.apache.spark.network.TransportContext Scala Examples
The following examples show how to use org.apache.spark.network.TransportContext.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
Example 1
Source File: ExternalShuffleService.scala From drizzle-spark with Apache License 2.0 | 5 votes |
package org.apache.spark.deploy import java.util.concurrent.CountDownLatch import scala.collection.JavaConverters._ import org.apache.spark.{SecurityManager, SparkConf} import org.apache.spark.internal.Logging import org.apache.spark.metrics.MetricsSystem import org.apache.spark.network.TransportContext import org.apache.spark.network.netty.SparkTransportConf import org.apache.spark.network.sasl.SaslServerBootstrap import org.apache.spark.network.server.{TransportServer, TransportServerBootstrap} import org.apache.spark.network.shuffle.ExternalShuffleBlockHandler import org.apache.spark.network.util.TransportConf import org.apache.spark.util.{ShutdownHookManager, Utils} private[spark] def main( args: Array[String], newShuffleService: (SparkConf, SecurityManager) => ExternalShuffleService): Unit = { Utils.initDaemon(log) val sparkConf = new SparkConf Utils.loadDefaultSparkProperties(sparkConf) val securityManager = new SecurityManager(sparkConf) // we override this value since this service is started from the command line // and we assume the user really wants it to be running sparkConf.set("spark.shuffle.service.enabled", "true") server = newShuffleService(sparkConf, securityManager) server.start() logDebug("Adding shutdown hook") // force eager creation of logger ShutdownHookManager.addShutdownHook { () => logInfo("Shutting down shuffle service.") server.stop() barrier.countDown() } // keep running until the process is terminated barrier.await() } }
Example 2
Source File: StandaloneWorkerShuffleService.scala From SparkCore with Apache License 2.0 | 5 votes |
package org.apache.spark.deploy.worker import org.apache.spark.{Logging, SparkConf, SecurityManager} import org.apache.spark.network.TransportContext import org.apache.spark.network.netty.SparkTransportConf import org.apache.spark.network.sasl.SaslRpcHandler import org.apache.spark.network.server.TransportServer import org.apache.spark.network.shuffle.ExternalShuffleBlockHandler def startIfEnabled() { if (enabled) { require(server == null, "Shuffle server already started") logInfo(s"Starting shuffle service on port $port with useSasl = $useSasl") server = transportContext.createServer(port) } } def stop() { if (enabled && server != null) { server.close() server = null } } }
Example 3
Source File: ExternalShuffleService.scala From iolap with Apache License 2.0 | 5 votes |
package org.apache.spark.deploy import java.util.concurrent.CountDownLatch import scala.collection.JavaConversions._ import org.apache.spark.{Logging, SparkConf, SecurityManager} import org.apache.spark.network.TransportContext import org.apache.spark.network.netty.SparkTransportConf import org.apache.spark.network.sasl.SaslServerBootstrap import org.apache.spark.network.server.TransportServer import org.apache.spark.network.shuffle.ExternalShuffleBlockHandler import org.apache.spark.util.Utils object ExternalShuffleService extends Logging { @volatile private var server: ExternalShuffleService = _ private val barrier = new CountDownLatch(1) def main(args: Array[String]): Unit = { val sparkConf = new SparkConf Utils.loadDefaultSparkProperties(sparkConf) val securityManager = new SecurityManager(sparkConf) // we override this value since this service is started from the command line // and we assume the user really wants it to be running sparkConf.set("spark.shuffle.service.enabled", "true") server = new ExternalShuffleService(sparkConf, securityManager) server.start() installShutdownHook() // keep running until the process is terminated barrier.await() } private def installShutdownHook(): Unit = { Runtime.getRuntime.addShutdownHook(new Thread("External Shuffle Service shutdown thread") { override def run() { logInfo("Shutting down shuffle service.") server.stop() barrier.countDown() } }) } }