77
88
99class MeasurementsCheck (BaseCheck ):
10- def __init__ (self , log , path , config : Config , submission_logs : SubmissionLogs ):
10+ def __init__ (self , log , path , config : Config ,
11+ submission_logs : SubmissionLogs ):
1112 super ().__init__ (log , path )
1213 self .name = "measurement checks"
1314 self .submission_logs = submission_logs
1415 self .measurements_json = self .submission_logs .measurements_json
1516 self .submitter = self .submission_logs .loader_data .get ("submitter" , "" )
1617 self .division = self .submission_logs .loader_data .get ("division" , "" )
17- self .measurements_dir = self .submission_logs .loader_data .get ("measurements_dir" , "" )
18+ self .measurements_dir = self .submission_logs .loader_data .get (
19+ "measurements_dir" , "" )
20+ self .src_dir = self .submission_logs .loader_data .get ("src_path" , "" )
1821 self .config = config
1922 self .setup_checks ()
2023
2124 def setup_checks (self ):
2225 self .checks .append (self .missing_check )
26+ self .checks .append (self .directory_exist_check )
2327 self .checks .append (self .required_files_check )
2428 self .checks .append (self .required_fields_check )
25-
2629
2730 def missing_check (self ):
2831 if self .measurements_json is None :
@@ -32,7 +35,16 @@ def missing_check(self):
3235 )
3336 return False
3437 return True
35-
38+
39+ def directory_exist_check (self ):
40+ if not os .path .exists (self .src_dir ):
41+ self .log .error (
42+ "%s src directory does not exist" ,
43+ self .src_dir
44+ )
45+ return False
46+ return True
47+
3648 def required_files_check (self ):
3749 is_valid = True
3850 files = list_files (self .measurements_dir )
@@ -43,7 +55,10 @@ def required_files_check(self):
4355 elif not self .config .skip_empty_files_check and (
4456 os .stat (os .path .join (self .measurements_dir , i )).st_size == 0
4557 ):
46- self .log .error ("%s is having empty %s" , self .measurements_dir , i )
58+ self .log .error (
59+ "%s is having empty %s" ,
60+ self .measurements_dir ,
61+ i )
4762 is_valid = False
4863 return is_valid
4964
@@ -58,4 +73,4 @@ def required_fields_check(self):
5873 is_valid = False
5974 self .log .error (
6075 "%s, field %s is missing meaningful value" , self .path , k )
61- return is_valid
76+ return is_valid
0 commit comments