Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions inference/models/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ def refresh_status_and_store_results(self) -> None:
"""Process this external job and update status/results"""
try:
api_client = InferenceAPIClient()
# model_version = ModelVersion.objects.get(classification_type=self.inference_job.classification_type)
model_version = self.inference_job.model_version

response = api_client.get_job_status(model_version.api_identifier, self.external_job_id)
Expand All @@ -314,7 +313,6 @@ def refresh_status_and_store_results(self) -> None:
# Handle completion or failure
if new_status == ExternalJobStatus.COMPLETED:
self.store_results(response.get("results"))
# self.completed_at = timezone.now() # completed in mark_completed called in store_results
self.save()

except Exception as e:
Expand Down
16 changes: 16 additions & 0 deletions inference/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,19 @@ def create_periodic_tasks(sender, **kwargs):
name="Process inference queue (6pm-7am)",
task="inference.tasks.process_inference_job_queue",
)

# Create schedule the weekend
weekend_crontab, _ = CrontabSchedule.objects.get_or_create(
minute="*/5",
hour="*",
day_of_week="0,6",
day_of_month="*",
month_of_year="*",
)

# Create the periodic task if it doesn't exist
PeriodicTask.objects.get_or_create(
crontab=weekend_crontab,
name="Process inference queue (Weekends)",
task="inference.tasks.process_inference_job_queue",
)
4 changes: 0 additions & 4 deletions inference/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ def process_inference_job_queue():
return "Queue processing already in progress"

try:
# Reevaluate progress and update status of all inference jobs that are not currently queued
# for job in InferenceJob.objects.exclude(status=InferenceJobStatus.QUEUED):
# job.reevaluate_progress_and_update_status()

# Look for pending jobs first
pending_jobs = InferenceJob.objects.filter(status=InferenceJobStatus.PENDING)

Expand Down