@@ -161,8 +161,6 @@ def md5run_status(connection, **kwargs):
161161 check .brief_output .append ('did not complete checking all' )
162162 break
163163
164- # cnt of files to be triggered at this iteration of loop
165- n_runs_to_trigger = len (missing_md5_to_start + not_switched_status )
166164 # find bucket
167165 if 'FileProcessed' in a_file ['@type' ]:
168166 my_bucket = out_bucket
@@ -256,12 +254,21 @@ def md5run_uploaded_files(connection, **kwargs):
256254 query = '/search/?type=File&md5sum=No+value' + '' .join (['&status=' + s for s in statuses ])
257255
258256 files = {}
259- files ['uploaded_without_md5run' ] = [f ['accession' ] for f in ff_utils .search_metadata (
260- query + '&workflow_run_inputs.workflow.title%21=md5+0.2.6' , key = my_auth )]
261- files ['uploaded_with_md5run' ] = [f ['accession' ] for f in ff_utils .search_metadata (
262- query + '&workflow_run_inputs.workflow.title=md5+0.2.6' , key = my_auth )]
257+ no_md5_files = ff_utils .search_metadata (query , key = my_auth )
258+ no_md5_files = [f for f in no_md5_files if not wfr_utils .prereleased_and_not_uploaded (connection , f )]
259+ for f in no_md5_files :
260+ wfrs = f .get ('workflow_run_inputs' )
261+ has_md5run = False
262+ for wfr in wfrs :
263+ if wfr .get ('workflow' , {}).get ('title' ) == 'md5+0.2.6' :
264+ has_md5run = True
265+ break
266+ if has_md5run :
267+ files .setdefault ('files_with_md5run' , []).append (f ['accession' ])
268+ else :
269+ files .setdefault ('files_without_md5run' , []).append (f ['accession' ])
263270
264- if files [ 'uploaded_without_md5run' ] or files [ 'uploaded_with_md5run' ] :
271+ if files . get ( 'uploaded_without_md5run' ) or files . get ( 'uploaded_with_md5run' ) :
265272 check .status = 'WARN'
266273 check .summary = 'Some files need md5 run before release'
267274 check .description = 'Some files with status updloaded or higher are missing md5sum'
@@ -358,6 +365,9 @@ def fastqc_status(connection, **kwargs):
358365 query += '&lab.display_title=' + lab
359366 # The search
360367 res = ff_utils .search_metadata (query , key = my_auth )
368+ # check for pre-released status files that have not been uploaded (because they will become restricted)
369+ # and remove from res
370+ res = [f for f in res if not wfr_utils .prereleased_and_not_uploaded (connection , f )]
361371 if not res :
362372 check .summary = 'All Good!'
363373 return check
@@ -2074,7 +2084,7 @@ def fastq_first_line_status(connection, **kwargs):
20742084 # The search
20752085 print ('About to query ES for files' )
20762086 res = ff_utils .search_metadata (query , key = my_auth )
2077-
2087+ res = [ f for f in res if not wfr_utils . prereleased_and_not_uploaded ( connection , f )]
20782088 if not res :
20792089 check .summary = "All good!"
20802090 return check
0 commit comments