当前位置: 首页>>代码示例>>Scala>>正文


Scala MesosSchedulerDriver类代码示例

本文整理汇总了Scala中org.apache.mesos.MesosSchedulerDriver的典型用法代码示例。如果您正苦于以下问题:Scala MesosSchedulerDriver类的具体用法?Scala MesosSchedulerDriver怎么用?Scala MesosSchedulerDriver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MesosSchedulerDriver类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。

示例1: CmdTask

//设置package包名称以及导入依赖的类
package com.galacticfog.lambda.scheduler

import java.util.UUID

import org.apache.mesos.{Protos, MesosSchedulerDriver}
import org.apache.mesos.Protos.FrameworkInfo
import play.api.{Logger, Play, Application, GlobalSettings}
import scala.collection.mutable
import scala.concurrent.Future
import scala.sys.SystemProperties
import scala.concurrent.duration._
import Play.current
import play.api.libs.concurrent.Execution.Implicits._
import scala.util.Try

case class CmdTask(uuid: UUID, handlerMethod: String, jarUrl: String)

object Global extends GlobalSettings {

  lazy val driver: Try[MesosSchedulerDriver] = Try {
    Logger.info("creating LambdaScheduler")
    val scheduler = new LambdaScheduler

    val master = current.configuration.getString("master") getOrElse "localhost:5050"
    Logger.info(s"registering with mesos-master: ${master}")

    val schedulerHostname = current.configuration.getString("hostname") getOrElse java.net.InetAddress.getLocalHost.getHostName
    Logger.info(s"scheduler on: ${schedulerHostname}")

    val frameworkInfoBuilder = FrameworkInfo.newBuilder()
      .setName("gestalt-lambda-scheduler")
      .setFailoverTimeout(60.seconds.toMillis)
      .setUser("")
      .setCheckpoint(true)
      .setHostname(schedulerHostname)

    val frameworkInfo = frameworkInfoBuilder.build()
    Logger.info(s"scheduler on: ${schedulerHostname}")
    val implicitAcknowledgements = false

    new MesosSchedulerDriver( scheduler, frameworkInfo, master, implicitAcknowledgements )
  }

  val taskQueue = new mutable.Queue[CmdTask]

  override def onStart(app: Application): Unit = {
    Logger.info("onStart")
    driver foreach { d =>
      Logger.info("starting driver")
      Future { d.run } map println
    }
  }

  override def onStop(app: Application): Unit = {
    Logger.info("onStop")
    driver foreach {
      Logger.info("stopping driver")
      _.stop()
    }
  }
} 
开发者ID:GalacticFog,项目名称:gestalt-lambda,代码行数:62,代码来源:Global.scala

示例2: SigMain

//设置package包名称以及导入依赖的类
package com.example
import org.apache.mesos.MesosSchedulerDriver
import org.apache.mesos.Protos.FrameworkInfo

object SigMain {
  def main(args: Array[String]) {

    val framework = FrameworkInfo.newBuilder.
      setName("SigView").
      setUser("").
      setRole("*").
      setCheckpoint(false).
      setFailoverTimeout(0.0d).
      build()
    val scheduler = new SigScheduler
    scheduler.submitTasks(args:_*)
    val mesosURL = "127.0.0.1:5050"
    val driver = new MesosSchedulerDriver(scheduler,framework,mesosURL)
    driver.run()
  }
} 
开发者ID:rahulkumar-aws,项目名称:Mesos-HelloWorld,代码行数:22,代码来源:SigMain.scala

示例3: Main

//设置package包名称以及导入依赖的类
package com.github.roberveral.mesosgocd

import com.github.roberveral.mesosgocd.scheduler.GoCDScheduler
import com.github.roberveral.mesosgocd.spec.{Command, Resources, Task}
import mesosphere.mesos.protos.FrameworkInfo
import org.apache.mesos.MesosSchedulerDriver
import mesosphere.mesos.protos.Implicits._


object Main extends App {
  val framework = FrameworkInfo("mesos-gocd")

