Skip to content

Commit 4fb9e0b

Browse files
authored
Merge pull request #490 from dres-dev/feature/467-perpetual-task
Perpetual tasks
2 parents 9480356 + 935ffe0 commit 4fb9e0b

44 files changed

Lines changed: 216 additions & 199 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

backend/src/main/kotlin/dev/dres/api/rest/types/evaluation/ApiClientTaskTemplateInfo.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ data class ApiClientTaskTemplateInfo(
1212
val name: String,
1313
val taskGroup: String,
1414
val taskType: String,
15-
val duration: Long
15+
val duration: Long?
1616
) {
1717
constructor(task: ApiTaskTemplate) : this(
1818
task.name,

backend/src/main/kotlin/dev/dres/api/rest/types/evaluation/ApiEvaluationState.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ data class ApiEvaluationState(
1818
val taskId: String?,
1919
val taskStatus: ApiTaskStatus,
2020
val taskTemplateId: String?,
21-
val timeLeft: Long,
21+
val timeLeft: Long?,
2222
val timeElapsed: Long
2323
) {
2424
constructor(run: InteractiveRunManager, context: RunActionContext) : this(
@@ -27,7 +27,7 @@ data class ApiEvaluationState(
2727
run.currentTask(context)?.taskId,
2828
run.currentTask(context)?.status ?: ApiTaskStatus.NO_TASK,
2929
run.currentTaskTemplate(context).templateId,
30-
run.timeLeft(context) / 1000,
30+
run.timeLeft(context)?.div(1000),
3131
run.timeElapsed(context) / 1000
3232
)
3333
}

backend/src/main/kotlin/dev/dres/api/rest/types/evaluation/ApiTaskOverview.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ data class ApiTaskOverview(
99
val name: String,
1010
val type: String,
1111
val group: String,
12-
val duration: Long,
12+
val duration: Long?,
1313
val taskId: String,
1414
val status: ApiTaskStatus,
1515
val started: Long?,
@@ -24,4 +24,4 @@ data class ApiTaskOverview(
2424
task.status,
2525
task.started,
2626
task.ended)
27-
}
27+
}

backend/src/main/kotlin/dev/dres/api/rest/types/evaluation/ApiTaskTemplateInfo.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ data class ApiTaskTemplateInfo(
1919
val comment: String?,
2020
val taskGroup: String,
2121
val taskType: String,
22-
val duration: Long
22+
val duration: Long?
2323
) {
2424
constructor(task: ApiTaskTemplate) : this(
2525
task.id!!,

backend/src/main/kotlin/dev/dres/api/rest/types/template/tasks/ApiTaskTemplate.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ data class ApiTaskTemplate(
2323
val name: String,
2424
val taskGroup: String,
2525
val taskType: String,
26-
val duration: Long,
26+
val duration: Long?,
2727
val collectionId: CollectionId,
2828
val targets: List<ApiTarget>,
2929
val hints: List<ApiHint>,

backend/src/main/kotlin/dev/dres/api/rest/types/template/tasks/ApiTaskType.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import java.nio.file.StandardOpenOption
2222
@Serializable
2323
data class ApiTaskType(
2424
val name: String,
25-
val duration: Long,
25+
val duration: Long?,
2626
val targetOption: ApiTargetOption,
2727
val hintOptions: List<ApiHintOption>,
2828
val submissionOptions: List<ApiSubmissionOption>,

backend/src/main/kotlin/dev/dres/api/rest/types/template/tasks/options/ApiScoreOption.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import dev.dres.data.model.template.task.options.DbScoreOption
1010
* @version 1.1.0
1111
*/
1212
enum class ApiScoreOption {
13-
KIS, AVS, LEGACY_AVS;
13+
KIS, AVS, LEGACY_AVS, NOOP;
1414

1515
/**
1616
* Converts this [ApiScoreOption] to a [DbScoreOption] representation. Requires an ongoing transaction.
@@ -21,5 +21,6 @@ enum class ApiScoreOption {
2121
KIS -> DbScoreOption.KIS
2222
AVS -> DbScoreOption.AVS
2323
LEGACY_AVS -> DbScoreOption.LEGACY_AVS
24+
NOOP -> DbScoreOption.NOOP
2425
}
2526
}

backend/src/main/kotlin/dev/dres/data/model/run/AbstractInteractiveTask.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import kotlinx.dnq.query.*
2020
abstract class AbstractInteractiveTask(store: TransientEntityStore, task: DbTask) : AbstractTask(store, task) {
2121

2222

23-
/** The total duration in milliseconds of this task. Usually determined by the [DbTaskTemplate] but can be adjusted! */
24-
abstract override var duration: Long
23+
/** The total duration in seconds of this task. Usually determined by the [DbTaskTemplate] but can be adjusted! */
24+
abstract override var duration: Long?
2525

2626
/** The [AnswerSetValidator] used to validate [DbSubmission]s. */
2727
final override val validator: AnswerSetValidator

backend/src/main/kotlin/dev/dres/data/model/run/InteractiveAsynchronousEvaluation.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ import dev.dres.run.filter.basics.SubmissionFilter
1616
import dev.dres.run.filter.basics.CombiningSubmissionFilter
1717
import dev.dres.run.score.scoreboard.MaxNormalizingScoreBoard
1818
import dev.dres.run.score.scoreboard.Scoreboard
19-
import dev.dres.run.score.scorer.AvsTaskScorer
20-
import dev.dres.run.score.scorer.CachingTaskScorer
21-
import dev.dres.run.score.scorer.KisTaskScorer
22-
import dev.dres.run.score.scorer.LegacyAvsTaskScorer
19+
import dev.dres.run.score.scorer.*
2320
import dev.dres.run.transformer.MapToSegmentTransformer
2421
import dev.dres.run.transformer.SubmissionTaskMatchTransformer
2522
import dev.dres.run.transformer.basics.SubmissionTransformer
@@ -161,8 +158,8 @@ class InteractiveAsynchronousEvaluation(store: TransientEntityStore, evaluation:
161158
/** The [CachingTaskScorer] instance used by this [InteractiveAsynchronousEvaluation].*/
162159
override val scorer: CachingTaskScorer
163160

164-
/** The total duration in milliseconds of this task. Usually determined by the [DbTaskTemplate] but can be adjusted! */
165-
override var duration: Long = this.template.duration
161+
/** The total duration in seconds of this task. Usually determined by the [DbTaskTemplate] but can be adjusted! NULL represents perpetual task*/
162+
override var duration: Long? = this.template.duration
166163

167164
val teamId = this.dbTask.team!!.id
168165

@@ -220,6 +217,7 @@ class InteractiveAsynchronousEvaluation(store: TransientEntityStore, evaluation:
220217

221218
DbScoreOption.AVS -> AvsTaskScorer(this, store)
222219
DbScoreOption.LEGACY_AVS -> LegacyAvsTaskScorer(this, store)
220+
DbScoreOption.NOOP -> NoOpTaskScorer(this)
223221
else -> throw IllegalStateException("The task score option $scoreOption is currently not supported.")
224222
}
225223
)

backend/src/main/kotlin/dev/dres/data/model/run/InteractiveSynchronousEvaluation.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ import dev.dres.run.filter.basics.SubmissionFilter
1616
import dev.dres.run.filter.basics.CombiningSubmissionFilter
1717
import dev.dres.run.score.scoreboard.MaxNormalizingScoreBoard
1818
import dev.dres.run.score.scoreboard.Scoreboard
19-
import dev.dres.run.score.scorer.AvsTaskScorer
20-
import dev.dres.run.score.scorer.CachingTaskScorer
21-
import dev.dres.run.score.scorer.KisTaskScorer
22-
import dev.dres.run.score.scorer.LegacyAvsTaskScorer
19+
import dev.dres.run.score.scorer.*
2320
import dev.dres.run.transformer.MapToSegmentTransformer
2421
import dev.dres.run.transformer.SubmissionTaskMatchTransformer
2522
import dev.dres.run.transformer.basics.SubmissionTransformer
@@ -118,8 +115,8 @@ class InteractiveSynchronousEvaluation(store: TransientEntityStore, evaluation:
118115
/** The [CachingTaskScorer] instance used by this [ISTaskRun]. */
119116
override val scorer: CachingTaskScorer
120117

121-
/** The total duration in milliseconds of this task. Usually determined by the [DbTaskTemplate] but can be adjusted! */
122-
override var duration: Long = this.template.duration
118+
/** The total duration in seconds of this task. Usually determined by the [DbTaskTemplate] but can be adjusted! NULL represents perpetual task */
119+
override var duration: Long? = this.template.duration
123120

124121
/** */
125122
override val teams: List<TeamId> =
@@ -176,6 +173,7 @@ class InteractiveSynchronousEvaluation(store: TransientEntityStore, evaluation:
176173

177174
DbScoreOption.AVS -> AvsTaskScorer(this, store)
178175
DbScoreOption.LEGACY_AVS -> LegacyAvsTaskScorer(this, store)
176+
DbScoreOption.NOOP -> NoOpTaskScorer(this)
179177
else -> throw IllegalStateException("The task score option $scoreOption is currently not supported.")
180178
}
181179
)

0 commit comments

Comments
 (0)