include engine evaluator as a submodule
parent
28f3764e9b
commit
e5a9abb452
|
@ -16,3 +16,6 @@
|
|||
[submodule "submodules/boardcreator"]
|
||||
path = submodules/boardcreator
|
||||
url = https://github.com/clarkerubber/board-creator
|
||||
[submodule "submodules/evaluator"]
|
||||
path = submodules/evaluator
|
||||
url = https://github.com/clarkerubber/engine-evaluator
|
||||
|
|
|
@ -10,14 +10,14 @@ final class Env(
|
|||
system: ActorSystem) {
|
||||
|
||||
private val CollectionEvaluation = config getString "collection.evaluation"
|
||||
private val EvaluatorScriptPath = config getString "evaluator.script_path"
|
||||
private val EvaluatorExecPath = config getString "evaluator.exec_path"
|
||||
private val ActorName = config getString "actor.name"
|
||||
private val ApiToken = config getString "api.token"
|
||||
private val ApiUrl = config getString "api.url"
|
||||
|
||||
lazy val evaluator = new Evaluator(
|
||||
coll = db(CollectionEvaluation),
|
||||
script = EvaluatorScriptPath,
|
||||
execPath = EvaluatorExecPath,
|
||||
reporter = hub.actor.report,
|
||||
analyser = hub.actor.analyser,
|
||||
marker = hub.actor.mod,
|
||||
|
|
|
@ -19,7 +19,7 @@ import lila.user.{ User, UserRepo, Perfs }
|
|||
|
||||
final class Evaluator(
|
||||
coll: Coll,
|
||||
script: String,
|
||||
execPath: String,
|
||||
reporter: ActorSelection,
|
||||
analyser: ActorSelection,
|
||||
marker: ActorSelection,
|
||||
|
@ -116,12 +116,13 @@ final class Evaluator(
|
|||
}
|
||||
|
||||
private def run(userId: String, deep: Boolean): Try[String] = {
|
||||
val command = s"""$script $userId ${deep.fold("true", "false")} $token $apiUrl/"""
|
||||
import scala.sys.process._
|
||||
import java.io.File
|
||||
val exec = Process(Seq("php", "engine-evaluator.php", userId, deep.fold("true", "false"), token, s"$apiUrl/"), new File(execPath))
|
||||
Try {
|
||||
import scala.sys.process._
|
||||
command.!!
|
||||
exec.!!
|
||||
} match {
|
||||
case Failure(e) => Failure(new Exception(s"$command $e"))
|
||||
case Failure(e) => Failure(new Exception(s"$exec $e"))
|
||||
case x => x
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 1efb18afb077a67f4d88a0e7c9b1baf4ee9f70cd
|
Loading…
Reference in New Issue