aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue/job-queue.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-04-21 14:55:10 +0200
committerChocobozzz <chocobozzz@cpy.re>2023-05-09 08:57:34 +0200
commit0c9668f77901e7540e2c7045eb0f2974a4842a69 (patch)
tree226d3dd1565b0bb56588897af3b8530e6216e96b /server/lib/job-queue/job-queue.ts
parent6bcb854cdea8688a32240bc5719c7d139806e00b (diff)
downloadPeerTube-0c9668f77901e7540e2c7045eb0f2974a4842a69.tar.gz
PeerTube-0c9668f77901e7540e2c7045eb0f2974a4842a69.tar.zst
PeerTube-0c9668f77901e7540e2c7045eb0f2974a4842a69.zip
Implement remote runner jobs in server
Move ffmpeg functions to @shared
Diffstat (limited to 'server/lib/job-queue/job-queue.ts')
-rw-r--r--server/lib/job-queue/job-queue.ts63
1 files changed, 34 insertions, 29 deletions
diff --git a/server/lib/job-queue/job-queue.ts b/server/lib/job-queue/job-queue.ts
index cc6be0bd8..21bf0f226 100644
--- a/server/lib/job-queue/job-queue.ts
+++ b/server/lib/job-queue/job-queue.ts
@@ -31,6 +31,7 @@ import {
31 MoveObjectStoragePayload, 31 MoveObjectStoragePayload,
32 NotifyPayload, 32 NotifyPayload,
33 RefreshPayload, 33 RefreshPayload,
34 TranscodingJobBuilderPayload,
34 VideoChannelImportPayload, 35 VideoChannelImportPayload,
35 VideoFileImportPayload, 36 VideoFileImportPayload,
36 VideoImportPayload, 37 VideoImportPayload,
@@ -56,6 +57,7 @@ import { processFederateVideo } from './handlers/federate-video'
56import { processManageVideoTorrent } from './handlers/manage-video-torrent' 57import { processManageVideoTorrent } from './handlers/manage-video-torrent'
57import { onMoveToObjectStorageFailure, processMoveToObjectStorage } from './handlers/move-to-object-storage' 58import { onMoveToObjectStorageFailure, processMoveToObjectStorage } from './handlers/move-to-object-storage'
58import { processNotify } from './handlers/notify' 59import { processNotify } from './handlers/notify'
60import { processTranscodingJobBuilder } from './handlers/transcoding-job-builder'
59import { processVideoChannelImport } from './handlers/video-channel-import' 61import { processVideoChannelImport } from './handlers/video-channel-import'
60import { processVideoFileImport } from './handlers/video-file-import' 62import { processVideoFileImport } from './handlers/video-file-import'
61import { processVideoImport } from './handlers/video-import' 63import { processVideoImport } from './handlers/video-import'
@@ -69,11 +71,12 @@ export type CreateJobArgument =
69 { type: 'activitypub-http-broadcast-parallel', payload: ActivitypubHttpBroadcastPayload } | 71 { type: 'activitypub-http-broadcast-parallel', payload: ActivitypubHttpBroadcastPayload } |
70 { type: 'activitypub-http-unicast', payload: ActivitypubHttpUnicastPayload } | 72 { type: 'activitypub-http-unicast', payload: ActivitypubHttpUnicastPayload } |
71 { type: 'activitypub-http-fetcher', payload: ActivitypubHttpFetcherPayload } | 73 { type: 'activitypub-http-fetcher', payload: ActivitypubHttpFetcherPayload } |
72 { type: 'activitypub-http-cleaner', payload: {} } | 74 { type: 'activitypub-cleaner', payload: {} } |
73 { type: 'activitypub-follow', payload: ActivitypubFollowPayload } | 75 { type: 'activitypub-follow', payload: ActivitypubFollowPayload } |
74 { type: 'video-file-import', payload: VideoFileImportPayload } | 76 { type: 'video-file-import', payload: VideoFileImportPayload } |
75 { type: 'video-transcoding', payload: VideoTranscodingPayload } | 77 { type: 'video-transcoding', payload: VideoTranscodingPayload } |
76 { type: 'email', payload: EmailPayload } | 78 { type: 'email', payload: EmailPayload } |
79 { type: 'transcoding-job-builder', payload: TranscodingJobBuilderPayload } |
77 { type: 'video-import', payload: VideoImportPayload } | 80 { type: 'video-import', payload: VideoImportPayload } |
78 { type: 'activitypub-refresher', payload: RefreshPayload } | 81 { type: 'activitypub-refresher', payload: RefreshPayload } |
79 { type: 'videos-views-stats', payload: {} } | 82 { type: 'videos-views-stats', payload: {} } |
@@ -96,28 +99,29 @@ export type CreateJobOptions = {
96} 99}
97 100
98const handlers: { [id in JobType]: (job: Job) => Promise<any> } = { 101const handlers: { [id in JobType]: (job: Job) => Promise<any> } = {
99 'activitypub-http-broadcast': processActivityPubHttpSequentialBroadcast,
100 'activitypub-http-broadcast-parallel': processActivityPubParallelHttpBroadcast,
101 'activitypub-http-unicast': processActivityPubHttpUnicast,
102 'activitypub-http-fetcher': processActivityPubHttpFetcher,
103 'activitypub-cleaner': processActivityPubCleaner, 102 'activitypub-cleaner': processActivityPubCleaner,
104 'activitypub-follow': processActivityPubFollow, 103 'activitypub-follow': processActivityPubFollow,
105 'video-file-import': processVideoFileImport, 104 'activitypub-http-broadcast-parallel': processActivityPubParallelHttpBroadcast,
106 'video-transcoding': processVideoTranscoding, 105 'activitypub-http-broadcast': processActivityPubHttpSequentialBroadcast,
106 'activitypub-http-fetcher': processActivityPubHttpFetcher,
107 'activitypub-http-unicast': processActivityPubHttpUnicast,
108 'activitypub-refresher': refreshAPObject,
109 'actor-keys': processActorKeys,
110 'after-video-channel-import': processAfterVideoChannelImport,
107 'email': processEmail, 111 'email': processEmail,
112 'federate-video': processFederateVideo,
113 'transcoding-job-builder': processTranscodingJobBuilder,
114 'manage-video-torrent': processManageVideoTorrent,
115 'move-to-object-storage': processMoveToObjectStorage,
116 'notify': processNotify,
117 'video-channel-import': processVideoChannelImport,
118 'video-file-import': processVideoFileImport,
108 'video-import': processVideoImport, 119 'video-import': processVideoImport,
109 'videos-views-stats': processVideosViewsStats,
110 'activitypub-refresher': refreshAPObject,
111 'video-live-ending': processVideoLiveEnding, 120 'video-live-ending': processVideoLiveEnding,
112 'actor-keys': processActorKeys,
113 'video-redundancy': processVideoRedundancy, 121 'video-redundancy': processVideoRedundancy,
114 'move-to-object-storage': processMoveToObjectStorage,
115 'manage-video-torrent': processManageVideoTorrent,
116 'video-studio-edition': processVideoStudioEdition, 122 'video-studio-edition': processVideoStudioEdition,
117 'video-channel-import': processVideoChannelImport, 123 'video-transcoding': processVideoTranscoding,
118 'after-video-channel-import': processAfterVideoChannelImport, 124 'videos-views-stats': processVideosViewsStats
119 'notify': processNotify,
120 'federate-video': processFederateVideo
121} 125}
122 126
123const errorHandlers: { [id in JobType]?: (job: Job, err: any) => Promise<any> } = { 127const errorHandlers: { [id in JobType]?: (job: Job, err: any) => Promise<any> } = {
@@ -125,28 +129,29 @@ const errorHandlers: { [id in JobType]?: (job: Job, err: any) => Promise<any> }
125} 129}
126 130
127const jobTypes: JobType[] = [ 131const jobTypes: JobType[] = [
132 'activitypub-cleaner',
128 'activitypub-follow', 133 'activitypub-follow',
129 'activitypub-http-broadcast',
130 'activitypub-http-broadcast-parallel', 134 'activitypub-http-broadcast-parallel',
135 'activitypub-http-broadcast',
131 'activitypub-http-fetcher', 136 'activitypub-http-fetcher',
132 'activitypub-http-unicast', 137 'activitypub-http-unicast',
133 'activitypub-cleaner', 138 'activitypub-refresher',
139 'actor-keys',
140 'after-video-channel-import',
134 'email', 141 'email',
135 'video-transcoding', 142 'federate-video',
143 'transcoding-job-builder',
144 'manage-video-torrent',
145 'move-to-object-storage',
146 'notify',
147 'video-channel-import',
136 'video-file-import', 148 'video-file-import',
137 'video-import', 149 'video-import',
138 'videos-views-stats',
139 'activitypub-refresher',
140 'video-redundancy',
141 'actor-keys',
142 'video-live-ending', 150 'video-live-ending',
143 'move-to-object-storage', 151 'video-redundancy',
144 'manage-video-torrent',
145 'video-studio-edition', 152 'video-studio-edition',
146 'video-channel-import', 153 'video-transcoding',
147 'after-video-channel-import', 154 'videos-views-stats'
148 'notify',
149 'federate-video'
150] 155]
151 156
152const silentFailure = new Set<JobType>([ 'activitypub-http-unicast' ]) 157const silentFailure = new Set<JobType>([ 'activitypub-http-unicast' ])