18
18
Priority ,
19
19
SequencingFileTag ,
20
20
)
21
+ from cg .constants .archiving import ArchiveLocations
21
22
from cg .constants .constants import AnalysisType , CaseActions , WorkflowManager
22
23
from cg .constants .priority import PRIORITY_TO_SLURM_QOS
23
24
from cg .exc import AnalysisNotReadyError , BundleAlreadyAddedError , CgDataError , CgError
@@ -491,7 +492,7 @@ def ensure_flow_cells_on_disk(self, case_id: str) -> None:
491
492
self .status_db .request_flow_cells_for_case (case_id )
492
493
493
494
def is_case_ready_for_analysis (self , case_id : str ) -> bool :
494
- if self .get_archive_location_for_case (case_id ) == " PDC" :
495
+ if self .get_archive_location_for_case (case_id ) == ArchiveLocations . PDC :
495
496
if self ._is_flow_cell_check_applicable (
496
497
case_id
497
498
) and not self .status_db .are_all_flow_cells_on_disk (case_id ):
@@ -516,9 +517,9 @@ def prepare_fastq_files(self, case_id: str, dry_run: bool) -> None:
516
517
if not self .is_case_ready_for_analysis (case_id ):
517
518
raise AnalysisNotReadyError ("FASTQ file are not present for the analysis to start" )
518
519
519
- def ensure_files_are_not_archived (self , case_id ):
520
+ def ensure_files_are_not_archived (self , case_id : str ):
520
521
"""Checks if any files are archived and submits a job to retrieve any which are."""
521
- if self .get_archive_location_for_case (case_id ) == " PDC" :
522
+ if self .get_archive_location_for_case (case_id ) == ArchiveLocations . PDC :
522
523
self .ensure_flow_cells_on_disk (case_id )
523
524
else :
524
525
if not self .are_all_files_present (case_id ):
@@ -529,7 +530,9 @@ def ensure_files_are_not_archived(self, case_id):
529
530
)
530
531
spring_archive_api .retrieve_case (case_id )
531
532
532
- def are_all_files_present (self , case_id ):
533
+ def are_all_files_present (self , case_id : str ) -> bool :
534
+ """Returns true if no Spring files are archived in the data location used by the customer tied to the given
535
+ case, and false otherwise."""
533
536
case : Case = self .status_db .get_case_by_internal_id (case_id )
534
537
for sample in [link .sample for link in case .links ]:
535
538
if (
@@ -540,5 +543,5 @@ def are_all_files_present(self, case_id):
540
543
return False
541
544
return True
542
545
543
- def get_archive_location_for_case (self , case_id : str ):
546
+ def get_archive_location_for_case (self , case_id : str ) -> str :
544
547
return self .status_db .get_case_by_internal_id (case_id ).customer .data_archive_location
0 commit comments