future proof fishnet nodes, remove fishnet 1.x bc

pull/9791/head
Niklas Fiekas 2021-09-13 02:12:47 +02:00
parent f171318598
commit bcd8f2f323
8 changed files with 14 additions and 40 deletions

View File

@ -32,12 +32,10 @@ final class Fishnet(env: Env) extends LilaController(env) {
.postAnalysis(Work.Id(workId), client, data)
.flatFold(
{
case WorkNotFound => onComplete
case GameNotFound => onComplete
case NotAcquired => onComplete
case WeakAnalysis(_) => onComplete
// case WeakAnalysis => fuccess(Left(UnprocessableEntity("Not enough nodes per move")))
case e => fuccess(Left(InternalServerError(e.getMessage)))
case WorkNotFound => onComplete
case GameNotFound => onComplete
case NotAcquired => onComplete
case e => fuccess(Left(InternalServerError(e.getMessage)))
},
{
case PostAnalysisResult.Complete(analysis) =>

View File

@ -421,7 +421,7 @@ fishnet {
}
offline_mode = true # any client can provide moves and analysis
actor.name = fishnet
analysis.nodes = 2100000 # nnue
analysis.nodes = 1500000 # sf 15 dev
move.plies = 300
client_min_version = "2.1.3"
}

View File

@ -614,7 +614,6 @@ object mon {
c.withTags(Map("client" -> client, "result" -> r))
val success = apply("success") _
val failure = apply("failure") _
val weak = apply("weak") _
val timeout = apply("timeout") _
val notFound = apply("notFound") _
val notAcquired = apply("notAcquired") _

View File

@ -20,7 +20,7 @@ final private class Cleaner(
import BSONHandlers._
private def analysisTimeout(plies: Int) = plies * 8.seconds + 3.seconds
private def analysisTimeout(plies: Int) = plies * 7.seconds + 3.seconds
private def analysisTimeoutBase = analysisTimeout(20)
private def durationAgo(d: FiniteDuration) = DateTime.now.minusSeconds(d.toSeconds.toInt)

View File

@ -92,14 +92,10 @@ final class FishnetApi(
data.completeOrPartial match {
case complete: CompleteAnalysis =>
{
if (complete.weak && work.game.variant.standard) {
Monitor.weak(work, client, complete)
repo.updateOrGiveUpAnalysis(work.weak) >> fufail(WeakAnalysis(client))
} else
analysisBuilder(client, work, complete.analysis) flatMap { analysis =>
monitor.analysis(work, client, complete)
repo.deleteAnalysis(work) inject PostAnalysisResult.Complete(analysis)
}
analysisBuilder(client, work, complete.analysis) flatMap { analysis =>
monitor.analysis(work, client, complete)
repo.deleteAnalysis(work) inject PostAnalysisResult.Complete(analysis)
}
} recoverWith { case e: Exception =>
Monitor.failure(work, client, e)
repo.updateOrGiveUpAnalysis(work.invalid) >> fufail(e)
@ -189,10 +185,6 @@ object FishnetApi {
analysisNodes: Int
)
case class WeakAnalysis(client: Client) extends LilaException {
val message = s"$client: Analysis nodes per move is too low"
}
case object WorkNotFound extends LilaException {
val message = "The work has disappeared"
}

View File

@ -65,11 +65,6 @@ object JsonApi {
.withFilter(e => !(e.mateFound || e.deadDraw))
.flatMap(_.nodes)
}
// fishnet 2.x analysis is never weak in this sense. It is either exactly
// the same as analysis provided by any other instance, or failed.
def strong = stockfish.flavor.isDefined || medianNodes.fold(true)(_ > Evaluation.legacyAcceptableNodes)
def weak = !strong
}
case class PartialAnalysis(
@ -107,9 +102,6 @@ object JsonApi {
}
val npsCeil = 10_000_000
private val legacyDesiredNodes = 3_000_000
val legacyAcceptableNodes = legacyDesiredNodes * 0.9
}
}
@ -194,11 +186,12 @@ object JsonApi {
"type" -> "analysis",
"id" -> a.id,
"nodes" -> Json.obj(
"nnue" -> a.nodes,
"classical" -> a.nodes * 2
"sf15" -> a.nodes,
"sf14" -> a.nodes * 14 / 10,
"nnue" -> a.nodes * 14 / 10, // bc fishnet <= 2.3.4
"classical" -> a.nodes * 28 / 10
)
),
"nodes" -> a.nodes * 2, // bc for fishnet 1.x clients without nnue
"skipPositions" -> a.skipPositions
)
}) ++ Json.toJson(work.game).as[JsObject]

View File

@ -123,13 +123,6 @@ object Monitor {
monResult.failure(client.userId.value).increment()
}
private[fishnet] def weak(work: Work, client: Client, data: JsonApi.Request.CompleteAnalysis) = {
logger.warn(
s"Received weak analysis ${work.id} (nodes: ${~data.medianNodes}) for ${work.game.id} by ${client.fullId}"
)
monResult.weak(client.userId.value).increment()
}
private[fishnet] def timeout(userId: Client.UserId) =
monResult.timeout(userId.value).increment()

View File

@ -102,7 +102,6 @@ object Work {
def timeout = copy(acquired = none)
def invalid = copy(acquired = none)
def weak = copy(acquired = none)
def isOutOfTries = tries >= 2