spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From susanxhuynh <...@git.apache.org>
Subject [GitHub] spark pull request #15740: [SPARK-18232] [Mesos] Support CNI
Date Fri, 04 Nov 2016 14:15:43 GMT
Github user susanxhuynh commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15740#discussion_r86553396
  
    --- Diff: mesos/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerBackendUtil.scala
---
    @@ -99,67 +99,55 @@ private[mesos] object MesosSchedulerBackendUtil extends Logging {
         .toList
       }
     
    -  /**
    -   * Construct a DockerInfo structure and insert it into a ContainerInfo
    -   */
    -  def addDockerInfo(
    -      container: ContainerInfo.Builder,
    -      image: String,
    -      containerizer: String,
    -      forcePullImage: Boolean = false,
    -      volumes: Option[List[Volume]] = None,
    -      portmaps: Option[List[ContainerInfo.DockerInfo.PortMapping]] = None): Unit = {
    +  def containerInfo(conf: SparkConf): ContainerInfo = {
    +    val containerType = if (conf.contains("spark.mesos.executor.docker.image") &&
    +      conf.get("spark.mesos.containerizer", "docker") == "docker") {
    +      ContainerInfo.Type.DOCKER
    +    } else {
    +      ContainerInfo.Type.MESOS
    +    }
    +
    +    val containerInfo = ContainerInfo.newBuilder()
    +      .setType(containerType)
    +
    +    conf.getOption("spark.mesos.executor.docker.image").map { image =>
    +      val forcePullImage = conf.getOption("spark.mesos.executor.docker.forcePullImage")
    +        .exists(_.equals("true"))
    +      if (containerType == ContainerInfo.Type.DOCKER) {
    +        containerInfo.setDocker(dockerInfo(image, forcePullImage))
    +      } else {
    +        containerInfo.setMesos(mesosInfo(image, forcePullImage))
    +      }
     
    -    containerizer match {
    -      case "docker" =>
    -        container.setType(ContainerInfo.Type.DOCKER)
    -        val docker = ContainerInfo.DockerInfo.newBuilder()
    -          .setImage(image)
    -          .setForcePullImage(forcePullImage)
    -        // TODO (mgummelt): Remove this. Portmaps have no effect,
    -        //                  as we don't support bridge networking.
    -        portmaps.foreach(_.foreach(docker.addPortMappings))
    -        container.setDocker(docker)
    -      case "mesos" =>
    -        container.setType(ContainerInfo.Type.MESOS)
    -        val imageProto = Image.newBuilder()
    -          .setType(Image.Type.DOCKER)
    -          .setDocker(Image.Docker.newBuilder().setName(image))
    -          .setCached(!forcePullImage)
    -        container.setMesos(ContainerInfo.MesosInfo.newBuilder().setImage(imageProto))
    -      case _ =>
    -        throw new SparkException(
    -          "spark.mesos.containerizer must be one of {\"docker\", \"mesos\"}")
    +      val volumes = conf
    +        .getOption("spark.mesos.executor.docker.volumes")
    +        .map(parseVolumesSpec)
    +
    +      volumes.foreach(_.foreach(containerInfo.addVolumes(_)))
    +    }
    +
    +    conf.getOption("spark.mesos.network.name").map { name =>
    +      val info = NetworkInfo.newBuilder().setName(name).build()
    +      containerInfo.addNetworkInfos(info)
         }
     
    -    volumes.foreach(_.foreach(container.addVolumes))
    +    containerInfo.build()
       }
     
    -  /**
    -   * Setup a docker containerizer from MesosDriverDescription scheduler properties
    -   */
    -  def setupContainerBuilderDockerInfo(
    -    imageName: String,
    -    conf: SparkConf,
    -    builder: ContainerInfo.Builder): Unit = {
    -    val forcePullImage = conf
    -      .getOption("spark.mesos.executor.docker.forcePullImage")
    -      .exists(_.equals("true"))
    -    val volumes = conf
    -      .getOption("spark.mesos.executor.docker.volumes")
    -      .map(parseVolumesSpec)
    -    val portmaps = conf
    -      .getOption("spark.mesos.executor.docker.portmaps")
    -      .map(parsePortMappingsSpec)
    --- End diff --
    
    Can you remove the parsePortMappingsSpec method now (defined above)?


---
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