spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JoshRosen <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-2313] Use socket to communicate Gateway...
Date Mon, 16 Feb 2015 00:23:01 GMT
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4603#discussion_r24728054
  
    --- Diff: core/src/main/scala/org/apache/spark/api/python/PythonGatewayServer.scala ---
    @@ -0,0 +1,59 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.api.python
    +
    +import java.io.DataOutputStream
    +import java.net.Socket
    +
    +import py4j.GatewayServer
    +
    +import org.apache.spark.Logging
    +import org.apache.spark.util.Utils
    +
    +/**
    + * Process that starts a Py4J GatewayServer on an ephemeral port and communicates the
bound port
    + * back to its caller via a callback port specified by the caller.
    + *
    + * This process is launched (via SparkSubmit) by the PySpark driver (see java_gateway.py).
    + */
    +private[spark] object PythonGatewayServer extends Logging {
    +  def main(args: Array[String]): Unit = Utils.tryOrExit {
    +    // Start a GatewayServer on an ephemeral port
    +    val gatewayServer: GatewayServer = new GatewayServer(null, 0)
    +    gatewayServer.start()
    +    val boundPort: Int = gatewayServer.getListeningPort
    --- End diff --
    
    I've added error-checking for this case.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message