1/* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18package org.apache.spark.deploy.mesos 19 20import java.util.Date 21 22import org.apache.spark.SparkConf 23import org.apache.spark.deploy.Command 24import org.apache.spark.scheduler.cluster.mesos.MesosClusterRetryState 25 26/** 27 * Describes a Spark driver that is submitted from the 28 * [[org.apache.spark.deploy.rest.mesos.MesosRestServer]], to be launched by 29 * [[org.apache.spark.scheduler.cluster.mesos.MesosClusterScheduler]]. 30 * @param jarUrl URL to the application jar 31 * @param mem Amount of memory for the driver 32 * @param cores Number of cores for the driver 33 * @param supervise Supervise the driver for long running app 34 * @param command The command to launch the driver. 35 * @param schedulerProperties Extra properties to pass the Mesos scheduler 36 */ 37private[spark] class MesosDriverDescription( 38 val name: String, 39 val jarUrl: String, 40 val mem: Int, 41 val cores: Double, 42 val supervise: Boolean, 43 val command: Command, 44 schedulerProperties: Map[String, String], 45 val submissionId: String, 46 val submissionDate: Date, 47 val retryState: Option[MesosClusterRetryState] = None) 48 extends Serializable { 49 50 val conf = new SparkConf(false) 51 schedulerProperties.foreach {case (k, v) => conf.set(k, v)} 52 53 def copy( 54 name: String = name, 55 jarUrl: String = jarUrl, 56 mem: Int = mem, 57 cores: Double = cores, 58 supervise: Boolean = supervise, 59 command: Command = command, 60 schedulerProperties: SparkConf = conf, 61 submissionId: String = submissionId, 62 submissionDate: Date = submissionDate, 63 retryState: Option[MesosClusterRetryState] = retryState): MesosDriverDescription = { 64 65 new MesosDriverDescription(name, jarUrl, mem, cores, supervise, command, conf.getAll.toMap, 66 submissionId, submissionDate, retryState) 67 } 68 69 override def toString: String = s"MesosDriverDescription (${command.mainClass})" 70} 71