1
1
from __future__ import annotations
2
2
3
- import base64
4
3
import logging
5
- import zlib
6
4
from dataclasses import dataclass
7
5
from datetime import date , datetime
8
6
from typing import Literal , TypedDict
@@ -380,10 +378,6 @@ def save_test_flag_bridges(
380
378
db_session .execute (insert_on_conflict_do_nothing_flags )
381
379
db_session .commit ()
382
380
383
- def decode_raw_file (self , file : bytes ) -> bytes :
384
- file_bytes = zlib .decompress (base64 .b64decode (file ))
385
- return file_bytes
386
-
387
381
def parse_file (
388
382
self ,
389
383
file_bytes : bytes ,
@@ -438,8 +432,6 @@ def process_individual_upload(
438
432
439
433
parsing_results , readable_files = result
440
434
441
- upload .state = "processed"
442
-
443
435
if all (len (result ["testruns" ]) == 0 for result in parsing_results ):
444
436
successful = False
445
437
log .error (
@@ -460,6 +452,7 @@ def process_individual_upload(
460
452
upload .flag_names ,
461
453
)
462
454
455
+ upload .state = "processed"
463
456
db_session .commit ()
464
457
465
458
log .info (
@@ -469,24 +462,14 @@ def process_individual_upload(
469
462
if should_delete_archive :
470
463
self .delete_archive (archive_service , upload )
471
464
else :
465
+ log .info (
466
+ "Writing readable files to archive" ,
467
+ extra = dict (upload_id = upload_id , readable_files = readable_files ),
468
+ )
472
469
archive_service .write_file (upload .storage_path , readable_files )
473
470
474
471
return {"successful" : successful }
475
472
476
- def rewrite_readable (
477
- self , network : list [str ] | None , report_contents : list [ReadableFile ]
478
- ) -> bytes :
479
- buffer = b""
480
- if network is not None :
481
- for file in network :
482
- buffer += f"{ file } \n " .encode ("utf-8" )
483
- buffer += b"<<<<<< network\n \n "
484
- for report_content in report_contents :
485
- buffer += f"# path={ report_content .path } \n " .encode ("utf-8" )
486
- buffer += report_content .contents
487
- buffer += b"\n <<<<<< EOF\n \n "
488
- return buffer
489
-
490
473
def should_delete_archive (self , commit_yaml ):
491
474
if get_config ("services" , "minio" , "expire_raw_after_n_days" ):
492
475
return True
0 commit comments