Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reformat with 0.4.0 #8

Open
wants to merge 1 commit into
base: 0.3.0-RC1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ class BacktestingEvaluator(val params: BacktestingParams)

val ret =
(if (dailyStats.isEmpty) 0
else {
val yestStats = dailyStats.last
val yestNav = yestStats.nav
(nav - yestNav) / nav - 1
})
else {
val yestStats = dailyStats.last
val yestNav = yestStats.nav
(nav - yestNav) / nav - 1
})

dailyStats.append(
DailyStat(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -571,24 +571,24 @@ object Run {
def main(args: Array[String]) {
val dataSourceParams =
(if (false) {
new DataSourceParams(baseDate = new DateTime(2002, 1, 1, 0, 0),
fromIdx = 300,
untilIdx = 2000,
trainingWindowSize = 200,
maxTestingWindowSize = 20,
marketTicker = "SPY",
tickerList = tickerList)
} else {
// Need to pass "--driver-memory 8G" to pio-run since it requires a lot
// of driver memory.
new DataSourceParams(baseDate = new DateTime(2002, 1, 1, 0, 0),
fromIdx = 300,
untilIdx = 2000,
trainingWindowSize = 200,
maxTestingWindowSize = 20,
marketTicker = "SPY",
tickerList = sp500List)
})
new DataSourceParams(baseDate = new DateTime(2002, 1, 1, 0, 0),
fromIdx = 300,
untilIdx = 2000,
trainingWindowSize = 200,
maxTestingWindowSize = 20,
marketTicker = "SPY",
tickerList = tickerList)
} else {
// Need to pass "--driver-memory 8G" to pio-run since it requires a lot
// of driver memory.
new DataSourceParams(baseDate = new DateTime(2002, 1, 1, 0, 0),
fromIdx = 300,
untilIdx = 2000,
trainingWindowSize = 200,
maxTestingWindowSize = 20,
marketTicker = "SPY",
tickerList = sp500List)
})

val momentumParams = MomentumStrategyParams(20, 3)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,42 +85,42 @@ object RunServer extends Logging {
"--name",
s"PredictionIO Engine Instance: ${engineInstanceId}") ++
(if (!ca.build.uberJar) {
Seq("--jars", jarFiles)
} else Seq()) ++
Seq("--jars", jarFiles)
} else Seq()) ++
(if (extraFiles.size > 0) {
Seq("--files", extraFiles.mkString(","))
} else {
Seq()
}) ++
Seq("--files", extraFiles.mkString(","))
} else {
Seq()
}) ++
(if (extraClasspaths.size > 0) {
Seq("--driver-class-path", extraClasspaths.mkString(":"))
} else {
Seq()
}) ++
Seq("--driver-class-path", extraClasspaths.mkString(":"))
} else {
Seq()
}) ++
(if (ca.common.sparkKryo) {
Seq("--conf",
"spark.serializer=org.apache.spark.serializer.KryoSerializer")
} else {
Seq()
}) ++ Seq(mainJar,
"--engineInstanceId",
engineInstanceId,
"--ip",
ca.deploy.ip,
"--port",
ca.deploy.port.toString,
"--event-server-ip",
ca.eventServer.ip,
"--event-server-port",
ca.eventServer.port.toString) ++
Seq("--conf",
"spark.serializer=org.apache.spark.serializer.KryoSerializer")
} else {
Seq()
}) ++ Seq(mainJar,
"--engineInstanceId",
engineInstanceId,
"--ip",
ca.deploy.ip,
"--port",
ca.deploy.port.toString,
"--event-server-ip",
ca.eventServer.ip,
"--event-server-port",
ca.eventServer.port.toString) ++
(if (ca.accessKey.accessKey != "") {
Seq("--accesskey", ca.accessKey.accessKey)
} else {
Seq()
}) ++ (if (ca.eventServer.enabled) Seq("--feedback") else Seq()) ++
Seq("--accesskey", ca.accessKey.accessKey)
} else {
Seq()
}) ++ (if (ca.eventServer.enabled) Seq("--feedback") else Seq()) ++
(if (ca.common.batch != "")
Seq("--batch", ca.common.batch)
else Seq()) ++
Seq("--batch", ca.common.batch)
else Seq()) ++
(if (ca.common.verbose) Seq("--verbose") else Seq()) ++ ca.deploy.logUrl
.map(x => Seq("--log-url", x))
.getOrElse(Seq()) ++ ca.deploy.logPrefix
Expand Down Expand Up @@ -164,10 +164,10 @@ object RunServer extends Logging {
"--event-server-port",
ca.eventServer.port.toString) ++
(if (ca.accessKey.accessKey != "") {
Seq("--accesskey", ca.accessKey.accessKey)
} else {
Nil
}) ++ (if (ca.eventServer.enabled) Seq("--feedback") else Nil) ++
Seq("--accesskey", ca.accessKey.accessKey)
} else {
Nil
}) ++ (if (ca.eventServer.enabled) Seq("--feedback") else Nil) ++
(if (ca.common.batch != "") Seq("--batch", ca.common.batch) else Nil) ++
(if (ca.common.verbose) Seq("--verbose") else Nil) ++ ca.deploy.logUrl
.map(x => Seq("--log-url", x))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,70 +101,70 @@ object RunWorkflow extends Logging {
"--name",
s"PredictionIO $workMode: ${em.id} ${em.version} (${ca.common.batch})") ++
(if (!ca.build.uberJar) {
Seq("--jars", em.files.mkString(","))
} else Seq()) ++
Seq("--jars", em.files.mkString(","))
} else Seq()) ++
(if (extraFiles.size > 0) {
Seq("--files", extraFiles.mkString(","))
} else {
Seq()
}) ++
Seq("--files", extraFiles.mkString(","))
} else {
Seq()
}) ++
(if (extraClasspaths.size > 0) {
Seq("--driver-class-path", extraClasspaths.mkString(":"))
} else {
Seq()
}) ++
Seq("--driver-class-path", extraClasspaths.mkString(":"))
} else {
Seq()
}) ++
(if (ca.common.sparkKryo) {
Seq("--conf",
"spark.serializer=org.apache.spark.serializer.KryoSerializer")
} else {
Seq()
}) ++ Seq(mainJar,
"--env",
pioEnvVars,
"--engine-id",
em.id,
"--engine-version",
em.version,
"--engine-variant",
if (deployMode == "cluster") {
hdfs
.makeQualified(
new Path((engineLocation :+ variantJson.getName)
.mkString(Path.SEPARATOR)))
.toString
} else {
variantJson.getCanonicalPath
},
"--verbosity",
ca.common.verbosity.toString) ++ ca.common.engineFactory
Seq("--conf",
"spark.serializer=org.apache.spark.serializer.KryoSerializer")
} else {
Seq()
}) ++ Seq(mainJar,
"--env",
pioEnvVars,
"--engine-id",
em.id,
"--engine-version",
em.version,
"--engine-variant",
if (deployMode == "cluster") {
hdfs
.makeQualified(
new Path((engineLocation :+ variantJson.getName)
.mkString(Path.SEPARATOR)))
.toString
} else {
variantJson.getCanonicalPath
},
"--verbosity",
ca.common.verbosity.toString) ++ ca.common.engineFactory
.map(x => Seq("--engine-factory", x))
.getOrElse(Seq()) ++ ca.common.engineParamsKey
.map(x => Seq("--engine-params-key", x))
.getOrElse(Seq()) ++
(if (deployMode == "cluster")
Seq("--deploy-mode", "cluster")
else Seq()) ++
Seq("--deploy-mode", "cluster")
else Seq()) ++
(if (ca.common.batch != "")
Seq("--batch", ca.common.batch)
else Seq()) ++
Seq("--batch", ca.common.batch)
else Seq()) ++
(if (ca.common.verbose) Seq("--verbose") else Seq()) ++
(if (ca.common.skipSanityCheck) Seq("--skip-sanity-check") else Seq()) ++
(if (ca.common.stopAfterRead) Seq("--stop-after-read") else Seq()) ++
(if (ca.common.stopAfterPrepare) {
Seq("--stop-after-prepare")
} else {
Seq()
}) ++ ca.common.evaluation
Seq("--stop-after-prepare")
} else {
Seq()
}) ++ ca.common.evaluation
.map(x => Seq("--evaluation-class", x))
.getOrElse(Seq()) ++ // If engineParamsGenerator is specified, it overrides the evaluation.
ca.common.engineParamsGenerator
.orElse(ca.common.evaluation)
.map(x => Seq("--engine-params-generator-class", x))
.getOrElse(Seq()) ++
(if (ca.common.batch != "")
Seq("--batch", ca.common.batch)
else
Seq()) ++ Seq("--json-extractor", ca.common.jsonExtractor.toString)
Seq("--batch", ca.common.batch)
else
Seq()) ++ Seq("--json-extractor", ca.common.jsonExtractor.toString)

