Skip to content

Commit aa69f1e

Browse files
committed
Added objects for weekend schedule
1 parent 73a4b29 commit aa69f1e

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

inference/models/inference.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,6 @@ def refresh_status_and_store_results(self) -> None:
301301
"""Process this external job and update status/results"""
302302
try:
303303
api_client = InferenceAPIClient()
304-
# model_version = ModelVersion.objects.get(classification_type=self.inference_job.classification_type)
305304
model_version = self.inference_job.model_version
306305

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

320318
except Exception as e:

inference/signals.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,19 @@ def create_periodic_tasks(sender, **kwargs):
2222
name="Process inference queue (6pm-7am)",
2323
task="inference.tasks.process_inference_job_queue",
2424
)
25+
26+
# Create schedule the weekend
27+
weekend_crontab, _ = CrontabSchedule.objects.get_or_create(
28+
minute="*/5",
29+
hour="*",
30+
day_of_week="0,6",
31+
day_of_month="*",
32+
month_of_year="*",
33+
)
34+
35+
# Create the periodic task if it doesn't exist
36+
PeriodicTask.objects.get_or_create(
37+
crontab=weekend_crontab,
38+
name="Process inference queue (Weekends)",
39+
task="inference.tasks.process_inference_job_queue",
40+
)

inference/tasks.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ def process_inference_job_queue():
1818
return "Queue processing already in progress"
1919

2020
try:
21-
# Reevaluate progress and update status of all inference jobs that are not currently queued
22-
# for job in InferenceJob.objects.exclude(status=InferenceJobStatus.QUEUED):
23-
# job.reevaluate_progress_and_update_status()
24-
2521
# Look for pending jobs first
2622
pending_jobs = InferenceJob.objects.filter(status=InferenceJobStatus.PENDING)
2723

0 commit comments

Comments
 (0)