jbilcke-hf HF staff commited on
Commit
719147a
·
1 Parent(s): 585f76c

make things smoother, by copying the files BEFORe any update

Browse files
Files changed (1) hide show
  1. src/scheduler/processTask.mts +8 -12
src/scheduler/processTask.mts CHANGED
@@ -66,11 +66,9 @@ export const processTask = async (task: VideoTask) => {
66
  // download to /tmp
67
  await downloadFileToTmp(generatedPreviewVideoUrl, shot.fileName)
68
 
69
- // NO NEED to copy from /tmp to /data/pending
70
- // await copyVideoFromTmpToPending(shot.fileName)
71
 
72
- // copy from /tmp to /data/completed
73
- await copyVideoFromTmpToCompleted(shot.fileName, task.fileName)
74
 
75
  shot.hasGeneratedPreview = true
76
  shot.nbCompletedSteps++
@@ -116,10 +114,9 @@ export const processTask = async (task: VideoTask) => {
116
  shot.progressPercent = Math.round((shot.nbCompletedSteps / shot.nbTotalSteps) * 100)
117
  task.progressPercent = Math.round((nbCompletedSteps / nbTotalSteps) * 100)
118
 
119
- await updatePendingTask(task)
120
-
121
  await copyVideoFromPendingToCompleted(shot.fileName, task.fileName)
122
 
 
123
  } catch (err) {
124
  console.error(`failed to generate shot ${shot.id} (${err})`)
125
  // something is wrong, let's put the whole thing back into the queue
@@ -141,9 +138,9 @@ export const processTask = async (task: VideoTask) => {
141
  shot.progressPercent = Math.round((shot.nbCompletedSteps / shot.nbTotalSteps) * 100)
142
  task.progressPercent = Math.round((nbCompletedSteps / nbTotalSteps) * 100)
143
 
144
- await updatePendingTask(task)
145
-
146
  await copyVideoFromPendingToCompleted(shot.fileName, task.fileName)
 
 
147
  } catch (err) {
148
  console.error(`failed to upscale shot ${shot.id} (${err})`)
149
  // something is wrong, let's put the whole thing back into the queue
@@ -182,10 +179,10 @@ export const processTask = async (task: VideoTask) => {
182
  shot.progressPercent = Math.round((shot.nbCompletedSteps / shot.nbTotalSteps) * 100)
183
  task.progressPercent = Math.round((nbCompletedSteps / nbTotalSteps) * 100)
184
 
185
- await updatePendingTask(task)
186
-
187
  await copyVideoFromPendingToCompleted(shot.fileName, task.fileName)
188
 
 
 
189
  } catch (err) {
190
  console.error(`failed to interpolate shot ${shot.id} (${err})`)
191
  // something is wrong, let's put the whole thing back into the queue
@@ -215,10 +212,9 @@ export const processTask = async (task: VideoTask) => {
215
  shot.progressPercent = Math.round((shot.nbCompletedSteps / shot.nbTotalSteps) * 100)
216
  task.progressPercent = Math.round((nbCompletedSteps / nbTotalSteps) * 100)
217
 
218
- await updatePendingTask(task)
219
-
220
  await copyVideoFromPendingToCompleted(shot.fileName, task.fileName)
221
 
 
222
  } catch (err) {
223
  console.error(`failed to post-process shot ${shot.id} (${err})`)
224
  // something is wrong, let's put the whole thing back into the queue
 
66
  // download to /tmp
67
  await downloadFileToTmp(generatedPreviewVideoUrl, shot.fileName)
68
 
69
+ await copyVideoFromTmpToPending(shot.fileName)
 
70
 
71
+ await copyVideoFromPendingToCompleted(shot.fileName, task.fileName)
 
72
 
73
  shot.hasGeneratedPreview = true
74
  shot.nbCompletedSteps++
 
114
  shot.progressPercent = Math.round((shot.nbCompletedSteps / shot.nbTotalSteps) * 100)
115
  task.progressPercent = Math.round((nbCompletedSteps / nbTotalSteps) * 100)
116
 
 
 
117
  await copyVideoFromPendingToCompleted(shot.fileName, task.fileName)
118
 
119
+ await updatePendingTask(task)
120
  } catch (err) {
121
  console.error(`failed to generate shot ${shot.id} (${err})`)
122
  // something is wrong, let's put the whole thing back into the queue
 
138
  shot.progressPercent = Math.round((shot.nbCompletedSteps / shot.nbTotalSteps) * 100)
139
  task.progressPercent = Math.round((nbCompletedSteps / nbTotalSteps) * 100)
140
 
 
 
141
  await copyVideoFromPendingToCompleted(shot.fileName, task.fileName)
142
+
143
+ await updatePendingTask(task)
144
  } catch (err) {
145
  console.error(`failed to upscale shot ${shot.id} (${err})`)
146
  // something is wrong, let's put the whole thing back into the queue
 
179
  shot.progressPercent = Math.round((shot.nbCompletedSteps / shot.nbTotalSteps) * 100)
180
  task.progressPercent = Math.round((nbCompletedSteps / nbTotalSteps) * 100)
181
 
 
 
182
  await copyVideoFromPendingToCompleted(shot.fileName, task.fileName)
183
 
184
+ await updatePendingTask(task)
185
+
186
  } catch (err) {
187
  console.error(`failed to interpolate shot ${shot.id} (${err})`)
188
  // something is wrong, let's put the whole thing back into the queue
 
212
  shot.progressPercent = Math.round((shot.nbCompletedSteps / shot.nbTotalSteps) * 100)
213
  task.progressPercent = Math.round((nbCompletedSteps / nbTotalSteps) * 100)
214
 
 
 
215
  await copyVideoFromPendingToCompleted(shot.fileName, task.fileName)
216
 
217
+ await updatePendingTask(task)
218
  } catch (err) {
219
  console.error(`failed to post-process shot ${shot.id} (${err})`)
220
  // something is wrong, let's put the whole thing back into the queue