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


Scala ScallopConf类代码示例

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


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

示例1: Main

//设置package包名称以及导入依赖的类
package onextent.demo

import org.apache.spark.SparkEnv
import org.rogach.scallop.ScallopConf

object Main {
  def main(args: Array[String]) {
    object Args extends ScallopConf(args) {
      val msg = opt[String]("message", descr = "say something", default = Some("world"))
    }
    SparkEnv.get
    Args.verify()
    println(s"Hello ${Args.msg.getOrElse("what?")}")
  }
} 
开发者ID:navicore,项目名称:docker-entrypoint-cmd-demo,代码行数:16,代码来源:Main.scala

示例2:

//设置package包名称以及导入依赖的类
package mesosphere.marathon.core.plugin

import org.rogach.scallop.ScallopConf

trait PluginManagerConfiguration extends ScallopConf {

  lazy val pluginConf = opt[String](
    "plugin_conf",
    descr = "The plugin configuration file.",
    noshort = true
  )

  lazy val pluginDir = opt[String](
    "plugin_dir",
    descr = "Path to a local directory containing plugin jars.",
    noshort = true
  )

  codependent(pluginConf, pluginDir)
} 
开发者ID:xiaozai512,项目名称:marathon,代码行数:21,代码来源:PluginManagerConfiguration.scala

示例3: ault

//设置package包名称以及导入依赖的类
package mesosphere.marathon.core.event

import java.util.concurrent.TimeUnit

import akka.util.Timeout
import org.rogach.scallop.ScallopConf
import mesosphere.marathon.api.v2.Validation.urlIsValid

import scala.concurrent.duration.FiniteDuration
import scala.concurrent.duration._

trait EventConf extends ScallopConf {
  lazy val eventSubscriber = opt[String](
    "event_subscriber",
    descr = "The event subscription module to use. E.g. http_callback.",
    required = false,
    noshort = true)

  lazy val httpEventEndpoints = opt[String](
    "http_endpoints",
    descr = "The URLs of the event endpoints added to the current list of subscribers on startup. " +
      "You can manage this list during runtime by using the /v2/eventSubscriptions API endpoint.",
    required = false,
    validate = { parseHttpEventEndpoints(_).forall(urlIsValid(_).isSuccess) },
    noshort = true).map(parseHttpEventEndpoints)

  lazy val httpEventCallbackSlowConsumerTimeout = opt[Long](
    "http_event_callback_slow_consumer_timeout",
    descr = "A http event callback consumer is considered slow, if the delivery takes longer than this timeout (ms)",
    required = false,
    noshort = true,
    default = Some(10.seconds.toMillis)
  )

  lazy val httpEventRequestTimeout = opt[Long](
    "http_event_request_timeout",
    descr = "A http event request timeout (ms)",
    required = false,
    noshort = true,
    default = Some(10.seconds.toMillis)
  )

  lazy val eventStreamMaxOutstandingMessages = opt[Int](
    "event_stream_max_outstanding_messages",
    descr = "The event stream buffers events, that are not already consumed by clients. " +
      "This number defines the number of events that get buffered on the server side, before messages are dropped.",
    noshort = true,
    default = Some(50)
  )

  private[event] def httpCallbacksEnabled: Boolean = eventSubscriber.get.contains("http_callback")

  private[this] def parseHttpEventEndpoints(str: String): List[String] = str.split(',').map(_.trim).toList

  def slowConsumerDuration: FiniteDuration = httpEventCallbackSlowConsumerTimeout().millis

  def eventRequestTimeout: Timeout = Timeout(httpEventRequestTimeout(), TimeUnit.MILLISECONDS)

  def zkTimeoutDuration: FiniteDuration
} 
开发者ID:xiaozai512,项目名称:marathon,代码行数:61,代码来源:EventConf.scala

示例4: ault

//设置package包名称以及导入依赖的类
package mesosphere.marathon.core.flow

import org.rogach.scallop.ScallopConf

trait ReviveOffersConfig extends ScallopConf {

  lazy val reviveOffersForNewApps = toggle(
    "revive_offers_for_new_apps",
    descrYes = "(Default) Call reviveOffers for new or changed apps.",
    descrNo = "Disable reviveOffers for new or changed apps.",
    hidden = true,
    default = Some(true),
    prefix = "disable_")

