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

v2.0.1 Quality of Live Improvements #470

Merged
merged 19 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0ecbc15
Bump ip from 1.1.5 to 1.1.9 in /frontend
dependabot[bot] Mar 8, 2024
379d221
Bump follow-redirects from 1.15.4 to 1.15.6 in /frontend
dependabot[bot] Mar 16, 2024
f0a4e47
Bump webpack-dev-middleware from 5.3.3 to 5.3.4 in /frontend
dependabot[bot] Mar 21, 2024
cb78195
Bump express from 4.18.2 to 4.19.2 in /frontend
dependabot[bot] Mar 28, 2024
58d7985
Bump tar from 6.1.11 to 6.2.1 in /frontend
dependabot[bot] Apr 11, 2024
4740fb9
Fixed some issues relating to the export of the run
sauterl May 6, 2024
cded493
Added a filter to the team building dialog
sauterl May 22, 2024
12286bd
Added recovery for broken runs and disabled the start run button if t…
sauterl May 24, 2024
c55e93f
Added known issue to the README
sauterl May 24, 2024
b7082a4
Added auto-scroll to teambuilder dialog
sauterl May 24, 2024
cd85253
Streamlined the media item references in Api types
sauterl May 24, 2024
91b03df
Bump version to 2.0.1
sauterl May 24, 2024
24f4dbd
Merge pull request #462 from dres-dev/dependabot/npm_and_yarn/fronten…
sauterl May 26, 2024
193622b
Merge pull request #461 from dres-dev/dependabot/npm_and_yarn/fronten…
sauterl May 26, 2024
44e9db7
Merge pull request #463 from dres-dev/dependabot/npm_and_yarn/fronten…
sauterl May 26, 2024
e5782db
Merge pull request #465 from dres-dev/dependabot/npm_and_yarn/fronten…
sauterl May 26, 2024
bb47623
Merge pull request #464 from dres-dev/dependabot/npm_and_yarn/fronten…
sauterl May 26, 2024
bf1d57f
Addressed PR comments
sauterl May 26, 2024
b832cd4
Merge branch 'dev' of github.com:dres-dev/DRES into dev
sauterl May 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,7 @@ _none_

### Frontend

**Safari is NOT supported**
* Task duration greater than `9999999` break things. Do not use such long tasks.
* Safari is NOT supported


