File tree Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 2
2
import logging
3
3
import time
4
4
5
+ from django .db import connection
6
+
5
7
# import pytest
6
- from django .test import TestCase
8
+ from django .test import TestCase , TransactionTestCase
7
9
from guardian .shortcuts import assign_perm
8
10
from rest_framework .test import APIRequestFactory , APITestCase
9
11
@@ -210,7 +212,7 @@ def test_cancel_job(self):
210
212
pass
211
213
212
214
213
- class TestMLJobBatchProcessing (TestCase ):
215
+ class TestMLJobBatchProcessing (TransactionTestCase ):
214
216
def setUp (self ):
215
217
self .project = Project .objects .first () # get the original test project
216
218
assert self .project
@@ -382,9 +384,11 @@ def get_ml_subtask_details(task_name, job):
382
384
return details
383
385
384
386
job .run ()
387
+ connection .commit ()
388
+ job .refresh_from_db ()
385
389
386
390
start_time = time .time ()
387
- timeout = 10 # seconds
391
+ timeout = 30 # seconds
388
392
elapsed_time = 0
389
393
390
394
while elapsed_time < timeout :
Original file line number Diff line number Diff line change @@ -164,7 +164,9 @@ def collect_images(
164
164
def process_pipeline_request (pipeline_request : dict , project_id : int ):
165
165
# TODO: instead of dict can we use pipeline request object?
166
166
"""
167
- Placeholder for the processing service's request processing logic
167
+ This is the primary function for processing images on the antenna side.
168
+ Workers have a function of the same name which will run their own inference/processing logic.
169
+ On the antenna side, we use external servers via an API to process images.
168
170
"""
169
171
request_data = PipelineRequest (** pipeline_request )
170
172
source_image_requests = request_data .source_images
Original file line number Diff line number Diff line change @@ -137,6 +137,4 @@ def check_ml_job_status(ml_job_id: int):
137
137
from django .db import transaction
138
138
139
139
logger .info (f"ML Job { ml_job_id } still in progress. Checking again for completed tasks." )
140
- transaction .on_commit (
141
- lambda : check_ml_job_status .apply_async ([ml_job_id ], countdown = 10 )
142
- ) # check again in 10 seconds
140
+ transaction .on_commit (lambda : check_ml_job_status .apply_async ([ml_job_id ])) # check again in 10 seconds
You can’t perform that action at this time.
0 commit comments