  lazy val minReviveOffersInterval = opt[Long](
    "min_revive_offers_interval",
    descr = "Do not ask for all offers (also already seen ones) more often than this interval (ms).",
    default = Some(5000))

  lazy val reviveOffersRepetitions = opt[Int](
    "revive_offers_repetitions",
    descr = "Repeat every reviveOffer request this many times, delayed by the --min_revive_offers_interval.",
    default = Some(3))
} 
开发者ID:xiaozai512,项目名称:marathon,代码行数:25,代码来源:ReviveOffersConfig.scala

示例5: ault

//设置package包名称以及导入依赖的类
package mesosphere.marathon.core.launchqueue

import org.rogach.scallop.ScallopConf

trait LaunchQueueConfig extends ScallopConf {

  lazy val launchQueueRequestTimeout = opt[Int](
    "launch_queue_request_timeout",
    descr = "INTERNAL TUNING PARAMETER: Timeout (in ms) for requests to the launch queue actor.",
    hidden = true,
    default = Some(1000))

  lazy val taskOpNotificationTimeout = opt[Int](
    "task_operation_notification_timeout",
    descr = "INTERNAL TUNING PARAMETER: Timeout (in ms) for matched task opereations to be accepted or rejected.",
    hidden = true,
    default = Some(10000))
} 
开发者ID:xiaozai512,项目名称:marathon,代码行数:19,代码来源:LaunchQueueConfig.scala

示例6: ault

//设置package包名称以及导入依赖的类
package mesosphere.marathon.core.matcher.manager

import org.rogach.scallop.ScallopConf

trait OfferMatcherManagerConfig extends ScallopConf {
  lazy val maxInstancesPerOfferFlag = opt[Int](
    "max_instances_per_offer",
    descr = "Max instances per offer. Do not start more than this number of app or pod instances on a single offer.")

  
  lazy val maxTasksPerOfferFlag = opt[Int](
    "max_tasks_per_offer",
    descr = "(deprecated) Maximum tasks per offer. Do not start more than this number of tasks on a single offer.",
    default = Some(5))

  // TODO(jdef) simplify this once maxTasksPerOfferFlag has been removed
  def maxInstancesPerOffer(): Int = maxInstancesPerOfferFlag.get.getOrElse(maxTasksPerOfferFlag.apply())
} 
开发者ID:xiaozai512,项目名称:marathon,代码行数:19,代码来源:OfferMatcherManagerConfig.scala

示例7: ault

//设置package包名称以及导入依赖的类
package mesosphere.marathon.core.task.update

import org.rogach.scallop.ScallopConf

trait TaskStatusUpdateConfig extends ScallopConf {

  lazy val internalMaxParallelStatusUpdates = opt[Int](
    "max_parallel_status_updates",
    descr = "INTERNAL TUNING PARAMETER: The maximum number of status updates that get processed in parallel.",
    noshort = true,
    hidden = true,
    default = Some(20)
  )

  lazy val internalMaxQueuedStatusUpdates = opt[Int](
    "max_queued_status_updates",
    descr = "INTERNAL TUNING PARAMETER: The maximum number of status updates that we queue for processing." +
      " Mesos will resent status updates which we do not acknowledge.",
    noshort = true,
    hidden = true,
    default = Some(10000)
  )
} 
开发者ID:xiaozai512,项目名称:marathon,代码行数:24,代码来源:TaskStatusUpdateConfig.scala

示例8: ault

//设置package包名称以及导入依赖的类
package mesosphere.marathon.core.task.termination

import org.rogach.scallop.ScallopConf
import scala.concurrent.duration._

import scala.concurrent.duration.FiniteDuration

trait KillConfig extends ScallopConf {

  private[this] lazy val _killChunkSize = opt[Int](
    "kill_chunk_size",
    descr = "INTERNAL TUNING PARAMETER: " +
      "The maximum number of concurrently processed kills",
    noshort = true,
    hidden = true,
    default = Some(100)
  )

  private[this] lazy val _killRetryTimeout = opt[Long](
    "kill_retry_timeout",
    descr = "INTERNAL TUNING PARAMETER: " +
      "The timeout after which unconfirmed instance kills will be retried.",
    noshort = true,
    hidden = true,
    default = Some(10.seconds.toMillis)
  )

  lazy val killChunkSize: Int = _killChunkSize()
  lazy val killRetryTimeout: FiniteDuration = _killRetryTimeout().millis
} 
开发者ID:xiaozai512,项目名称:marathon,代码行数:31,代码来源:KillConfig.scala

示例9: ault

//设置package包名称以及导入依赖的类
package mesosphere.marathon.core.task.jobs

import org.rogach.scallop.ScallopConf
import scala.concurrent.duration._

trait TaskJobsConfig extends ScallopConf {

  @deprecated(message = "Use UnreachableStrategy", since = "1.4.0")
  private[this] lazy val taskLostExpungeGCValue = opt[Long](
    "task_lost_expunge_gc",
    descr = "This is the length of time in milliseconds, until a lost task is garbage collected and expunged " +
      "from the task tracker and task repository.",
    hidden = true,
    default = Some(75.seconds.toMillis))

  private[this] lazy val taskLostExpungeInitialDelayValue = opt[Long](
    "task_lost_expunge_initial_delay",
    descr = "This is the length of time, in milliseconds, before Marathon " +
      "begins to periodically perform task expunge gc operations",
    default = Some(5.minutes.toMillis))

  private[this] lazy val taskLostExpungeIntervalValue = opt[Long](
    "task_lost_expunge_interval",
    descr = "This is the length of time in milliseconds, for lost task gc operations.",
    default = Some(30.seconds.toMillis))

  def taskLostExpungeInitialDelay: FiniteDuration = taskLostExpungeInitialDelayValue().millis
  def taskLostExpungeInterval: FiniteDuration = taskLostExpungeIntervalValue().millis
} 
开发者ID:xiaozai512,项目名称:marathon,代码行数:30,代码来源:TaskJobsConfig.scala

示例10: ault

//设置package包名称以及导入依赖的类
package mesosphere.marathon.core.task.tracker

import org.rogach.scallop.ScallopConf

trait InstanceTrackerConfig extends ScallopConf {

  lazy val internalTaskTrackerRequestTimeout = opt[Int](
    "task_tracker_request_timeout",
    descr = "INTERNAL TUNING PARAMETER: Timeout (in ms) for requests to the taskTracker.",
    hidden = true,
    default = Some(10000))

  lazy val internalTaskUpdateRequestTimeout = opt[Int](
    "task_update_request_timeout",
    descr = "INTERNAL TUNING PARAMETER: Timeout (in ms) for task update requests.",
    hidden = true,
    default = Some(10000))
} 
开发者ID:xiaozai512,项目名称:marathon,代码行数:19,代码来源:InstanceTrackerConfig.scala

示例11: ault

//设置package包名称以及导入依赖的类
package mesosphere.marathon.core.launcher

import org.rogach.scallop.ScallopConf

trait OfferProcessorConfig extends ScallopConf {

  lazy val offerMatchingTimeout = opt[Int](
    "offer_matching_timeout",
    descr = "Offer matching timeout (ms). Stop trying to match additional tasks for this offer after this time.",
    default = Some(1000))

  lazy val saveTasksToLaunchTimeout = opt[Int](
    "save_tasks_to_launch_timeout",
    descr = "Timeout (ms) after matching an offer for saving all matched tasks that we are about to launch. " +
      "When reaching the timeout, only the tasks that we could save within the timeout are also launched. " +
      "All other task launches are temporarily rejected and retried later.",
    default = Some(3000))

  lazy val declineOfferDuration = opt[Long](
    "decline_offer_duration",
    descr = "(Default: 120 seconds) " +
      "The duration (milliseconds) for which to decline offers by default",
    default = Some(120000))
} 
开发者ID:xiaozai512,项目名称:marathon,代码行数:25,代码来源:OfferProcessorConfig.scala

示例12:

//设置package包名称以及导入依赖的类
package mesosphere.marathon.metrics

import org.rogach.scallop.ScallopConf

trait MetricsReporterConf extends ScallopConf {

  lazy val graphite = opt[String](
    "reporter_graphite",
    descr = "URL to graphite agent. e.g. tcp://localhost:2003?prefix=marathon-test&interval=10",
    noshort = true
  )

