38
38
create_placemarks ,
39
39
terrain_following_waylines ,
40
40
)
41
- from app .models .enums import FlightMode
41
+ from app .models .enums import FlightMode , ImageProcessingStatus
42
42
43
43
44
44
async def get_centroids (db : Connection ):
45
45
try :
46
46
async with db .cursor (row_factory = dict_row ) as cur :
47
- await cur .execute ("""
47
+ await cur .execute (
48
+ """
48
49
SELECT
49
50
p.id,
50
51
p.slug,
@@ -61,7 +62,8 @@ async def get_centroids(db: Connection):
61
62
task_events te ON t.id = te.task_id
62
63
GROUP BY
63
64
p.id, p.slug, p.name, p.centroid;
64
- """ )
65
+ """
66
+ )
65
67
centroids = await cur .fetchall ()
66
68
67
69
if not centroids :
@@ -335,6 +337,25 @@ async def process_drone_images(
335
337
)
336
338
337
339
340
+ async def update_processing_status (
341
+ db : Connection , project_id : uuid .UUID , status : ImageProcessingStatus
342
+ ):
343
+ print ("status = " , status .name )
344
+ """
345
+ Update the processing status to the specified status in the database.
346
+ """
347
+ await db .execute (
348
+ """
349
+ UPDATE projects
350
+ SET image_processing_status = %(status)s
351
+ WHERE id = %(project_id)s;
352
+ """ ,
353
+ {"status" : status .name , "project_id" : project_id },
354
+ )
355
+ await db .commit ()
356
+ return
357
+
358
+
338
359
async def process_all_drone_images (
339
360
project_id : uuid .UUID , tasks : list , user_id : str , db : Connection
340
361
):
@@ -363,6 +384,10 @@ async def process_all_drone_images(
363
384
webhook = webhook_url ,
364
385
)
365
386
387
+ # Update the processing status to 'IMAGE_PROCESSING_STARTED' in the database.
388
+ await update_processing_status (db , project_id , ImageProcessingStatus .PROCESSING )
389
+ return
390
+
366
391
367
392
def get_project_info_from_s3 (project_id : uuid .UUID , task_id : uuid .UUID ):
368
393
"""
0 commit comments