Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9530#discussion_r44361246
  
    --- Diff: core/src/main/scala/org/apache/spark/rpc/netty/NettyRpcEnv.scala 
---
    @@ -302,6 +325,138 @@ private[netty] class NettyRpcEnv(
         }
       }
     
    +  override def fileServer: RpcEnvFileServer = streamManager
    +
    +  override def openChannel(uri: String): ReadableByteChannel = {
    +    val parsedUri = new URI(uri)
    +    require(parsedUri.getHost() != null, "Host name must be defined.")
    +    require(parsedUri.getPort() > 0, "Port must be defined.")
    +    require(parsedUri.getPath() != null && parsedUri.getPath().nonEmpty, 
"Path must be defined.")
    +
    +    val pipe = Pipe.open()
    +    val source = new FileDownloadChannel(pipe.source())
    +    try {
    +      val client = fileDownloadClient(parsedUri.getHost(), 
parsedUri.getPort())
    +      val callback = new FileDownloadCallback(pipe.sink(), source, client)
    +      client.stream(parsedUri.getPath(), callback)
    +    } catch {
    +      case e: Exception =>
    +        pipe.sink().close()
    +        source.close()
    +        throw e
    +    }
    +
    +    source
    +  }
    +
    +  private def fileDownloadClient(host: String, port: Int): TransportClient 
= synchronized {
    --- End diff --
    
    Downloading from different hosts mean different clients. But different 
tasks will still all download from the same host (the driver).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to