Github user tnachen commented on a diff in the pull request:
https://github.com/apache/spark/pull/11157#discussion_r55104599
--- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
@@ -1940,57 +1940,131 @@ private[spark] object Utils extends Logging {
}
/**
- * Attempt to start a service on the given port, or fail after a number
of attempts.
- * Each subsequent attempt uses 1 + the port used in the previous
attempt (unless the port is 0).
- *
- * @param startPort The initial port to start the service on.
- * @param startService Function to start service on a given port.
- * This is expected to throw java.net.BindException
on port collision.
- * @param conf A SparkConf used to get the maximum number of retries
when binding to a port.
- * @param serviceName Name of the service.
- * @return (service: T, port: Int)
- */
+ * Attempt to start a service on the given port, or fail after a number
of attempts.
+ * Each subsequent attempt uses 1 + the port used in the previous
attempt (unless the port is 0).
+ * It takes into consideration port restrictions through the env var
AVAILABLE_PORTS
+ *
+ * @param startPort The initial port to start the service on.
+ * @param startService Function to start service on a given port.
+ * This is expected to throw java.net.BindException
on port collision.
+ * @param conf A SparkConf used to get the maximum number of retries
when binding to a port.
+ * @param serviceName Name of the service.
+ * @return (service: T, port: Int)
+ */
def startServiceOnPort[T](
- startPort: Int,
- startService: Int => (T, Int),
- conf: SparkConf,
- serviceName: String = ""): (T, Int) = {
+ startPort: Int,
--- End diff --
Fix indentation
---
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]