зеркало из https://github.com/microsoft/spark.git
Make LocalSparkCluster use distinct IPs
This commit is contained in:
Родитель
a2a94fdbc7
Коммит
7a033fd795
|
@ -35,11 +35,15 @@ class LocalSparkCluster(numSlaves: Int, coresPerSlave: Int, memoryPerSlave: Int)
|
|||
|
||||
/* Start the Slaves */
|
||||
for (slaveNum <- 1 to numSlaves) {
|
||||
/* We can pretend to test distributed stuff by giving the slaves distinct hostnames.
|
||||
All of 127/8 should be a loopback, we use 127.100.*.* in hopes that it is
|
||||
sufficiently distinctive. */
|
||||
val slaveIpAddress = "127.100.0." + (slaveNum % 256)
|
||||
val (actorSystem, boundPort) =
|
||||
AkkaUtils.createActorSystem("sparkWorker" + slaveNum, localIpAddress, 0)
|
||||
AkkaUtils.createActorSystem("sparkWorker" + slaveNum, slaveIpAddress, 0)
|
||||
slaveActorSystems += actorSystem
|
||||
val actor = actorSystem.actorOf(
|
||||
Props(new Worker(localIpAddress, boundPort, 0, coresPerSlave, memoryPerSlave, masterUrl)),
|
||||
Props(new Worker(slaveIpAddress, boundPort, 0, coresPerSlave, memoryPerSlave, masterUrl)),
|
||||
name = "Worker")
|
||||
slaveActors += actor
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче