本文整理汇总了Scala中org.rogach.scallop.ScallopConf类的典型用法代码示例。如果您正苦于以下问题:Scala ScallopConf类的具体用法?Scala ScallopConf怎么用?Scala ScallopConf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ScallopConf类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: ZookeeperConfTest
//设置package包名称以及导入依赖的类
package mesosphere.marathon
import mesosphere.marathon.test.MarathonSpec
import org.apache.zookeeper.ZooDefs
import org.rogach.scallop.ScallopConf
import scala.util.Try
class ZookeeperConfTest extends MarathonSpec {
test("urlParameterGetParsed") {
val url = "zk://host1:123,host2,host3:312/path"
val opts = conf("--zk", url)
assert(opts.zkURL == url)
assert(opts.zkHosts == "host1:123,host2,host3:312")
assert(opts.zkPath == "/path")
assert(opts.zkUsername.isEmpty)
assert(opts.zkPassword.isEmpty)
assert(opts.zkDefaultCreationACL == ZooDefs.Ids.OPEN_ACL_UNSAFE)
}
test("urlParameterWithAuthGetParsed") {
val url = "zk://user1:[email protected]:123,host2,host3:312/path"
val opts = conf("--zk", url)
assert(opts.zkURL == url)
assert(opts.zkHosts == "host1:123,host2,host3:312")
assert(opts.zkPath == "/path")
assert(opts.zkUsername == Some("user1"))
assert(opts.zkPassword == Some("pass1"))
assert(opts.zkDefaultCreationACL == ZooDefs.Ids.CREATOR_ALL_ACL)
}
test("wrongURLIsNotParsed") {
assert(Try(conf("--zk", "zk://host1:foo/path")).isFailure, "No port number")
assert(Try(conf("--zk", "zk://host1")).isFailure, "No path")
assert(Try(conf("--zk", "zk://[email protected]:2181/path")).isFailure, "No password")
assert(Try(conf("--zk", "zk://:[email protected]:2181/path")).isFailure, "No username")
}
def conf(args: String*) = {
new ScallopConf(args) with ZookeeperConf {
//scallop will trigger sys exit
override protected def onError(e: Throwable): Unit = throw e
verify()
}
}
}
开发者ID:xiaozai512,项目名称:marathon,代码行数:48,代码来源:ZookeeperConfTest.scala
示例17: CommandLineOptions
//设置package包名称以及导入依赖的类
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}
import org.rogach.scallop.{ScallopConf, ScallopOption, Subcommand, singleArgConverter}
class CommandLineOptions(args: Array[String], configuration: Configuration) extends ScallopConf(args) {
appendDefaultToDescription = true
editBuilder(_.setHelpWidth(110))
printedName = "${artifactId}"
private val SUBCOMMAND_SEPARATOR = "---\n"
val description: String = s"""${description}"""
val synopsis: String =
s"""
| ${symbol_dollar}printedName (synopsis of command line parameters)
| ${symbol_dollar}printedName (... possibly multiple lines for subcommands)""".stripMargin
version(s"${symbol_dollar}printedName v${symbol_dollar}{ configuration.version }")
banner(
s"""
| ${symbol_dollar}description
|
|Usage:
|
|${symbol_dollar}synopsis
|
|Options:
|""".stripMargin)
//val url = opt[String]("someOption", noshort = true, descr = "Description of the option", default = app.someProperty)
val runService = new Subcommand("run-service") {
descr(
"Starts ${name} as a daemon that services HTTP requests")
footer(SUBCOMMAND_SEPARATOR)
}
addSubcommand(runService)
footer("")
}
开发者ID:DANS-KNAW,项目名称:easy-module-archetype,代码行数:41,代码来源:CommandLineOptions.scala
示例18: Cli
//设置package包名称以及导入依赖的类
package tech.sourced.swivel
import org.rogach.scallop.ScallopConf
class Cli(arguments: Seq[String]) extends ScallopConf(arguments) {
version("swivel-spark-prep 0.0.1 by Source{d}")
banner("""Usage: swivel-spark-prep [OPTION]...
|Swivel-spark-prep parallelize data pre-processing for Swivel ML model
|Options:
|""".stripMargin)
footer("\nFor the details , consult https://github.com/tensorflow/models/tree/master/swivel#preparing-the-data-for-training")
val input = opt[String](name="input", noshort=true, required = true)
val outputDir = opt[String](name="output_dir", noshort=true, default = Some(SparkPrep.defaultOutputDir))
val shardSize = opt[Int](name="shard_size", noshort=true, default = Some(SparkPrep.defaultShardSize))
val minCount = opt[Int](name="min_count", noshort=true, default = Some(SparkPrep.defaultMinCount))
val maxVocab = opt[Int](name="max_vocab", noshort=true, default = Some(SparkPrep.defaultMaxVocab))
val windowSize = opt[Int](name="window_size", noshort=true, default = Some(SparkPrep.defaultWindowSize))
val vocab = opt[String](name="vocab", noshort=true, default = Some(""))
}
开发者ID:src-d,项目名称:swivel-spark-prep,代码行数:23,代码来源:Cli.scala
示例19: Options
//设置package包名称以及导入依赖的类
package ai.vitk.ner
import org.rogach.scallop.ScallopConf
class Options(arguments: Seq[String]) extends ScallopConf(arguments) {
val master = opt[String](default = Some("local[*]"), descr = "the Spark master URL")
val memory = opt[String](default = Some("8g"), descr = "executor memory")
val mode = opt[String](default = Some("tag"), descr = "mode of the tagger, either 'train', 'tag' or 'eval'")
val verbose = opt[Boolean](default = Some(false), descr = "verbose mode")
val language = opt[String](default = Some("vi"), descr = "natural language in use, either 'vi', 'en' or 'ja'")
val dimension = opt[Int](default = Some(32768), descr = "domain dimension for feature hashing")
val iteration = opt[Int](default = Some(600), descr = "max number of iterations in training")
val independent = opt[Boolean](default = Some(false), descr = "use only independent features")
val reversed = opt[Boolean](default = Some(false), descr = "backward model")
val input = opt[String](default = Some("test.txt"), descr = "input file for tagging")
verify()
}
开发者ID:phuonglh,项目名称:ai.vitk.ner,代码行数:19,代码来源:Options.scala
示例20: ArgumentConf
//设置package包名称以及导入依赖的类
package com.weibo.datasys
import org.rogach.scallop.ScallopConf
import org.slf4j.LoggerFactory
class ArgumentConf(args: Seq[String])
extends ScallopConf(args) {
val log = LoggerFactory.getLogger(getClass.getName)
version("wolong version 0.0.1")
banner("""Usage: wolong""")
footer("\nIf you met any question, please email to [email protected]")
val help = opt[Boolean](
name = "help",
default = Some(false),
descr = "print this message",
short = 'h',
required = false
)
val debug_mode = opt[Boolean](
name = "debug_mode",
default = Some(false),
short = 'X',
hidden = true
)
val rest_service = opt[Boolean](noshort = true)
val scheduler_service = opt[Boolean](noshort = true)
override def verify(): Unit = {
super.verify()
if (rest_service.isEmpty &&
scheduler_service.isEmpty) {
log.error("No support module")
this.printHelp()
sys.exit(-1)
}
}
verify()
}
开发者ID:batizty,项目名称:wolong,代码行数:46,代码来源:ArgumentConf.scala
注:本文中的org.rogach.scallop.ScallopConf类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论