You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by tnachen <gi...@git.apache.org> on 2015/03/10 08:33:40 UTC

[GitHub] spark pull request: Add mesos role, principal and secret

GitHub user tnachen opened a pull request:

    https://github.com/apache/spark/pull/4960

    Add mesos role, principal and secret

    Mesos supports framework authentication and role to be set per framework, which the role is used to identify the framework's role which impacts the sharing weight of resource allocation and optional authentication information to allow the framework to be connected to the master.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/tnachen/spark mesos_fw_auth

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/4960.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #4960
    
----
commit 99c3a85148ad5d1fc24ba07a060a2852d2d01e26
Author: Timothy Chen <tn...@gmail.com>
Date:   2015-02-23T17:18:46Z

    Add mesos role, auth and secret.

----


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by tnachen <gi...@git.apache.org>.
Github user tnachen commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-142057737
  
    Hi @ohal, you'll need to set spark.mesos.role when you launch the
    dispatcher, which you can do so by setting the spark-defaults.conf in the
    conf dir and it will automaitcally be loaded when you run the dispatcher.
    
    On Mon, Sep 21, 2015 at 10:44 AM, Oleh Halenok <no...@github.com>
    wrote:
    
    > also, it looks like dispatcher does not receive resource offers other then
    > *"*"* role:
    >
    > 15/09/21 17:40:54 TRACE MesosClusterScheduler: Received offers from Mesos:
    > Offer id: 20150911-070321-538888970-5050-1632-O282247, cpu: 8.0, mem: 14863.0
    > Offer id: 20150911-070321-538888970-5050-1632-O282248, cpu: 8.0, mem: 14863.0
    > Offer id: 20150911-070321-538888970-5050-1632-O282249, cpu: 8.0, mem: 14863.0
    >
    > —
    > Reply to this email directly or view it on GitHub
    > <https://github.com/apache/spark/pull/4960#issuecomment-142055958>.
    >



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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-84575878
  
    **[Test build #28958 timed out](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/28958/consoleFull)**     for PR 4960 at commit [`a5d3e8d`](https://github.com/apache/spark/commit/a5d3e8d7fbe640f6b0da5632adeef8102ed36119)     after a configured wait of `120m`.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-84548578
  
      [Test build #28958 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/28958/consoleFull) for   PR 4960 at commit [`a5d3e8d`](https://github.com/apache/spark/commit/a5d3e8d7fbe640f6b0da5632adeef8102ed36119).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [MESOS] Add mesos role, principal and secret

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-78016340
  
      [Test build #28424 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/28424/consoleFull) for   PR 4960 at commit [`99c3a85`](https://github.com/apache/spark/commit/99c3a85148ad5d1fc24ba07a060a2852d2d01e26).
     * This patch **passes all tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r27087566
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerUtils.scala ---
    @@ -0,0 +1,116 @@
    +/*
    + * 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.scheduler.cluster.mesos
    +
    +import java.util.List
    +
    +import scala.collection.JavaConversions._
    +import scala.collection.mutable.ArrayBuffer
    +
    +import org.apache.mesos.Protos._
    +import org.apache.mesos.{Scheduler, MesosSchedulerDriver}
    +import org.apache.spark.{Logging, SparkConf}
    +import org.apache.mesos.protobuf.ByteString
    +import org.apache.mesos.Protos.Value.Type
    +
    +
    +private[spark] trait MesosSchedulerUtils extends Logging {
    +  def createSchedulerDriver(
    +      scheduler: Scheduler,
    +      sparkUser: String,
    +      appName: String,
    +      masterUrl: String,
    +      conf: SparkConf) = {
    +    val fwInfoBuilder = FrameworkInfo.newBuilder().setUser(sparkUser).setName(appName)
    +    var credBuilder: Option[Credential.Builder] = None
    +
    +    conf.getOption("spark.mesos.principal").foreach { principal =>
    +      fwInfoBuilder.setPrincipal(principal)
    +      credBuilder = Option(Credential.newBuilder().setPrincipal(principal))
    +    }
    +
    +    conf.getOption("spark.mesos.secret").foreach { secret =>
    +      credBuilder = Option(credBuilder.getOrElse(Credential.newBuilder())
    +        .setSecret(ByteString.copyFromUtf8(secret)))
    +    }
    +
    +    conf.getOption("spark.mesos.role").foreach { role =>
    +      fwInfoBuilder.setRole(role)
    +    }
    +
    +    if (credBuilder.isDefined) {
    +      new MesosSchedulerDriver(
    +        scheduler, fwInfoBuilder.build, masterUrl, credBuilder.get.build())
    +    } else {
    +      new MesosSchedulerDriver(scheduler, fwInfoBuilder.build, masterUrl)
    +    }
    +  }
    +
    +  // Helper function to pull out a resource from a Mesos Resources protobuf
    +  def getResource(res: List[Resource], name: String): Double = {
    +    var resource = 0.0
    +    // A resource can have multiple values in the offer since it can either be from
    +    // a specific role or wildcard.
    +    for (r <- res if r.getName == name) {
    +      resource += r.getScalar.getValue
    +
    +    }
    +    resource
    +  }
    +
    +  /**
    +   * Partition the existing resource list based on the resources requested and
    +   * the remaining resources.
    +   * @return The remaining resources list and the used resources list.
    +   */
    +  def partitionResources(
    +      resources: List[Resource],
    +      resourceName: String,
    +      count: Double): (List[Resource], List[Resource]) = {
    +    var remain = count
    +    var usedResources = new ArrayBuffer[Resource]
    +    val newResources = resources.collect {
    +      case r => {
    +        if (remain > 0 &&
    +          r.getType == Type.SCALAR &&
    +          r.getScalar.getValue > 0.0 &&
    +          r.getName == resourceName) {
    +          val usage = Math.min(remain, r.getScalar.getValue)
    +          usedResources += Resource.newBuilder()
    +            .setName(resourceName)
    +            .setRole(r.getRole)
    +            .setType(Value.Type.SCALAR)
    +            .setScalar(Value.Scalar.newBuilder().setValue(usage).build())
    +            .build()
    +          remain -= usage
    +          Resource.newBuilder()
    +            .setName(resourceName)
    +            .setRole(r.getRole)
    +            .setType(Value.Type.SCALAR)
    +            .setScalar(Value.Scalar.newBuilder().setValue(r.getScalar.getValue - usage).build())
    +            .build()
    +        } else {
    +          r
    +        }
    +      }
    +    }
    +
    +    (newResources.filter(r => r.getType != Type.SCALAR || r.getScalar.getValue > 0.0).toList,
    +      usedResources.toList)
    --- End diff --
    
    for readability, would you mind putting
    ```
    val remainingResources = newResources.toList.filter { r =>
      ...
    }
    (remainingResources, usedResources.toList)
    ```


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by ohal <gi...@git.apache.org>.
Github user ohal commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-142055958
  
    also, it looks like dispatcher does not receive resource offers other then **"*"** role:
    ```
    15/09/21 17:40:54 TRACE MesosClusterScheduler: Received offers from Mesos:
    Offer id: 20150911-070321-538888970-5050-1632-O282247, cpu: 8.0, mem: 14863.0
    Offer id: 20150911-070321-538888970-5050-1632-O282248, cpu: 8.0, mem: 14863.0
    Offer id: 20150911-070321-538888970-5050-1632-O282249, cpu: 8.0, mem: 14863.0   
    ```


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by ohal <gi...@git.apache.org>.
Github user ohal commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-142113340
  
    looks driver's starting with some defaults - cpu, mem, below from spark ui:
    `State: TASK_ERROR, Message: Task uses more resources cpus(*):1; mem(*):1024 than available cpus(fast):8; mem(fast):14863; disk(fast):45243; ports(fast):[1025-2180, 2182-3887, 3889-5049, 5052-8079, 8082-65535], Source: SOURCE_MASTER, Reason: REASON_TASK_INVALID, Time: 1.442868857232848E9`



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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r27088037
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerUtils.scala ---
    @@ -0,0 +1,116 @@
    +/*
    + * 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.scheduler.cluster.mesos
    +
    +import java.util.List
    +
    +import scala.collection.JavaConversions._
    +import scala.collection.mutable.ArrayBuffer
    +
    +import org.apache.mesos.Protos._
    +import org.apache.mesos.{Scheduler, MesosSchedulerDriver}
    +import org.apache.spark.{Logging, SparkConf}
    +import org.apache.mesos.protobuf.ByteString
    +import org.apache.mesos.Protos.Value.Type
    +
    +
    +private[spark] trait MesosSchedulerUtils extends Logging {
    +  def createSchedulerDriver(
    --- End diff --
    
    Can you add a quick java doc that says this also handles roles principals and secrets?


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r27088231
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/CoarseMesosSchedulerBackend.scala ---
    @@ -225,18 +225,26 @@ private[spark] class CoarseMesosSchedulerBackend(
               taskIdToSlaveId(taskId) = slaveId
               slaveIdsWithExecutors += slaveId
               coresByTaskId(taskId) = cpusToUse
    -          val task = MesosTaskInfo.newBuilder()
    +
    +          val (newResources, usedResources) =
    +            partitionResources(offer.getResourcesList, "cpus", cpusToUse)
    +
    +          val taskBuilder = MesosTaskInfo.newBuilder()
                 .setTaskId(TaskID.newBuilder().setValue(taskId.toString).build())
                 .setSlaveId(offer.getSlaveId)
                 .setCommand(createCommand(offer, cpusToUse + extraCoresPerSlave))
                 .setName("Task " + taskId)
    -            .addResources(createResource("cpus", cpusToUse))
    -            .addResources(createResource("mem",
    -              MemoryUtils.calculateTotalMemory(sc)))
    -            .build()
    +            .addAllResources(usedResources)
    +            .addAllResources(
    +              partitionResources(newResources, "mem", MemoryUtils.calculateTotalMemory(sc))._2)
    --- End diff --
    
    can you hide this in `MesosSchedulerUtils` behind a `def getUsedResources`?


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


[GitHub] spark pull request: [MESOS] Add mesos role, principal and secret

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-78010040
  
      [Test build #28425 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/28425/consoleFull) for   PR 4960 at commit [`8fa250b`](https://github.com/apache/spark/commit/8fa250b5efad5a31feadbf19c7924e2b2a880219).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-86633274
  
      [Test build #29242 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/29242/consoleFull) for   PR 4960 at commit [`fb3a822`](https://github.com/apache/spark/commit/fb3a8226fe995d910eb1976d67535f7ad3f62c33).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-85793055
  
      [Test build #29132 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/29132/consoleFull) for   PR 4960 at commit [`a5d3e8d`](https://github.com/apache/spark/commit/a5d3e8d7fbe640f6b0da5632adeef8102ed36119).
     * This patch **passes all tests**.
    
     * This patch **does not merge cleanly**.
     * This patch adds no public classes.


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


[GitHub] spark pull request: [MESOS] Add mesos role, principal and secret

Posted by adam-mesos <gi...@git.apache.org>.
Github user adam-mesos commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-78013647
  
    Resolves https://issues.apache.org/jira/browse/SPARK-4416


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-86642968
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/29246/
    Test FAILed.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by tnachen <gi...@git.apache.org>.
Github user tnachen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r27140227
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerUtils.scala ---
    @@ -0,0 +1,116 @@
    +/*
    + * 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.scheduler.cluster.mesos
    +
    +import java.util.List
    +
    +import scala.collection.JavaConversions._
    +import scala.collection.mutable.ArrayBuffer
    +
    +import org.apache.mesos.Protos._
    +import org.apache.mesos.{Scheduler, MesosSchedulerDriver}
    +import org.apache.spark.{Logging, SparkConf}
    +import org.apache.mesos.protobuf.ByteString
    +import org.apache.mesos.Protos.Value.Type
    +
    +
    +private[spark] trait MesosSchedulerUtils extends Logging {
    +  def createSchedulerDriver(
    +      scheduler: Scheduler,
    +      sparkUser: String,
    +      appName: String,
    +      masterUrl: String,
    +      conf: SparkConf) = {
    +    val fwInfoBuilder = FrameworkInfo.newBuilder().setUser(sparkUser).setName(appName)
    +    var credBuilder: Option[Credential.Builder] = None
    +
    +    conf.getOption("spark.mesos.principal").foreach { principal =>
    +      fwInfoBuilder.setPrincipal(principal)
    +      credBuilder = Option(Credential.newBuilder().setPrincipal(principal))
    +    }
    +
    +    conf.getOption("spark.mesos.secret").foreach { secret =>
    +      credBuilder = Option(credBuilder.getOrElse(Credential.newBuilder())
    +        .setSecret(ByteString.copyFromUtf8(secret)))
    +    }
    +
    +    conf.getOption("spark.mesos.role").foreach { role =>
    +      fwInfoBuilder.setRole(role)
    +    }
    +
    +    if (credBuilder.isDefined) {
    +      new MesosSchedulerDriver(
    +        scheduler, fwInfoBuilder.build, masterUrl, credBuilder.get.build())
    +    } else {
    +      new MesosSchedulerDriver(scheduler, fwInfoBuilder.build, masterUrl)
    +    }
    +  }
    +
    +  // Helper function to pull out a resource from a Mesos Resources protobuf
    --- End diff --
    
    I removed the wild card names part, since it's actually roles that can give you multiple values of the same resources but they all have the same resource name.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by tnachen <gi...@git.apache.org>.
Github user tnachen commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-82507791
  
    @realoptimal thanks for testing this. We can file another issue for the --conf problem, and I'm sure there are more rough edges to smooth out. @andrewor14 can you take a look of this PR?


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by realoptimal <gi...@git.apache.org>.
Github user realoptimal commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-82506198
  
    @tnachen You are much faster than I am; was working on modifying your previous code to dole out reserved offers first and then to use unreserved offers (those with role="*"), but you beat me to it.
    
    Tested your code with my configuration and this works when you have specified spark.mesos.role in the spark-defaults.conf file.  Not sure why it won't pick it up via --conf on the command line but I think that is an issue with SparkSubmit, not in your your code changes.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by tnachen <gi...@git.apache.org>.
Github user tnachen commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-142130464
  
    Ah this is indeed a bug, need to port the multiple roles logic that's in coarse and fine grain scheduler to cluster scheduler. Will fix this asap


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-84575882
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/28958/
    Test FAILed.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r27087212
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerUtils.scala ---
    @@ -0,0 +1,116 @@
    +/*
    + * 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.scheduler.cluster.mesos
    +
    +import java.util.List
    +
    +import scala.collection.JavaConversions._
    +import scala.collection.mutable.ArrayBuffer
    +
    +import org.apache.mesos.Protos._
    +import org.apache.mesos.{Scheduler, MesosSchedulerDriver}
    +import org.apache.spark.{Logging, SparkConf}
    +import org.apache.mesos.protobuf.ByteString
    +import org.apache.mesos.Protos.Value.Type
    +
    +
    +private[spark] trait MesosSchedulerUtils extends Logging {
    --- End diff --
    
    elsewhere in Spark we use the static class pattern for util methods, e.g. `o.a.s.util.Utils`, `o.a.s.ui.JettyUtils` ...


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by adam-mesos <gi...@git.apache.org>.
Github user adam-mesos commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-142046720
  
    Oleh, did you specify `--roles=fast,foo,bar` when you started the Mesos
    master?
    
    On Mon, Sep 21, 2015 at 10:11 AM, Oleh Halenok <no...@github.com>
    wrote:
    
    > @tnachen <https://github.com/tnachen>
    > I'm trying to get roles implementation working without any luck, can you
    > please point me what should be configured?
    > Have a cluster, Mesos 0.22.1, hadoop 2.5.0, 3 masters, 8 slaves, which are
    > 3 - role *fast*, 3 - role *"*"*, 2 other roles.
    > Spark 1.5.0 is deployed to use cluster mode with dispatcher, it looks
    > working, however I can not get it working on the particular nodes with role
    > configured.
    > Job submitted as # bin/spark-submit --class
    > org.apache.spark.examples.SparkPi --master master.novalocal:7077
    > --deploy-mode cluster --conf spark.mesos.role=fast http://www/spark.jar 10
    > Also, I've tried to configure Spark defaults for submitted jobs and added
    > to /opt/spark/conf/spark-defaults.conf the line spark.mesos.role fast
    > In any case after submitting job is staging/running on the *"*"* nodes
    > not on the *fast* nodes.
    > Can you please describe how to configure it properly?
    >
    > —
    > Reply to this email directly or view it on GitHub
    > <https://github.com/apache/spark/pull/4960#issuecomment-142045298>.
    >



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


[GitHub] spark pull request: [MESOS] Add mesos role, principal and secret

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-78019319
  
      [Test build #28425 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/28425/consoleFull) for   PR 4960 at commit [`8fa250b`](https://github.com/apache/spark/commit/8fa250b5efad5a31feadbf19c7924e2b2a880219).
     * This patch **passes all tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r27087259
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerUtils.scala ---
    @@ -0,0 +1,116 @@
    +/*
    + * 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.scheduler.cluster.mesos
    +
    +import java.util.List
    +
    +import scala.collection.JavaConversions._
    +import scala.collection.mutable.ArrayBuffer
    +
    +import org.apache.mesos.Protos._
    +import org.apache.mesos.{Scheduler, MesosSchedulerDriver}
    +import org.apache.spark.{Logging, SparkConf}
    +import org.apache.mesos.protobuf.ByteString
    +import org.apache.mesos.Protos.Value.Type
    +
    +
    +private[spark] trait MesosSchedulerUtils extends Logging {
    +  def createSchedulerDriver(
    +      scheduler: Scheduler,
    +      sparkUser: String,
    +      appName: String,
    +      masterUrl: String,
    +      conf: SparkConf) = {
    --- End diff --
    
    please add return type, here and other places


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-85760863
  
    retest this please. This needs to be rebased to master


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by realoptimal <gi...@git.apache.org>.
Github user realoptimal commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-81959279
  
    Also if Slave resources are all of the default type, i.e. *.  The framework should be still be able to use those resources even with spark.mesos.role != *


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r27087745
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerUtils.scala ---
    @@ -0,0 +1,116 @@
    +/*
    + * 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.scheduler.cluster.mesos
    +
    +import java.util.List
    +
    +import scala.collection.JavaConversions._
    +import scala.collection.mutable.ArrayBuffer
    +
    +import org.apache.mesos.Protos._
    +import org.apache.mesos.{Scheduler, MesosSchedulerDriver}
    +import org.apache.spark.{Logging, SparkConf}
    +import org.apache.mesos.protobuf.ByteString
    +import org.apache.mesos.Protos.Value.Type
    +
    +
    +private[spark] trait MesosSchedulerUtils extends Logging {
    +  def createSchedulerDriver(
    +      scheduler: Scheduler,
    +      sparkUser: String,
    +      appName: String,
    +      masterUrl: String,
    +      conf: SparkConf) = {
    +    val fwInfoBuilder = FrameworkInfo.newBuilder().setUser(sparkUser).setName(appName)
    +    var credBuilder: Option[Credential.Builder] = None
    +
    +    conf.getOption("spark.mesos.principal").foreach { principal =>
    +      fwInfoBuilder.setPrincipal(principal)
    +      credBuilder = Option(Credential.newBuilder().setPrincipal(principal))
    +    }
    +
    +    conf.getOption("spark.mesos.secret").foreach { secret =>
    +      credBuilder = Option(credBuilder.getOrElse(Credential.newBuilder())
    +        .setSecret(ByteString.copyFromUtf8(secret)))
    +    }
    +
    +    conf.getOption("spark.mesos.role").foreach { role =>
    +      fwInfoBuilder.setRole(role)
    +    }
    +
    +    if (credBuilder.isDefined) {
    +      new MesosSchedulerDriver(
    +        scheduler, fwInfoBuilder.build, masterUrl, credBuilder.get.build())
    +    } else {
    +      new MesosSchedulerDriver(scheduler, fwInfoBuilder.build, masterUrl)
    +    }
    +  }
    +
    +  // Helper function to pull out a resource from a Mesos Resources protobuf
    --- End diff --
    
    Can this be more specific, maybe something like
    ```
    /**
     * Return the value of the resource that matches the given name.
     * In case of wild card names, return the sum of the values of all matching resources.
     */
    ```


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by tnachen <gi...@git.apache.org>.
Github user tnachen commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-86642864
  
    @andrewor14 so just figured out your question about principal and secret, you have to set a principal if you have secret configured.
    Our protobuf definition actually actively guards it, so at the time when you build the Crendetial proto if you don't have a principal it throws an exception. I've added a check myself so I have a nicer error message before build happens.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by tnachen <gi...@git.apache.org>.
Github user tnachen commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-97283425
  
    @andrewor14 just rebased and this is available for review now again. Should already addressed all your comments, PTAL


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-97291519
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/31211/
    Test FAILed.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-86636750
  
      [Test build #29245 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/29245/consoleFull) for   PR 4960 at commit [`bdea818`](https://github.com/apache/spark/commit/bdea81806b7cc1a68a62634b2dd7b74d54facb23).
     * This patch **fails Scala style tests**.
    
     * This patch merges cleanly.
     * This patch adds no public classes.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-97283039
  
      [Test build #31207 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/31207/consoleFull) for   PR 4960 at commit [`33ee301`](https://github.com/apache/spark/commit/33ee301b85428d73f810684aca34a0cc9d4e422c).


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by ohal <gi...@git.apache.org>.
Github user ohal commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-142065977
  
    actually, it was done before:
    ```
    # cat conf/spark-defaults.conf
    spark.master                     spark://master.novalocal:7077
    spark.eventLog.enabled           true
    spark.mesos.role                 fast
    ```
    when job is starting I've got some output:
    ```
    ...
      "mainClass" : "org.apache.spark.examples.SparkPi",
      "sparkProperties" : {
        "spark.jars" : "http://www/spark.jar",
        "spark.driver.supervise" : "false",
        "spark.app.name" : "org.apache.spark.examples.SparkPi",
        "spark.mesos.role" : "fast",
        "spark.submit.deployMode" : "cluster",
        "spark.master" : "spark://master.novalocal:7077"
      }
    ...
    ```



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


[GitHub] spark pull request: [MESOS] Add mesos role, principal and secret

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-78016891
  
    Have a look at the other PRs -- write `SPARK-xxxx [yyyy] ...` to have it properly "indexed" by https://spark-prs.appspot.com/


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


[GitHub] spark pull request: [MESOS] Add mesos role, principal and secret

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-78019328
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/28425/
    Test PASSed.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r27087498
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerUtils.scala ---
    @@ -0,0 +1,116 @@
    +/*
    + * 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.scheduler.cluster.mesos
    +
    +import java.util.List
    +
    +import scala.collection.JavaConversions._
    +import scala.collection.mutable.ArrayBuffer
    +
    +import org.apache.mesos.Protos._
    +import org.apache.mesos.{Scheduler, MesosSchedulerDriver}
    +import org.apache.spark.{Logging, SparkConf}
    +import org.apache.mesos.protobuf.ByteString
    +import org.apache.mesos.Protos.Value.Type
    +
    +
    +private[spark] trait MesosSchedulerUtils extends Logging {
    +  def createSchedulerDriver(
    +      scheduler: Scheduler,
    +      sparkUser: String,
    +      appName: String,
    +      masterUrl: String,
    +      conf: SparkConf) = {
    +    val fwInfoBuilder = FrameworkInfo.newBuilder().setUser(sparkUser).setName(appName)
    +    var credBuilder: Option[Credential.Builder] = None
    +
    +    conf.getOption("spark.mesos.principal").foreach { principal =>
    +      fwInfoBuilder.setPrincipal(principal)
    +      credBuilder = Option(Credential.newBuilder().setPrincipal(principal))
    +    }
    +
    +    conf.getOption("spark.mesos.secret").foreach { secret =>
    +      credBuilder = Option(credBuilder.getOrElse(Credential.newBuilder())
    +        .setSecret(ByteString.copyFromUtf8(secret)))
    +    }
    +
    +    conf.getOption("spark.mesos.role").foreach { role =>
    +      fwInfoBuilder.setRole(role)
    +    }
    +
    +    if (credBuilder.isDefined) {
    +      new MesosSchedulerDriver(
    +        scheduler, fwInfoBuilder.build, masterUrl, credBuilder.get.build())
    +    } else {
    +      new MesosSchedulerDriver(scheduler, fwInfoBuilder.build, masterUrl)
    +    }
    +  }
    +
    +  // Helper function to pull out a resource from a Mesos Resources protobuf
    +  def getResource(res: List[Resource], name: String): Double = {
    +    var resource = 0.0
    +    // A resource can have multiple values in the offer since it can either be from
    +    // a specific role or wildcard.
    +    for (r <- res if r.getName == name) {
    +      resource += r.getScalar.getValue
    +
    +    }
    +    resource
    --- End diff --
    
    could you just do:
    ```
    res.filter(_.getName == name).map(_.getScalar.getValue).sum
    ```
    ?


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-97283954
  
     Merged build triggered.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-96773491
  
      [Test build #31057 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/31057/consoleFull) for   PR 4960 at commit [`880166b`](https://github.com/apache/spark/commit/880166b72664beb2478fb2f59c063eafce0ee364).
     * This patch **does not merge cleanly**.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by tnachen <gi...@git.apache.org>.
Github user tnachen commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-145625978
  
    Hi @AndriiOmelianenko, I have a PR out to fix that here https://github.com/apache/spark/pull/8872


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-97283159
  
    Merged build finished. Test FAILed.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-86636114
  
      [Test build #29245 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/29245/consoleFull) for   PR 4960 at commit [`bdea818`](https://github.com/apache/spark/commit/bdea81806b7cc1a68a62634b2dd7b74d54facb23).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-97291510
  
      [Test build #31211 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/31211/consoleFull) for   PR 4960 at commit [`e2cc7e8`](https://github.com/apache/spark/commit/e2cc7e8690ba613d7fa4387b87d826cb9c3d8f35).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.
     * This patch does not change any dependencies.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r27088056
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerUtils.scala ---
    @@ -0,0 +1,116 @@
    +/*
    + * 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.scheduler.cluster.mesos
    +
    +import java.util.List
    +
    +import scala.collection.JavaConversions._
    +import scala.collection.mutable.ArrayBuffer
    +
    +import org.apache.mesos.Protos._
    +import org.apache.mesos.{Scheduler, MesosSchedulerDriver}
    +import org.apache.spark.{Logging, SparkConf}
    +import org.apache.mesos.protobuf.ByteString
    +import org.apache.mesos.Protos.Value.Type
    --- End diff --
    
    import ordering is incorrect (spark should be a separate block)


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r27087427
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerUtils.scala ---
    @@ -0,0 +1,116 @@
    +/*
    + * 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.scheduler.cluster.mesos
    +
    +import java.util.List
    +
    +import scala.collection.JavaConversions._
    +import scala.collection.mutable.ArrayBuffer
    +
    +import org.apache.mesos.Protos._
    +import org.apache.mesos.{Scheduler, MesosSchedulerDriver}
    +import org.apache.spark.{Logging, SparkConf}
    +import org.apache.mesos.protobuf.ByteString
    +import org.apache.mesos.Protos.Value.Type
    +
    +
    +private[spark] trait MesosSchedulerUtils extends Logging {
    +  def createSchedulerDriver(
    +      scheduler: Scheduler,
    +      sparkUser: String,
    +      appName: String,
    +      masterUrl: String,
    +      conf: SparkConf) = {
    +    val fwInfoBuilder = FrameworkInfo.newBuilder().setUser(sparkUser).setName(appName)
    +    var credBuilder: Option[Credential.Builder] = None
    +
    +    conf.getOption("spark.mesos.principal").foreach { principal =>
    +      fwInfoBuilder.setPrincipal(principal)
    +      credBuilder = Option(Credential.newBuilder().setPrincipal(principal))
    +    }
    +
    +    conf.getOption("spark.mesos.secret").foreach { secret =>
    +      credBuilder = Option(credBuilder.getOrElse(Credential.newBuilder())
    +        .setSecret(ByteString.copyFromUtf8(secret)))
    +    }
    +
    +    conf.getOption("spark.mesos.role").foreach { role =>
    +      fwInfoBuilder.setRole(role)
    +    }
    +
    --- End diff --
    
    minor: can you remove these random new lines?


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r27087646
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerUtils.scala ---
    @@ -0,0 +1,116 @@
    +/*
    + * 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.scheduler.cluster.mesos
    +
    +import java.util.List
    +
    +import scala.collection.JavaConversions._
    +import scala.collection.mutable.ArrayBuffer
    +
    +import org.apache.mesos.Protos._
    +import org.apache.mesos.{Scheduler, MesosSchedulerDriver}
    +import org.apache.spark.{Logging, SparkConf}
    +import org.apache.mesos.protobuf.ByteString
    +import org.apache.mesos.Protos.Value.Type
    +
    +
    +private[spark] trait MesosSchedulerUtils extends Logging {
    +  def createSchedulerDriver(
    +      scheduler: Scheduler,
    +      sparkUser: String,
    +      appName: String,
    +      masterUrl: String,
    +      conf: SparkConf) = {
    +    val fwInfoBuilder = FrameworkInfo.newBuilder().setUser(sparkUser).setName(appName)
    +    var credBuilder: Option[Credential.Builder] = None
    +
    +    conf.getOption("spark.mesos.principal").foreach { principal =>
    +      fwInfoBuilder.setPrincipal(principal)
    +      credBuilder = Option(Credential.newBuilder().setPrincipal(principal))
    +    }
    +
    +    conf.getOption("spark.mesos.secret").foreach { secret =>
    +      credBuilder = Option(credBuilder.getOrElse(Credential.newBuilder())
    +        .setSecret(ByteString.copyFromUtf8(secret)))
    +    }
    +
    +    conf.getOption("spark.mesos.role").foreach { role =>
    +      fwInfoBuilder.setRole(role)
    +    }
    +
    +    if (credBuilder.isDefined) {
    +      new MesosSchedulerDriver(
    +        scheduler, fwInfoBuilder.build, masterUrl, credBuilder.get.build())
    +    } else {
    +      new MesosSchedulerDriver(scheduler, fwInfoBuilder.build, masterUrl)
    +    }
    +  }
    +
    +  // Helper function to pull out a resource from a Mesos Resources protobuf
    +  def getResource(res: List[Resource], name: String): Double = {
    +    var resource = 0.0
    +    // A resource can have multiple values in the offer since it can either be from
    +    // a specific role or wildcard.
    +    for (r <- res if r.getName == name) {
    +      resource += r.getScalar.getValue
    +
    +    }
    +    resource
    +  }
    +
    +  /**
    +   * Partition the existing resource list based on the resources requested and
    +   * the remaining resources.
    --- End diff --
    
    This sounds pretty confusing. Really what this is doing is:
    ```
    Partition the existing set of resources into two groups, those remaining to be scheduled and those currently in use.
    ```
    (I'm assuming that's what "remaining" here means?)


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r27088282
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerUtils.scala ---
    @@ -0,0 +1,116 @@
    +/*
    + * 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.scheduler.cluster.mesos
    +
    +import java.util.List
    +
    +import scala.collection.JavaConversions._
    +import scala.collection.mutable.ArrayBuffer
    +
    +import org.apache.mesos.Protos._
    +import org.apache.mesos.{Scheduler, MesosSchedulerDriver}
    +import org.apache.spark.{Logging, SparkConf}
    +import org.apache.mesos.protobuf.ByteString
    +import org.apache.mesos.Protos.Value.Type
    +
    +
    +private[spark] trait MesosSchedulerUtils extends Logging {
    +  def createSchedulerDriver(
    +      scheduler: Scheduler,
    +      sparkUser: String,
    +      appName: String,
    +      masterUrl: String,
    +      conf: SparkConf) = {
    +    val fwInfoBuilder = FrameworkInfo.newBuilder().setUser(sparkUser).setName(appName)
    +    var credBuilder: Option[Credential.Builder] = None
    +
    +    conf.getOption("spark.mesos.principal").foreach { principal =>
    +      fwInfoBuilder.setPrincipal(principal)
    +      credBuilder = Option(Credential.newBuilder().setPrincipal(principal))
    +    }
    +
    +    conf.getOption("spark.mesos.secret").foreach { secret =>
    +      credBuilder = Option(credBuilder.getOrElse(Credential.newBuilder())
    +        .setSecret(ByteString.copyFromUtf8(secret)))
    +    }
    +
    +    conf.getOption("spark.mesos.role").foreach { role =>
    +      fwInfoBuilder.setRole(role)
    +    }
    +
    +    if (credBuilder.isDefined) {
    +      new MesosSchedulerDriver(
    +        scheduler, fwInfoBuilder.build, masterUrl, credBuilder.get.build())
    +    } else {
    +      new MesosSchedulerDriver(scheduler, fwInfoBuilder.build, masterUrl)
    +    }
    +  }
    +
    +  // Helper function to pull out a resource from a Mesos Resources protobuf
    +  def getResource(res: List[Resource], name: String): Double = {
    +    var resource = 0.0
    +    // A resource can have multiple values in the offer since it can either be from
    +    // a specific role or wildcard.
    +    for (r <- res if r.getName == name) {
    +      resource += r.getScalar.getValue
    +
    +    }
    +    resource
    +  }
    +
    +  /**
    +   * Partition the existing resource list based on the resources requested and
    +   * the remaining resources.
    +   * @return The remaining resources list and the used resources list.
    +   */
    +  def partitionResources(
    +      resources: List[Resource],
    +      resourceName: String,
    +      count: Double): (List[Resource], List[Resource]) = {
    --- End diff --
    
    what is count here? can you document?


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-97291518
  
    Merged build finished. Test FAILed.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by ohal <gi...@git.apache.org>.
Github user ohal commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-142045298
  
    @tnachen 
    I'm trying to get roles implementation working without any luck, can you please point me what should be configured?
    Have a cluster, Mesos 0.22.1, hadoop 2.5.0, 3 masters, 8 slaves, which are 3 - role **fast**, 3 - role **"*"**, 2 other roles.
    Spark 1.5.0 is deployed to use cluster mode with dispatcher, it looks working, however I can not get it working on the particular nodes with role configured.
    Job submitted as `# bin/spark-submit --class org.apache.spark.examples.SparkPi --master master.novalocal:7077 --deploy-mode cluster --conf spark.mesos.role=fast http://www/spark.jar 10`
    Also, I've tried to configure Spark defaults for submitted jobs and added to `/opt/spark/conf/spark-defaults.conf` the line `spark.mesos.role fast`
    In any case after submitting job is staging/running on the **"*"** nodes not on the **fast** nodes.
    Can you please describe how to configure it properly?


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r27087959
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerUtils.scala ---
    @@ -0,0 +1,116 @@
    +/*
    + * 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.scheduler.cluster.mesos
    +
    +import java.util.List
    +
    +import scala.collection.JavaConversions._
    +import scala.collection.mutable.ArrayBuffer
    +
    +import org.apache.mesos.Protos._
    +import org.apache.mesos.{Scheduler, MesosSchedulerDriver}
    +import org.apache.spark.{Logging, SparkConf}
    +import org.apache.mesos.protobuf.ByteString
    +import org.apache.mesos.Protos.Value.Type
    +
    +
    +private[spark] trait MesosSchedulerUtils extends Logging {
    +  def createSchedulerDriver(
    +      scheduler: Scheduler,
    +      sparkUser: String,
    +      appName: String,
    +      masterUrl: String,
    +      conf: SparkConf) = {
    +    val fwInfoBuilder = FrameworkInfo.newBuilder().setUser(sparkUser).setName(appName)
    +    var credBuilder: Option[Credential.Builder] = None
    +
    +    conf.getOption("spark.mesos.principal").foreach { principal =>
    +      fwInfoBuilder.setPrincipal(principal)
    +      credBuilder = Option(Credential.newBuilder().setPrincipal(principal))
    +    }
    +
    +    conf.getOption("spark.mesos.secret").foreach { secret =>
    +      credBuilder = Option(credBuilder.getOrElse(Credential.newBuilder())
    +        .setSecret(ByteString.copyFromUtf8(secret)))
    --- End diff --
    
    The use of options here is kind of strange and unreadable. Can we instead have a flag:
    ```
    val credBuilder = Credential.newBuilder()
    var hasCredentials: Boolean = false
    conf.getOption("spark.mesos.principal").foreach { principal =>
      fwInfoBuilder.setPrincipal(principal)
      credBuilder.setPrincipal(principal)
    }
    conf.getOption("spark.mesos.secret").foreach { secret =>
      credBuilder.setSecret(...)
    }
    conf.getOption("spark.mesos.role").foreach(fwInfoBuilder.setRole)
    if (hasCredentials) {
      new MesosSchedulerDriver(..., credBuilder)
    } else {
      new MesosSchedulerDriver(...)
    }
    ```


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-85793092
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/29132/
    Test PASSed.


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


[GitHub] spark pull request: [MESOS] Add mesos role, principal and secret

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-78007746
  
      [Test build #28424 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/28424/consoleFull) for   PR 4960 at commit [`99c3a85`](https://github.com/apache/spark/commit/99c3a85148ad5d1fc24ba07a060a2852d2d01e26).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r27087449
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerUtils.scala ---
    @@ -0,0 +1,116 @@
    +/*
    + * 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.scheduler.cluster.mesos
    +
    +import java.util.List
    +
    +import scala.collection.JavaConversions._
    +import scala.collection.mutable.ArrayBuffer
    +
    +import org.apache.mesos.Protos._
    +import org.apache.mesos.{Scheduler, MesosSchedulerDriver}
    +import org.apache.spark.{Logging, SparkConf}
    +import org.apache.mesos.protobuf.ByteString
    +import org.apache.mesos.Protos.Value.Type
    +
    +
    +private[spark] trait MesosSchedulerUtils extends Logging {
    +  def createSchedulerDriver(
    +      scheduler: Scheduler,
    +      sparkUser: String,
    +      appName: String,
    +      masterUrl: String,
    +      conf: SparkConf) = {
    +    val fwInfoBuilder = FrameworkInfo.newBuilder().setUser(sparkUser).setName(appName)
    +    var credBuilder: Option[Credential.Builder] = None
    +
    +    conf.getOption("spark.mesos.principal").foreach { principal =>
    +      fwInfoBuilder.setPrincipal(principal)
    +      credBuilder = Option(Credential.newBuilder().setPrincipal(principal))
    +    }
    +
    +    conf.getOption("spark.mesos.secret").foreach { secret =>
    +      credBuilder = Option(credBuilder.getOrElse(Credential.newBuilder())
    +        .setSecret(ByteString.copyFromUtf8(secret)))
    +    }
    +
    +    conf.getOption("spark.mesos.role").foreach { role =>
    +      fwInfoBuilder.setRole(role)
    +    }
    +
    +    if (credBuilder.isDefined) {
    +      new MesosSchedulerDriver(
    +        scheduler, fwInfoBuilder.build, masterUrl, credBuilder.get.build())
    +    } else {
    +      new MesosSchedulerDriver(scheduler, fwInfoBuilder.build, masterUrl)
    --- End diff --
    
    `build` is not a getter. It has side effects, so please use `build()`


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r27087147
  
    --- Diff: docs/running-on-mesos.md ---
    @@ -229,6 +229,28 @@ See the [configuration page](configuration.html) for information on Spark config
         the final overhead will be this value.
       </td>
     </tr>
    +<tr>
    +  <td><code>spark.mesos.principal</code></td>
    +  <td>Framework principal to authenticate to Mesos</td>
    +  <td>
    +    Set the principal in which Spark framework will use to authenticate with Mesos.
    +  </td>
    +</tr>
    +<tr>
    +  <td><code>spark.mesos.secret</code></td>
    +  <td>Framework secret to authenticate to Mesos</td>
    +  <td>
    +    Set the secret in which Spark framework will use to authenticate with Mesos.
    --- End diff --
    
    "with which"? (same in the description for principal)


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-82212239
  
      [Test build #28715 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/28715/consoleFull) for   PR 4960 at commit [`eba5669`](https://github.com/apache/spark/commit/eba5669a3101f1f0a6cd2a9a68a49fdcbc374085).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r27088362
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/CoarseMesosSchedulerBackend.scala ---
    @@ -210,6 +209,7 @@ private[spark] class CoarseMesosSchedulerBackend(
           val filters = Filters.newBuilder().setRefuseSeconds(-1).build()
     
           for (offer <- offers) {
    +        logTrace("Offer received from Mesos, id: " + offer.getId + ", offer: " + offer)
    --- End diff --
    
    please use string interpolation to be consistent with the rest of your changes


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by tnachen <gi...@git.apache.org>.
Github user tnachen commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-81975220
  
    @realoptimal you did indeed found a problem about roles, I only tried it with seeing the framework registered with the right role and tasks launched, but didn't try it in your case where multiple roles with different resources and no wildcard resources are available. The scheduler currently just uses * in the role everywhere.
    
    I'm having a fix and will push a fix plus tests to this PR, thanks again!


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-82258157
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/28715/
    Test PASSed.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-97283965
  
    Merged build started.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r27088162
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerBackend.scala ---
    @@ -135,26 +136,26 @@ private[spark] class MesosSchedulerBackend(
           command.setValue(s"cd ${basename}*; $prefixEnv ./bin/spark-class $executorBackendName")
           command.addUris(CommandInfo.URI.newBuilder().setValue(uri))
         }
    -    val cpus = Resource.newBuilder()
    -      .setName("cpus")
    -      .setType(Value.Type.SCALAR)
    -      .setScalar(Value.Scalar.newBuilder()
    -        .setValue(scheduler.CPUS_PER_TASK).build())
    -      .build()
    -    val memory = Resource.newBuilder()
    -      .setName("mem")
    -      .setType(Value.Type.SCALAR)
    -      .setScalar(
    -        Value.Scalar.newBuilder()
    -          .setValue(MemoryUtils.calculateTotalMemory(sc)).build())
    -      .build()
    -    MesosExecutorInfo.newBuilder()
    +
    +    val builder = MesosExecutorInfo.newBuilder()
    +
    +    val (resourcesAfterCpu, usedCpuResources) =
    +      partitionResources(resources, "cpus", scheduler.CPUS_PER_TASK)
    +
    +    builder.addAllResources(usedCpuResources)
    +
    +    val (resourcesAfterMem, usedMemResources) =
    +      partitionResources(resourcesAfterCpu, "mem", MemoryUtils.calculateTotalMemory(sc))
    +
    +    builder.addAllResources(usedMemResources)
    +
    --- End diff --
    
    can you remove these random new lines if they don't have special meanings? (see https://github.com/databricks/scala-style-guide for what "special meaning" here means)


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-97284068
  
      [Test build #31211 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/31211/consoleFull) for   PR 4960 at commit [`e2cc7e8`](https://github.com/apache/spark/commit/e2cc7e8690ba613d7fa4387b87d826cb9c3d8f35).


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-86633630
  
      [Test build #29242 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/29242/consoleFull) for   PR 4960 at commit [`fb3a822`](https://github.com/apache/spark/commit/fb3a8226fe995d910eb1976d67535f7ad3f62c33).
     * This patch **fails Scala style tests**.
    
     * This patch merges cleanly.
     * This patch adds no public classes.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-86642577
  
      [Test build #29246 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/29246/consoleFull) for   PR 4960 at commit [`880166b`](https://github.com/apache/spark/commit/880166b72664beb2478fb2f59c063eafce0ee364).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-85769235
  
    @tnachen The changes that actually implement SPARK-6284 are limited to `createSchedulerDriver`, right? It seems that the rest is just refactoring code to use common util methods. Is that correct, or are there other intended functional differences?


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by tnachen <gi...@git.apache.org>.
Github user tnachen commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-142066891
  
    That's the spark properties for the job, but might not for the dispatcher.
    
    The easiest way to check is to go to the Mesos UI and look at the
    Dispatcher framework, and see if it does have the correct role or not.
    
    Tim
    
    On Mon, Sep 21, 2015 at 11:19 AM, Oleh Halenok <no...@github.com>
    wrote:
    
    > actually, it was done before:
    >
    > # cat conf/spark-defaults.conf
    > spark.master                     spark://master.novalocal:7077
    > spark.eventLog.enabled           true
    > spark.mesos.role                 fast
    >
    > when job is starting I've got some output:
    >
    > ...
    >   "mainClass" : "org.apache.spark.examples.SparkPi",
    >   "sparkProperties" : {
    >     "spark.jars" : "http://www/spark.jar",
    >     "spark.driver.supervise" : "false",
    >     "spark.app.name" : "org.apache.spark.examples.SparkPi",
    >     "spark.mesos.role" : "fast",
    >     "spark.submit.deployMode" : "cluster",
    >     "spark.master" : "spark://master.novalocal:7077"
    >   }
    > ...
    >
    > —
    > Reply to this email directly or view it on GitHub
    > <https://github.com/apache/spark/pull/4960#issuecomment-142065977>.
    >



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


[GitHub] spark pull request: [MESOS] Add mesos role, principal and secret

Posted by tnachen <gi...@git.apache.org>.
Github user tnachen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r26103306
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerUtils.scala ---
    @@ -0,0 +1,56 @@
    +/*
    + * 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.scheduler.cluster.mesos
    +
    +import org.apache.mesos.Protos.{Credential, FrameworkInfo}
    +import org.apache.mesos.{Scheduler, MesosSchedulerDriver}
    +import org.apache.spark.SparkConf
    +import org.apache.mesos.protobuf.ByteString
    +
    +private[spark] trait MesosSchedulerUtils {
    +  def createSchedulerDriver(
    +      scheduler: Scheduler,
    +      sparkUser: String,
    +      appName: String,
    +      masterUrl: String,
    +      conf: SparkConf) = {
    +    val fwInfoBuilder = FrameworkInfo.newBuilder().setUser(sparkUser).setName(appName)
    +    var credBuilder: Option[Credential.Builder] = None
    +
    +    conf.getOption("spark.mesos.principal").foreach { principal =>
    --- End diff --
    
    consider this a common Spark style, if you search the code base.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r27088309
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/CoarseMesosSchedulerBackend.scala ---
    @@ -225,18 +225,26 @@ private[spark] class CoarseMesosSchedulerBackend(
               taskIdToSlaveId(taskId) = slaveId
               slaveIdsWithExecutors += slaveId
               coresByTaskId(taskId) = cpusToUse
    -          val task = MesosTaskInfo.newBuilder()
    +
    +          val (newResources, usedResources) =
    +            partitionResources(offer.getResourcesList, "cpus", cpusToUse)
    +
    +          val taskBuilder = MesosTaskInfo.newBuilder()
                 .setTaskId(TaskID.newBuilder().setValue(taskId.toString).build())
                 .setSlaveId(offer.getSlaveId)
                 .setCommand(createCommand(offer, cpusToUse + extraCoresPerSlave))
                 .setName("Task " + taskId)
    -            .addResources(createResource("cpus", cpusToUse))
    -            .addResources(createResource("mem",
    -              MemoryUtils.calculateTotalMemory(sc)))
    -            .build()
    +            .addAllResources(usedResources)
    +            .addAllResources(
    +              partitionResources(newResources, "mem", MemoryUtils.calculateTotalMemory(sc))._2)
    --- End diff --
    
    can explain / document what this is doing? I find this line pretty hard to follow.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r27087109
  
    --- Diff: docs/running-on-mesos.md ---
    @@ -229,6 +229,28 @@ See the [configuration page](configuration.html) for information on Spark config
         the final overhead will be this value.
       </td>
     </tr>
    +<tr>
    +  <td><code>spark.mesos.principal</code></td>
    +  <td>Framework principal to authenticate to Mesos</td>
    +  <td>
    +    Set the principal in which Spark framework will use to authenticate with Mesos.
    +  </td>
    +</tr>
    +<tr>
    +  <td><code>spark.mesos.secret</code></td>
    +  <td>Framework secret to authenticate to Mesos</td>
    +  <td>
    +    Set the secret in which Spark framework will use to authenticate with Mesos.
    +  </td>
    +</tr>
    +<tr>
    +  <td><code>spark.mesos.role</code></td>
    +  <td>Role for the Spark framework</td>
    +  <td>
    +    Set the role of this Spark framework for Mesos. Roles are used in Mesos for reservations
    +    and resource weigth sharing.
    --- End diff --
    
    weight


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-86633637
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/29242/
    Test FAILed.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-97283008
  
    Merged build started.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by tnachen <gi...@git.apache.org>.
Github user tnachen commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-82210761
  
    @realoptimal Can you try again? I've updated the PR that includes test and I've tested myself with fine-grained and coarse-grained mode, and it is correctly launching the tasks.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by ohal <gi...@git.apache.org>.
Github user ohal commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-142053815
  
    yes, sure, all roles are configured on masters as `MESOS_ROLES=fast,big,kafka`


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-97283157
  
      [Test build #31207 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/31207/consoleFull) for   PR 4960 at commit [`33ee301`](https://github.com/apache/spark/commit/33ee301b85428d73f810684aca34a0cc9d4e422c).
     * This patch **fails Scala style tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.
     * This patch does not change any dependencies.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by tnachen <gi...@git.apache.org>.
Github user tnachen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r27097403
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerBackend.scala ---
    @@ -135,26 +136,26 @@ private[spark] class MesosSchedulerBackend(
           command.setValue(s"cd ${basename}*; $prefixEnv ./bin/spark-class $executorBackendName")
           command.addUris(CommandInfo.URI.newBuilder().setValue(uri))
         }
    -    val cpus = Resource.newBuilder()
    -      .setName("cpus")
    -      .setType(Value.Type.SCALAR)
    -      .setScalar(Value.Scalar.newBuilder()
    -        .setValue(scheduler.CPUS_PER_TASK).build())
    -      .build()
    -    val memory = Resource.newBuilder()
    -      .setName("mem")
    -      .setType(Value.Type.SCALAR)
    -      .setScalar(
    -        Value.Scalar.newBuilder()
    -          .setValue(MemoryUtils.calculateTotalMemory(sc)).build())
    -      .build()
    -    MesosExecutorInfo.newBuilder()
    +
    +    val builder = MesosExecutorInfo.newBuilder()
    +
    +    val (resourcesAfterCpu, usedCpuResources) =
    +      partitionResources(resources, "cpus", scheduler.CPUS_PER_TASK)
    +
    +    builder.addAllResources(usedCpuResources)
    +
    +    val (resourcesAfterMem, usedMemResources) =
    +      partitionResources(resourcesAfterCpu, "mem", MemoryUtils.calculateTotalMemory(sc))
    +
    +    builder.addAllResources(usedMemResources)
    +
    --- End diff --
    
    Sorry mesos style encourages it :)


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-97283160
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/31207/
    Test FAILed.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-82258109
  
      [Test build #28715 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/28715/consoleFull) for   PR 4960 at commit [`eba5669`](https://github.com/apache/spark/commit/eba5669a3101f1f0a6cd2a9a68a49fdcbc374085).
     * This patch **passes all tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-85762680
  
      [Test build #29132 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/29132/consoleFull) for   PR 4960 at commit [`a5d3e8d`](https://github.com/apache/spark/commit/a5d3e8d7fbe640f6b0da5632adeef8102ed36119).
     * This patch **does not merge cleanly**.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-86642956
  
      [Test build #29246 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/29246/consoleFull) for   PR 4960 at commit [`880166b`](https://github.com/apache/spark/commit/880166b72664beb2478fb2f59c063eafce0ee364).
     * This patch **fails Scala style tests**.
    
     * This patch merges cleanly.
     * This patch adds no public classes.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-97282993
  
     Merged build triggered.


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


[GitHub] spark pull request: [MESOS] Add mesos role, principal and secret

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-78016347
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/28424/
    Test PASSed.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-96774086
  
      [Test build #31057 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/31057/consoleFull) for   PR 4960 at commit [`880166b`](https://github.com/apache/spark/commit/880166b72664beb2478fb2f59c063eafce0ee364).
     * This patch **fails Scala style tests**.
    
     * This patch **does not merge cleanly**.
     * This patch adds no public classes.


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by AndriiOmelianenko <gi...@git.apache.org>.
Github user AndriiOmelianenko commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-145593034
  
    @tnachen Hi Tim,
    any update here?


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by realoptimal <gi...@git.apache.org>.
Github user realoptimal commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-78656152
  
    How have you tested this?  I get ExecutorLostFailure and tasks are not launched on mesos slave with spark.mesos.role=<my role>


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-86636763
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/29245/
    Test FAILed.


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


[GitHub] spark pull request: [MESOS] Add mesos role, principal and secret

Posted by adam-mesos <gi...@git.apache.org>.
Github user adam-mesos commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-78009158
  
    LGTM, from a Mesos perspective. :+1: 


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


[GitHub] spark pull request: [MESOS] Add mesos role, principal and secret

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-78013187
  
    (JIRA please?)


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r27087355
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerUtils.scala ---
    @@ -0,0 +1,116 @@
    +/*
    + * 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.scheduler.cluster.mesos
    +
    +import java.util.List
    +
    +import scala.collection.JavaConversions._
    +import scala.collection.mutable.ArrayBuffer
    +
    +import org.apache.mesos.Protos._
    +import org.apache.mesos.{Scheduler, MesosSchedulerDriver}
    +import org.apache.spark.{Logging, SparkConf}
    +import org.apache.mesos.protobuf.ByteString
    +import org.apache.mesos.Protos.Value.Type
    +
    +
    +private[spark] trait MesosSchedulerUtils extends Logging {
    +  def createSchedulerDriver(
    +      scheduler: Scheduler,
    +      sparkUser: String,
    +      appName: String,
    +      masterUrl: String,
    +      conf: SparkConf) = {
    +    val fwInfoBuilder = FrameworkInfo.newBuilder().setUser(sparkUser).setName(appName)
    +    var credBuilder: Option[Credential.Builder] = None
    +
    +    conf.getOption("spark.mesos.principal").foreach { principal =>
    +      fwInfoBuilder.setPrincipal(principal)
    +      credBuilder = Option(Credential.newBuilder().setPrincipal(principal))
    +    }
    +
    +    conf.getOption("spark.mesos.secret").foreach { secret =>
    +      credBuilder = Option(credBuilder.getOrElse(Credential.newBuilder())
    +        .setSecret(ByteString.copyFromUtf8(secret)))
    +    }
    +
    +    conf.getOption("spark.mesos.role").foreach { role =>
    +      fwInfoBuilder.setRole(role)
    +    }
    +
    +    if (credBuilder.isDefined) {
    +      new MesosSchedulerDriver(
    +        scheduler, fwInfoBuilder.build, masterUrl, credBuilder.get.build())
    +    } else {
    +      new MesosSchedulerDriver(scheduler, fwInfoBuilder.build, masterUrl)
    +    }
    --- End diff --
    
    Since you're using an option, you might as well do
    ```
    credBuilder
      .map { b => new MesosSchedulerDriver(..., b.build()) }
      .getOrElse { new MesosSchedulerDriver(...) }
    ```


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


[GitHub] spark pull request: [SPARK-6284][MESOS] Add mesos role, principal ...

Posted by tnachen <gi...@git.apache.org>.
Github user tnachen commented on the pull request:

    https://github.com/apache/spark/pull/4960#issuecomment-78305260
  
    @srowen Sorry missed your notification, opened a JIRA now


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


[GitHub] spark pull request: [MESOS] Add mesos role, principal and secret

Posted by adam-mesos <gi...@git.apache.org>.
Github user adam-mesos commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4960#discussion_r26103271
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerUtils.scala ---
    @@ -0,0 +1,56 @@
    +/*
    + * 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.scheduler.cluster.mesos
    +
    +import org.apache.mesos.Protos.{Credential, FrameworkInfo}
    +import org.apache.mesos.{Scheduler, MesosSchedulerDriver}
    +import org.apache.spark.SparkConf
    +import org.apache.mesos.protobuf.ByteString
    +
    +private[spark] trait MesosSchedulerUtils {
    +  def createSchedulerDriver(
    +      scheduler: Scheduler,
    +      sparkUser: String,
    +      appName: String,
    +      masterUrl: String,
    +      conf: SparkConf) = {
    +    val fwInfoBuilder = FrameworkInfo.newBuilder().setUser(sparkUser).setName(appName)
    +    var credBuilder: Option[Credential.Builder] = None
    +
    +    conf.getOption("spark.mesos.principal").foreach { principal =>
    --- End diff --
    
    Maybe this is a Scala-ism I'm not familiar with, but foreach seems like overkill for what should be a single-value field. Wouldn't an 'if' do? Or is the idea to use the last config value read, rather than the first?


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