  lazy val dataDog = opt[String](
    "reporter_datadog",
    descr = "URL to dogstatsd agent. e.g. udp://localhost:8125?prefix=marathon-test&tags=marathon&interval=10",
    noshort = true
  )
} 
开发者ID:xiaozai512,项目名称:marathon,代码行数:19,代码来源:MetricsReporterConf.scala

示例13: ault

//设置package包名称以及导入依赖的类
package mesosphere.marathon

import org.rogach.scallop.ScallopConf


trait LeaderProxyConf extends ScallopConf {

  lazy val leaderProxyConnectionTimeout = opt[Int](
    "leader_proxy_connection_timeout",
    descr = "Maximum time, in milliseconds, to wait for connecting to the current Marathon leader from " +
      "another Marathon instance.",
    default = Some(5000)) // 5 seconds

  lazy val leaderProxyReadTimeout = opt[Int](
    "leader_proxy_read_timeout",
    descr = "Maximum time, in milliseconds, for reading from the current Marathon leader.",
    default = Some(10000)) // 10 seconds

  lazy val leaderProxySSLIgnoreHostname = opt[Boolean](
    "leader_proxy_ssl_ignore_hostname",
    descr = "Do not verify that the hostname of the Marathon leader matches the one in the SSL certificate" +
      " when proxying API requests to the current leader.",
    default = Some(false))
} 
开发者ID:xiaozai512,项目名称:marathon,代码行数:25,代码来源:LeaderProxyConf.scala

示例14: AllConf

//设置package包名称以及导入依赖的类
package mesosphere.marathon

import mesosphere.chaos.AppConfiguration
import mesosphere.chaos.http.HttpConf
import mesosphere.marathon.core.event.EventConf
import mesosphere.marathon.core.plugin.PluginManagerConfiguration
import mesosphere.marathon.metrics.MetricsReporterConf
import org.rogach.scallop.ScallopConf

class AllConf(args: Seq[String] = Nil) extends ScallopConf(args)
    with MetricsReporterConf
    with HttpConf
    with MarathonConf
    with AppConfiguration
    with EventConf
    with DebugConf
    with PluginManagerConfiguration {
  verify()
}

object AllConf {
  def apply(args: String*): AllConf = {
    new AllConf(args.to[Seq])
  }

  def withTestConfig(args: String*): AllConf = {
    new AllConf(Seq("--master", "local") ++ args)
  }
} 
开发者ID:xiaozai512,项目名称:marathon,代码行数:30,代码来源:AllConf.scala

示例15: EventConfTests

//设置package包名称以及导入依赖的类
package mesosphere.marathon.core.event

import mesosphere.marathon.test.MarathonSpec
import org.rogach.scallop.ScallopConf

import scala.concurrent.duration.FiniteDuration

class EventConfTests extends MarathonSpec {
  test("--http_endpoints accepts just one endpoint") {
    val conf = makeEventConf(
      "--http_endpoints", "http://127.0.0.1:8000"
    )

    assert(conf.httpEventEndpoints.get == Some(List("http://127.0.0.1:8000")))
  }

  test("--http_endpoints correctly splits multiple endpoints") {
    val conf = makeEventConf(
      "--http_endpoints", "http://127.0.0.1:8000,http://127.0.0.1:8001"
    )

    assert(conf.httpEventEndpoints.get == Some(List("http://127.0.0.1:8000", "http://127.0.0.1:8001")))
  }

  test("--http_endpoints trims endpoints") {
    val conf = makeEventConf(
      "--http_endpoints", "http://127.0.0.1:8000 , http://127.0.0.1:8001   "
    )

    assert(conf.httpEventEndpoints.get == Some(List("http://127.0.0.1:8000", "http://127.0.0.1:8001")))
  }

  def makeEventConf(args: String*): EventConf = {
    new ScallopConf(args) with EventConf {
      // scallop will trigger sys exit
      override protected def onError(e: Throwable): Unit = throw e
      verify()

      override def zkTimeoutDuration: FiniteDuration = ???
    }
  }
} 
开发者ID:xiaozai512,项目名称:marathon,代码行数:43,代码来源:EventConfTests.scala


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