2 changes: 1 addition & 1 deletion backend/src/main/kotlin/dev/dres/DRES.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import kotlin.system.exitProcess
*/
object DRES {
/** Version of DRES. */
const val VERSION = "2.0.0"
const val VERSION = "2.0.1"

/** Application root; should be relative to JAR file or classes path. */
val APPLICATION_ROOT: Path =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dev.dres.api.rest.handler.download

import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import dev.dres.api.rest.handler.GetRestHandler
import dev.dres.api.rest.types.evaluation.ApiEvaluation
import dev.dres.api.rest.types.status.ErrorStatus
import dev.dres.api.rest.types.status.ErrorStatusException
import dev.dres.data.model.run.DbEvaluation
Expand All @@ -18,7 +18,7 @@ import kotlinx.dnq.query.query
* @author Ralph Gasser
* @version 1.0.0
*/
class EvaluationDownloadHandler(private val store: TransientEntityStore) : AbstractDownloadHandler(), GetRestHandler<String> {
class EvaluationDownloadHandler(private val store: TransientEntityStore) : AbstractDownloadHandler(), GetRestHandler<ApiEvaluation> {

/** The route of this [EvaluationDownloadHandler]. */
override val route = "download/evaluation/{evaluationId}"
Expand All @@ -32,14 +32,14 @@ class EvaluationDownloadHandler(private val store: TransientEntityStore) : Abstr
OpenApiParam("evaluationId", String::class, "The evaluation ID.", required = true)
],
responses = [
OpenApiResponse("200", [OpenApiContent(String::class, type = "application/json")]),
OpenApiResponse("200", [OpenApiContent(ApiEvaluation::class)]),
OpenApiResponse("400", [OpenApiContent(ErrorStatus::class)]),
OpenApiResponse("401", [OpenApiContent(ErrorStatus::class)]),
OpenApiResponse("404", [OpenApiContent(ErrorStatus::class)])
],
methods = [HttpMethod.GET]
)
override fun doGet(ctx: Context): String {
override fun doGet(ctx: Context): ApiEvaluation {
/* Obtain run id and run. */
val evaluationId = ctx.pathParamMap().getOrElse("evaluationId") { throw ErrorStatusException(400, "Parameter 'evaluationId' is missing!'", ctx) }
val evaluation = this.store.transactional(true) {
Expand All @@ -51,7 +51,6 @@ class EvaluationDownloadHandler(private val store: TransientEntityStore) : Abstr
ctx.header("Content-Disposition", "attachment; filename=\"run-${evaluationId}.json\"")

/* Return value. */
val mapper = jacksonObjectMapper()
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(evaluation)
return evaluation
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import dev.dres.api.rest.handler.GetRestHandler
import dev.dres.api.rest.types.status.ErrorStatus
import dev.dres.api.rest.types.status.ErrorStatusException
import dev.dres.api.rest.types.template.ApiEvaluationTemplate
import dev.dres.data.model.template.DbEvaluationTemplate
import io.javalin.http.Context
import io.javalin.openapi.*
Expand All @@ -18,7 +19,8 @@ import kotlinx.dnq.query.query
* @author Ralph Gasser
* @version 1.0.0
*/
class EvaluationTemplateDownloadHandler(private val store: TransientEntityStore) : AbstractDownloadHandler(), GetRestHandler<String> {
class EvaluationTemplateDownloadHandler(private val store: TransientEntityStore) : AbstractDownloadHandler(),
GetRestHandler<ApiEvaluationTemplate> {

/** The route of this [EvaluationTemplateDownloadHandler]. */
override val route = "download/template/{templateId}"
Expand All @@ -39,7 +41,7 @@ class EvaluationTemplateDownloadHandler(private val store: TransientEntityStore)
],
methods = [HttpMethod.GET]
)
override fun doGet(ctx: Context): String {
override fun doGet(ctx: Context): ApiEvaluationTemplate {
/* Obtain run id and run. */
val templateId = ctx.pathParamMap()["templateId"] ?: throw ErrorStatusException(400, "Parameter 'templateId' is missing!'", ctx)
val template = this.store.transactional(true) {
Expand All @@ -51,7 +53,6 @@ class EvaluationTemplateDownloadHandler(private val store: TransientEntityStore)
ctx.header("Content-Disposition", "attachment; filename=\"evaluation-template-${templateId}.json")

/* Return value. */
val mapper = jacksonObjectMapper()
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(template)
return template
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package dev.dres.api.rest.handler.evaluation.viewer

import dev.dres.DRES
import dev.dres.api.rest.handler.GetRestHandler
import dev.dres.api.rest.handler.evaluation.viewer.AbstractEvaluationViewerHandler
import dev.dres.api.rest.types.ViewerInfo
import dev.dres.api.rest.types.template.tasks.ApiHintContent
import dev.dres.api.rest.types.status.ErrorStatus
Expand Down Expand Up @@ -140,8 +139,8 @@ class GetTaskHintHandler(private val store: TransientEntityStore, private val ca
private fun ApiHint.toContentElement(): ApiContentElement {

//TODO find a better place for this lookup
val item = this.mediaItem?.let {itemId ->
DbMediaItem.filter { it.mediaItemId eq itemId }.firstOrNull()
val item = this.item?.let { item ->
DbMediaItem.filter { it.mediaItemId eq item.mediaItemId }.firstOrNull()
}
val range = if (item?.fps != null) {
this.range?.toTemporalRange(item.fps!!)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package dev.dres.api.rest.types.evaluation

import dev.dres.api.rest.types.evaluation.submission.ApiAnswerSet
import dev.dres.api.rest.types.evaluation.submission.ApiClientSubmission
import dev.dres.api.rest.types.evaluation.submission.ApiSubmission
import dev.dres.data.model.run.DbTask
import dev.dres.data.model.run.TaskId
import dev.dres.data.model.template.TemplateId
Expand All @@ -19,5 +21,5 @@ data class ApiTask(
val templateId: TemplateId,
val started: Long?,
val ended: Long?,
val submissions: List<ApiAnswerSet>
)
val submissions: List<ApiSubmission>
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.dres.api.rest.types.template.tasks

import dev.dres.api.rest.types.collection.ApiMediaItem
import dev.dres.api.rest.types.collection.time.ApiTemporalRange
import dev.dres.data.model.template.*
import kotlinx.serialization.Serializable
Expand Down Expand Up @@ -65,12 +66,7 @@ data class ApiHint(
*
* This is the reference to the media item
*/
val mediaItem: String? = null,

/**
* This is a reference to the media item's name, in case there is one.
*/
val mediaItemName: String? = null,
val item: ApiMediaItem? = null,

/**
* In case [type] is
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.dres.api.rest.types.template.tasks

import dev.dres.api.rest.types.collection.ApiMediaItem
import dev.dres.api.rest.types.collection.time.ApiTemporalRange
import dev.dres.data.model.template.task.DbTaskTemplateTarget
import kotlinx.serialization.Serializable
Expand All @@ -19,7 +20,7 @@ data class ApiTarget(
val target: String? = null,
val range: ApiTemporalRange? = null,
/**
* The name of the target, which is defined for certain types (e.g. [ApiTargetType]-MEDIA_TIEM )
* The target as item, which is only defined for certain types (e.g. [ApiTargetType]-MEDIA_TIEM )
*/
val name: String? = null
val item: ApiMediaItem? = null
)
11 changes: 8 additions & 3 deletions backend/src/main/kotlin/dev/dres/data/model/run/DbTask.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dev.dres.data.model.run

import dev.dres.api.rest.types.evaluation.ApiTask
import dev.dres.api.rest.types.evaluation.submission.ApiClientSubmission
import dev.dres.data.model.PersistentEntity
import dev.dres.data.model.submissions.AnswerSet
import dev.dres.data.model.template.task.DbTaskTemplate
Expand All @@ -11,6 +12,7 @@ import dev.dres.data.model.template.team.DbTeam
import jetbrains.exodus.entitystore.Entity
import kotlinx.dnq.*
import kotlinx.dnq.query.asSequence
import kotlinx.dnq.query.mapDistinct
import kotlinx.dnq.util.isInstanceOf
import java.lang.IllegalStateException

Expand Down Expand Up @@ -47,9 +49,12 @@ class DbTask(entity: Entity) : PersistentEntity(entity) {
/** Link to a [DbTeam] this [DbTask] was created for. Can be NULL!*/
var team by xdLink0_1(DbTeam)

/** List of [DbSubmission]s received by this [DbTask]. */
/** List of [DbAnswerSet]s received by this [DbTask]. */
val answerSets by xdLink0_N<DbTask,DbAnswerSet>(DbAnswerSet::task)

/** List of [DbSubmission]s received by this [DbTask].*/
fun submissions() = this.answerSets.asSequence().map{it.submission}.toList()

/**
* Converts this [DbTask] to a RESTful API representation [ApiTask].
*
Expand All @@ -62,6 +67,6 @@ class DbTask(entity: Entity) : PersistentEntity(entity) {
templateId = this.template.id,
started = this.started,
ended = this.ended,
submissions = this.answerSets.asSequence().map { it.toApi() }.toList()
submissions = submissions().map { it.toApi() }.toList()
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ class DbHint(entity: Entity) : XdEntity(entity) {
start = this.start,
end = this.end,
description = this.text,
mediaItem = this.item?.id,
mediaItemName = this.item?.name,
item = this.item?.toApi(),
dataType = this.type.mimeType,
path = this.path,
range = this.range?.let { ApiTemporalRange(it) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class DbTaskTemplateTarget(entity: Entity) : XdEntity(entity) {
type=this.type.toApi(),
target = this.item?.id,
range= this.range?.let { ApiTemporalRange(it) },
name= this.item?.name
item = this.item?.toApi()
)
DbTargetType.TEXT -> ApiTarget(this.type.toApi(), this.text)
else -> throw IllegalStateException("Task description of type ${this.type.description} is not supported.")
Expand Down
3 changes: 2 additions & 1 deletion backend/src/main/kotlin/dev/dres/mgmt/TemplateManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,9 @@ object TemplateManager {
task.hints.add(DbHint.new {
this.type = hint.type.toDb()
this.item =
hint.mediaItem?.let { DbMediaItem.query(DbMediaItem::id eq hint.mediaItem).firstOrNull() }
hint.item?.let { DbMediaItem.query(DbMediaItem::id eq hint.item.mediaItemId).firstOrNull() }
this.text = hint.description

this.path = hint.path
this.start = hint.start
this.end = hint.end
Expand Down
16 changes: 13 additions & 3 deletions backend/src/main/kotlin/dev/dres/run/RunExecutor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,19 @@ object RunExecutor {
DbEvaluation.filter { (it.ended eq null) }.asSequence().forEach { evaluation ->
try {
this.schedule(evaluation.toRunManager(store)) /* Re-schedule evaluations. */
} catch (e: IllegalStateException) {
logger.error("Could not re-schedule previous run: ${e.message}")
evaluation.ended = System.currentTimeMillis()
} catch (e: RuntimeException) {
when (e) {
is IllegalStateException,
is IllegalArgumentException -> {
logger.error("Could not re-schedule previous run: ${e.message}")
evaluation.ended = System.currentTimeMillis()
}

else -> {
logger.error("Fatal error during re-scheduling of previous run (${evaluation.evaluationId}): ${e.message}")
throw e
}
}
}
}
}
Expand Down
17 changes: 7 additions & 10 deletions doc/oas-client.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"openapi" : "3.0.3",
"info" : {
"title" : "DRES Client API",
"version" : "2.0.0-RC5",
"description" : "Client API for DRES (Distributed Retrieval Evaluation Server), Version 2.0.0-RC5"
"version" : "2.0.1",
"description" : "Client API for DRES (Distributed Retrieval Evaluation Server), Version 2.0.1"
},
"paths" : {
"/api/v2/client/evaluation/currentTask/{evaluationId}" : {
Expand Down Expand Up @@ -1342,7 +1342,7 @@
"submissions" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/ApiAnswerSet"
"$ref" : "#/components/schemas/ApiSubmission"
}
}
},
Expand Down Expand Up @@ -2021,11 +2021,8 @@
"dataType" : {
"type" : "string"
},
"mediaItem" : {
"type" : "string"
},
"mediaItemName" : {
"type" : "string"
"item" : {
"$ref" : "#/components/schemas/ApiMediaItem"
},
"range" : {
"$ref" : "#/components/schemas/ApiTemporalRange"
Expand Down Expand Up @@ -2069,8 +2066,8 @@
"range" : {
"$ref" : "#/components/schemas/ApiTemporalRange"
},
"name" : {
"type" : "string"
"item" : {
"$ref" : "#/components/schemas/ApiMediaItem"
}
},
"required" : [ "type" ]
Expand Down
21 changes: 9 additions & 12 deletions doc/oas.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"openapi" : "3.0.3",
"info" : {
"title" : "DRES API",
"version" : "2.0.0-RC5",
"description" : "API for DRES (Distributed Retrieval Evaluation Server), Version 2.0.0-RC5",
"version" : "2.0.1",
"description" : "API for DRES (Distributed Retrieval Evaluation Server), Version 2.0.1",
"contact" : {
"name" : "The DRES Dev Team",
"url" : "https://dres.dev"
Expand Down Expand Up @@ -594,9 +594,9 @@
"200" : {
"description" : "OK",
"content" : {
"text/plain" : {
"application/json" : {
"schema" : {
"type" : "string"
"$ref" : "#/components/schemas/ApiEvaluation"
}
}
}
Expand Down Expand Up @@ -5756,7 +5756,7 @@
"submissions" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/ApiAnswerSet"
"$ref" : "#/components/schemas/ApiSubmission"
}
}
},
Expand Down Expand Up @@ -6435,11 +6435,8 @@
"dataType" : {
"type" : "string"
},
"mediaItem" : {
"type" : "string"
},
"mediaItemName" : {
"type" : "string"
"item" : {
"$ref" : "#/components/schemas/ApiMediaItem"
},
"range" : {
"$ref" : "#/components/schemas/ApiTemporalRange"
Expand Down Expand Up @@ -6483,8 +6480,8 @@
"range" : {
"$ref" : "#/components/schemas/ApiTemporalRange"
},
"name" : {
"type" : "string"
"item" : {
"$ref" : "#/components/schemas/ApiMediaItem"
}
},
"required" : [ "type" ]
Expand Down
Loading
Loading