info(s"Submission command: ${sparkSubmit.mkString(" ")}")
Process(sparkSubmit,
Expand All @@ -189,26 +189,26 @@ object RunWorkflow extends Logging {
.map(x => Seq("--engine-params-key", x))
.getOrElse(Seq()) ++
(if (ca.common.batch != "")
Seq("--batch", ca.common.batch)
else Seq()) ++
Seq("--batch", ca.common.batch)
else Seq()) ++
(if (ca.common.verbose) Seq("--verbose") else Seq()) ++
(if (ca.common.skipSanityCheck) Seq("--skip-sanity-check") else Seq()) ++
(if (ca.common.stopAfterRead) Seq("--stop-after-read") else Seq()) ++
(if (ca.common.stopAfterPrepare) {
Seq("--stop-after-prepare")
} else {
Seq()
}) ++ ca.common.evaluation
Seq("--stop-after-prepare")
} else {
Seq()
}) ++ ca.common.evaluation
.map(x => Seq("--evaluation-class", x))
.getOrElse(Seq()) ++ // If engineParamsGenerator is specified, it overrides the evaluation.
ca.common.engineParamsGenerator
.orElse(ca.common.evaluation)
.map(x => Seq("--engine-params-generator-class", x))
.getOrElse(Seq()) ++
(if (ca.common.batch != "")
Seq("--batch", ca.common.batch)
else
Seq()) ++ Seq("--json-extractor", ca.common.jsonExtractor.toString)
Seq("--batch", ca.common.batch)
else
Seq()) ++ Seq("--json-extractor", ca.common.jsonExtractor.toString)

