aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/runners
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-07-27 11:44:31 +0200
committerChocobozzz <me@florianbigard.com>2023-07-27 14:17:12 +0200
commitf18003d0ac5c3fc6ec8de2a89102d1e1e89182df (patch)
tree0b3baa5658478607f3417fe7c747cc3a782f15b3 /server/lib/runners
parentf5af5feb5a41eb6e2796e480402106b55bd10f04 (diff)
downloadPeerTube-f18003d0ac5c3fc6ec8de2a89102d1e1e89182df.tar.gz
PeerTube-f18003d0ac5c3fc6ec8de2a89102d1e1e89182df.tar.zst
PeerTube-f18003d0ac5c3fc6ec8de2a89102d1e1e89182df.zip
Improve runner management
* Add ability to remove runner jobs * Add runner job state quick filter * Merge registration tokens and runners tables in the same page * Add copy button to copy registration token
Diffstat (limited to 'server/lib/runners')
-rw-r--r--server/lib/runners/runner.ts16
1 files changed, 14 insertions, 2 deletions
diff --git a/server/lib/runners/runner.ts b/server/lib/runners/runner.ts
index 921cae6f2..947fdb3f0 100644
--- a/server/lib/runners/runner.ts
+++ b/server/lib/runners/runner.ts
@@ -2,8 +2,9 @@ import express from 'express'
2import { retryTransactionWrapper } from '@server/helpers/database-utils' 2import { retryTransactionWrapper } from '@server/helpers/database-utils'
3import { logger, loggerTagsFactory } from '@server/helpers/logger' 3import { logger, loggerTagsFactory } from '@server/helpers/logger'
4import { sequelizeTypescript } from '@server/initializers/database' 4import { sequelizeTypescript } from '@server/initializers/database'
5import { MRunner } from '@server/types/models/runners' 5import { MRunner, MRunnerJob } from '@server/types/models/runners'
6import { RUNNER_JOBS } from '@server/initializers/constants' 6import { RUNNER_JOBS } from '@server/initializers/constants'
7import { RunnerJobState } from '@shared/models'
7 8
8const lTags = loggerTagsFactory('runner') 9const lTags = loggerTagsFactory('runner')
9 10
@@ -32,6 +33,17 @@ function updateLastRunnerContact (req: express.Request, runner: MRunner) {
32 .finally(() => updatingRunner.delete(runner.id)) 33 .finally(() => updatingRunner.delete(runner.id))
33} 34}
34 35
36function runnerJobCanBeCancelled (runnerJob: MRunnerJob) {
37 const allowedStates = new Set<RunnerJobState>([
38 RunnerJobState.PENDING,
39 RunnerJobState.PROCESSING,
40 RunnerJobState.WAITING_FOR_PARENT_JOB
41 ])
42
43 return allowedStates.has(runnerJob.state)
44}
45
35export { 46export {
36 updateLastRunnerContact 47 updateLastRunnerContact,
48 runnerJobCanBeCancelled
37} 49}