212# If files are too recent, wait before adding new files, but only if there are existing files
213if (latest_ready_jive_age < timeinterval) or (latest_ready_vp1_age < timeinterval):
214 msg.info("Wait for %ds before adding new events to the transfer queue. Last jive event in the queue was added %ds ago, last vp1 event in the queue was added %ds ago", timeinterval, latest_ready_jive_age, latest_ready_vp1_age)
215return
216
217#if the last but one pair is already ready for transfer, return, otherwise prepare it for transfer
218if len(file_pairs) > 1: # Ensure there are at least two elements to be able to get last but one element
219 second_last_element = file_pairs[-2]
220 jive_file, vp1_file = second_last_element
221
222 jive_without_extension = os.path.splitext(jive_file)[0] if jive_file elseNone
223
224# Extract relevant part from VP1 file using regex
225 vp1_match = re.match(r"(vp1_r\d+_ev\d+_u\d+)", vp1_file) if vp1_file elseNone
226 vp1_without_extension = vp1_match.group(1) if vp1_match elseNone
227
228 has_match = any(jive_without_extension in os.path.basename(f) for f in ready_jive) or any(vp1_without_extension in os.path.basename(f) for f in ready_vp1)
229if has_match:
230return
231if jive_file:
232 msg.info('%s going to zip file %s ready for transfer to eos', time.ctime(time.time()), jive_file)