Skip to content

Commit d46ae13

Browse files
committed
InferenceJob failure on no external jobs created, updated_at, only COMPLETED jobs sent for dump to delta migration
1 parent 55e358e commit d46ae13

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

inference/models/inference.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ def initiate(self, inference_api_url=settings.INFERENCE_API_URL) -> None:
168168

169169
if not created_batch:
170170
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
171175

172176
self.status = InferenceJobStatus.PENDING
173177
self.save()
@@ -197,17 +201,23 @@ def reevaluate_progress_and_update_status(self) -> None:
197201

198202
if self.get_ongoing_external_jobs().exists():
199203
self.status = InferenceJobStatus.PENDING
204+
self.updated_at = timezone.now()
200205
else:
201206
if self.get_failed_external_jobs().exists():
202207
self.status = InferenceJobStatus.FAILED
208+
self.updated_at = timezone.now()
203209
else:
204210
self.status = InferenceJobStatus.COMPLETED
211+
self.updated_at = timezone.now()
205212
self.completed_at = timezone.now()
206213
self.unload_model()
207214
self.save()
208215

209216
# 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]:
211221
self.collection.check_classifications_complete_and_finish_migration()
212222

213223
def unload_model(self) -> None:
@@ -303,7 +313,7 @@ def refresh_status_and_store_results(self) -> None:
303313
# Handle completion or failure
304314
if new_status == ExternalJobStatus.COMPLETED:
305315
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
307317
self.save()
308318

309319
except Exception as e:

0 commit comments

Comments
 (0)