@@ -168,6 +168,10 @@ def initiate(self, inference_api_url=settings.INFERENCE_API_URL) -> None:
168
168
169
169
if not created_batch :
170
170
self .log_error_and_set_status_failed ("No external jobs created" )
171
+ self .status = InferenceJobStatus .FAILED
172
+ self .updated_at = timezone .now ()
173
+ self .save ()
174
+ return
171
175
172
176
self .status = InferenceJobStatus .PENDING
173
177
self .save ()
@@ -197,17 +201,23 @@ def reevaluate_progress_and_update_status(self) -> None:
197
201
198
202
if self .get_ongoing_external_jobs ().exists ():
199
203
self .status = InferenceJobStatus .PENDING
204
+ self .updated_at = timezone .now ()
200
205
else :
201
206
if self .get_failed_external_jobs ().exists ():
202
207
self .status = InferenceJobStatus .FAILED
208
+ self .updated_at = timezone .now ()
203
209
else :
204
210
self .status = InferenceJobStatus .COMPLETED
211
+ self .updated_at = timezone .now ()
205
212
self .completed_at = timezone .now ()
206
213
self .unload_model ()
207
214
self .save ()
208
215
209
216
# If job is completed or failed, check if all classifications are done
210
- if self .status in [InferenceJobStatus .COMPLETED , InferenceJobStatus .FAILED ]:
217
+ # if self.status in [InferenceJobStatus.COMPLETED, InferenceJobStatus.FAILED]:
218
+ # self.collection.check_classifications_complete_and_finish_migration()
219
+
220
+ if self .status in [InferenceJobStatus .COMPLETED ]:
211
221
self .collection .check_classifications_complete_and_finish_migration ()
212
222
213
223
def unload_model (self ) -> None :
@@ -303,7 +313,7 @@ def refresh_status_and_store_results(self) -> None:
303
313
# Handle completion or failure
304
314
if new_status == ExternalJobStatus .COMPLETED :
305
315
self .store_results (response .get ("results" ))
306
- self .completed_at = timezone .now ()
316
+ # self.completed_at = timezone.now() # completed in mark_completed called in store_results
307
317
self .save ()
308
318
309
319
except Exception as e :
0 commit comments