197 msg = logging.getLogger(
'EventUtils' )
198 msg.info(
'%s begin prepare files for transfer', time.ctime(time.time()))
200 ready_jive = glob.glob(f
"{directory}/*.zip")
201 copied_jive = glob.glob(f
"{directory}/*.zip.COPIED")
202 ready_vp1 = glob.glob(f
"{directory}/*.online.pool.root")
203 copied_vp1 = glob.glob(f
"{directory}/*.online.pool.root.COPIED")
205 if len(ready_jive)>len(copied_jive)
or len(ready_vp1)>len(copied_vp1):
206 msg.info(
"There are files about to be transferred. Do not attempt to add new files to be transferred.")
213 if (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)
218 if len(file_pairs) > 1:
219 second_last_element = file_pairs[-2]
220 jive_file, vp1_file = second_last_element
222 jive_without_extension = os.path.splitext(jive_file)[0]
if jive_file
else None
225 vp1_match = re.match(
r"(vp1_r\d+_ev\d+_u\d+)", vp1_file)
if vp1_file
else None
226 vp1_without_extension = vp1_match.group(1)
if vp1_match
else None
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)
232 msg.info(
'%s going to zip file %s ready for transfer to eos', time.ctime(time.time()), jive_file)
235 msg.info(
'%s going to rename ESD file %s ready for transfer to eos', time.ctime(time.time()), vp1_file)