Runner
.runOnSpark("io.prediction.workflow.CreateWorkflow", args, ca, jarFiles)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -925,10 +925,10 @@ object Console extends Logging {
s"${getSparkHome(ca.common.sparkHome)}/bin/spark-submit --jars " +
s"${allJarFiles.mkString(",")} " +
(if (extraFiles.size > 0) {
s"--files ${extraFiles.mkString(",")} "
} else {
""
}) + "--class " +
s"--files ${extraFiles.mkString(",")} "
} else {
""
}) + "--class " +
s"${ca.mainClass.get} ${ca.common.sparkPassThrough.mkString(" ")} " +
coreAssembly(ca.common.pioHome.get) + " " +
ca.common.driverPassThrough.mkString(" ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,17 +267,17 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout {
}
def check(looker: ActorRef) {
val lookname = looker.path.elements.mkString("", "/", "/")
for ((l, r) ← Seq(LookupString("a/b/c") -> empty(lookname + "a/b/c"),
LookupString("") -> system.deadLetters,
LookupString("akka://all-systems/Nobody") -> system.deadLetters,
LookupPath(system / "hallo") -> empty("user/hallo"),
LookupPath(looker.path child "hallo") -> empty(
lookname + "hallo"), // test Java API
LookupPath(
looker.path descendant Seq("a", "b").asJava) -> empty(
lookname + "a/b"), // test Java API
LookupElems(Seq()) -> system.deadLetters,
LookupElems(Seq("a")) -> empty(lookname + "a")))
for ((l, r) ← Seq(
LookupString("a/b/c") -> empty(lookname + "a/b/c"),
LookupString("") -> system.deadLetters,
LookupString("akka://all-systems/Nobody") -> system.deadLetters,
LookupPath(system / "hallo") -> empty("user/hallo"),
LookupPath(looker.path child "hallo") -> empty(
lookname + "hallo"), // test Java API
LookupPath(looker.path descendant Seq("a", "b").asJava) -> empty(
lookname + "a/b"), // test Java API
LookupElems(Seq()) -> system.deadLetters,
LookupElems(Seq("a")) -> empty(lookname + "a")))
checkOne(looker, l, r)
}
for (looker ← all) check(looker)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,12 @@ class ActorSelectionSpec
}
def check(looker: ActorRef) {
val lookname = looker.path.elements.mkString("", "/", "/")
for ((l, r) ← Seq(SelectString("a/b/c") -> None,
SelectString("akka://all-systems/Nobody") -> None,
SelectPath(system / "hallo") -> None,
SelectPath(looker.path child "hallo") -> None, // test Java API
SelectPath(
looker.path descendant Seq("a", "b").asJava) -> None) // test Java API
for ((l, r) ← Seq(
SelectString("a/b/c") -> None,
SelectString("akka://all-systems/Nobody") -> None,
SelectPath(system / "hallo") -> None,
SelectPath(looker.path child "hallo") -> None, // test Java API
SelectPath(looker.path descendant Seq("a", "b").asJava) -> None) // test Java API
) checkOne(looker, l, r)
}
for (looker ← all) check(looker)
Expand Down
4 changes: 2 additions & 2 deletions repos/akka/akka-actor/src/main/scala/akka/actor/Actor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ final case class PreRestartException private[akka] (actor: ActorRef,
actor,
"exception in preRestart(" +
(if (originalCause == null)
"null"
else originalCause.getClass) + ", " +
"null"
else originalCause.getClass) + ", " +
(messageOption match {
case Some(m: AnyRef) ⇒ m.getClass; case _ ⇒ "None"
}) + ")",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ private[akka] class ActorCell(
def become(behavior: Actor.Receive, discardOld: Boolean = true): Unit =
behaviorStack = behavior ::
(if (discardOld && behaviorStack.nonEmpty) behaviorStack.tail
else behaviorStack)
else behaviorStack)

def become(behavior: Procedure[Any]): Unit =
become(behavior, discardOld = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ object ForkJoinExecutorConfigurator {
if (r ne null)
super.execute(
(if (r.isInstanceOf[ForkJoinTask[_]]) r
else new AkkaForkJoinTask(r)).asInstanceOf[ForkJoinTask[Any]])
else new AkkaForkJoinTask(r)).asInstanceOf[ForkJoinTask[Any]])
else throw new NullPointerException("Runnable was null")

def atFullThrottle(): Boolean =
Expand Down
Loading