diff options
author | Chocobozzz <me@florianbigard.com> | 2023-05-04 15:29:34 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2023-05-09 08:57:34 +0200 |
commit | 5e47f6ab984a7d00782e4c7030afffa1ba480add (patch) | |
tree | 1ce586b591a8d71acbc301eba29b9a5e6490439e /server/controllers/api/runners/jobs.ts | |
parent | 6a4905602636afd6650c9e6f4d0fcc2105d91100 (diff) | |
download | PeerTube-5e47f6ab984a7d00782e4c7030afffa1ba480add.tar.gz PeerTube-5e47f6ab984a7d00782e4c7030afffa1ba480add.tar.zst PeerTube-5e47f6ab984a7d00782e4c7030afffa1ba480add.zip |
Support studio transcoding in peertube runner
Diffstat (limited to 'server/controllers/api/runners/jobs.ts')
-rw-r--r-- | server/controllers/api/runners/jobs.ts | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/server/controllers/api/runners/jobs.ts b/server/controllers/api/runners/jobs.ts index 7d488ec11..8e34c07a3 100644 --- a/server/controllers/api/runners/jobs.ts +++ b/server/controllers/api/runners/jobs.ts | |||
@@ -17,6 +17,7 @@ import { | |||
17 | import { | 17 | import { |
18 | abortRunnerJobValidator, | 18 | abortRunnerJobValidator, |
19 | acceptRunnerJobValidator, | 19 | acceptRunnerJobValidator, |
20 | cancelRunnerJobValidator, | ||
20 | errorRunnerJobValidator, | 21 | errorRunnerJobValidator, |
21 | getRunnerFromTokenValidator, | 22 | getRunnerFromTokenValidator, |
22 | jobOfRunnerGetValidator, | 23 | jobOfRunnerGetValidator, |
@@ -41,6 +42,7 @@ import { | |||
41 | RunnerJobUpdateBody, | 42 | RunnerJobUpdateBody, |
42 | RunnerJobUpdatePayload, | 43 | RunnerJobUpdatePayload, |
43 | UserRight, | 44 | UserRight, |
45 | VideoEditionTranscodingSuccess, | ||
44 | VODAudioMergeTranscodingSuccess, | 46 | VODAudioMergeTranscodingSuccess, |
45 | VODHLSTranscodingSuccess, | 47 | VODHLSTranscodingSuccess, |
46 | VODWebVideoTranscodingSuccess | 48 | VODWebVideoTranscodingSuccess |
@@ -110,6 +112,7 @@ runnerJobsRouter.post('/jobs/:jobUUID/cancel', | |||
110 | authenticate, | 112 | authenticate, |
111 | ensureUserHasRight(UserRight.MANAGE_RUNNERS), | 113 | ensureUserHasRight(UserRight.MANAGE_RUNNERS), |
112 | asyncMiddleware(runnerJobGetValidator), | 114 | asyncMiddleware(runnerJobGetValidator), |
115 | cancelRunnerJobValidator, | ||
113 | asyncMiddleware(cancelRunnerJob) | 116 | asyncMiddleware(cancelRunnerJob) |
114 | ) | 117 | ) |
115 | 118 | ||
@@ -297,6 +300,14 @@ const jobSuccessPayloadBuilders: { | |||
297 | } | 300 | } |
298 | }, | 301 | }, |
299 | 302 | ||
303 | 'video-edition-transcoding': (payload: VideoEditionTranscodingSuccess, files) => { | ||
304 | return { | ||
305 | ...payload, | ||
306 | |||
307 | videoFile: files['payload[videoFile]'][0].path | ||
308 | } | ||
309 | }, | ||
310 | |||
300 | 'live-rtmp-hls-transcoding': () => ({}) | 311 | 'live-rtmp-hls-transcoding': () => ({}) |
301 | } | 312 | } |
302 | 313 | ||
@@ -327,7 +338,7 @@ async function postRunnerJobSuccess (req: express.Request, res: express.Response | |||
327 | async function cancelRunnerJob (req: express.Request, res: express.Response) { | 338 | async function cancelRunnerJob (req: express.Request, res: express.Response) { |
328 | const runnerJob = res.locals.runnerJob | 339 | const runnerJob = res.locals.runnerJob |
329 | 340 | ||
330 | logger.info('Cancelling job %s (%s)', runnerJob.type, lTags(runnerJob.uuid, runnerJob.type)) | 341 | logger.info('Cancelling job %s (%s)', runnerJob.uuid, runnerJob.type, lTags(runnerJob.uuid, runnerJob.type)) |
331 | 342 | ||
332 | const RunnerJobHandler = getRunnerJobHandlerClass(runnerJob) | 343 | const RunnerJobHandler = getRunnerJobHandlerClass(runnerJob) |
333 | await new RunnerJobHandler().cancel({ runnerJob }) | 344 | await new RunnerJobHandler().cancel({ runnerJob }) |