diff options
author | Chocobozzz <me@florianbigard.com> | 2023-07-27 11:44:31 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-07-27 14:17:12 +0200 |
commit | f18003d0ac5c3fc6ec8de2a89102d1e1e89182df (patch) | |
tree | 0b3baa5658478607f3417fe7c747cc3a782f15b3 /server/lib/runners | |
parent | f5af5feb5a41eb6e2796e480402106b55bd10f04 (diff) | |
download | PeerTube-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.ts | 16 |
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' | |||
2 | import { retryTransactionWrapper } from '@server/helpers/database-utils' | 2 | import { retryTransactionWrapper } from '@server/helpers/database-utils' |
3 | import { logger, loggerTagsFactory } from '@server/helpers/logger' | 3 | import { logger, loggerTagsFactory } from '@server/helpers/logger' |
4 | import { sequelizeTypescript } from '@server/initializers/database' | 4 | import { sequelizeTypescript } from '@server/initializers/database' |
5 | import { MRunner } from '@server/types/models/runners' | 5 | import { MRunner, MRunnerJob } from '@server/types/models/runners' |
6 | import { RUNNER_JOBS } from '@server/initializers/constants' | 6 | import { RUNNER_JOBS } from '@server/initializers/constants' |
7 | import { RunnerJobState } from '@shared/models' | ||
7 | 8 | ||
8 | const lTags = loggerTagsFactory('runner') | 9 | const 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 | ||
36 | function 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 | |||
35 | export { | 46 | export { |
36 | updateLastRunnerContact | 47 | updateLastRunnerContact, |
48 | runnerJobCanBeCancelled | ||
37 | } | 49 | } |