  val gocdServerTask =
    Task("gocd-server",
      "gocd/gocd-server:v17.3.0",
      Command("/docker-entrypoint.sh"),
      Resources(1.0, 512.0, Seq(8153, 8154)))

  val scheduler = new GoCDScheduler(gocdServerTask)

  val driver = new MesosSchedulerDriver(scheduler, framework, "zk://localhost:2181/mesos")
  driver.run()
} 
开发者ID:roberveral,项目名称:mesos-gocd,代码行数:24,代码来源:Main.scala

示例4: StartFramework

//设置package包名称以及导入依赖的类
package com.bwsw.sj.mesos.framework

import com.bwsw.sj.mesos.framework.rest.Rest
import com.bwsw.sj.mesos.framework.schedule.FrameworkScheduler
import com.bwsw.sj.common.DAL.repository.ConnectionRepository
import com.bwsw.sj.common.utils.ConfigLiterals
import org.apache.mesos.MesosSchedulerDriver
import org.apache.mesos.Protos.FrameworkInfo
import org.apache.mesos.Protos.Credential
import scala.util.Properties


object StartFramework {

  
  def main(args: Array[String]): Unit = {
    val port = if (args.nonEmpty) args(0).toInt else 8080
    Rest.start(port)

    val framework = FrameworkInfo.newBuilder.
      setName("JugglerFramework").
      setUser("root").
      setCheckpoint(false).
      setFailoverTimeout(0.0d).
      setRole("*").
      setPrincipal("sherman").
      build()

    val frameworkPrincipal = ConnectionRepository.getConfigService.get(ConfigLiterals.frameworkPrincipalTag)
    val frameworkSecret = ConnectionRepository.getConfigService.get(ConfigLiterals.frameworkSecretTag)
    var credential: Option[Credential] = None

    if (frameworkPrincipal.isDefined && frameworkSecret.isDefined) {
      credential = Some(Credential.newBuilder.
        setPrincipal(frameworkPrincipal.get.value).
        setSecret(frameworkSecret.get.value).
        build())
    }

    val scheduler = new FrameworkScheduler
    val master_path = Properties.envOrElse("MESOS_MASTER", "zk://127.0.0.1:2181/mesos")

    val driver: MesosSchedulerDriver = {
      if (credential.isDefined) new MesosSchedulerDriver(scheduler, framework, master_path, credential.get)
      else new MesosSchedulerDriver(scheduler, framework, master_path)
    }


    driver.start()
    driver.join()
  }
} 
开发者ID:bwsw,项目名称:sj-platform,代码行数:53,代码来源:StartFramework.scala

示例5: SchedulerModule

//设置package包名称以及导入依赖的类
package tech.olczak.miner.scheduler

import javax.inject.Singleton

import com.google.inject.Provides
import net.codingwell.scalaguice.ScalaModule
import org.apache.mesos.Protos.FrameworkInfo
import org.apache.mesos.{MesosSchedulerDriver, Scheduler}

class SchedulerModule extends ScalaModule {

  override def configure(): Unit = {
    bind[Scheduler].to[MinerScheduler]
  }

  @Provides
  @Singleton
  def providesFrameworkInfo(): FrameworkInfo = {
    //todo resource sharing
    //todo partition aware
    FrameworkInfo.newBuilder()
      .setName("mesos-miner")
      .setUser("")
      //    .setWebuiUrl("http://www.wp.pl")
      .addCapabilities(FrameworkInfo.Capability.newBuilder().setType(FrameworkInfo.Capability.Type.REVOCABLE_RESOURCES).build())
      .build()
  }

  @Provides
  @Singleton
  def providesMesosSchedulerDriver(scheduler: Scheduler, framework: FrameworkInfo): MesosSchedulerDriver = {
    new MesosSchedulerDriver(scheduler, framework, "127.0.0.1:5050")//"zk://127.0.0.1/mesos") //todo load from config
  }


} 
开发者ID:lolczak,项目名称:mesos-miner,代码行数:37,代码来源:SchedulerModule.scala


注:本文中的org.apache.mesos.MesosSchedulerDriver类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。