@@ -246,7 +246,9 @@ def execute_transfer_data(self, transfer_set: Dict[str, Any], has_rstprod: bool)
246
246
247
247
# Initialize a list of status files.
248
248
transfer_set ["status_files" ] = []
249
+ transfer_set ["xfer_ids" ] = []
249
250
transfer_set ["completed" ] = []
251
+ transfer_set ["successes" ] = []
250
252
251
253
# Tell Sven we have files to send, one at a time
252
254
for location in transfer_set ["locations" ]:
@@ -262,10 +264,13 @@ def execute_transfer_data(self, transfer_set: Dict[str, Any], has_rstprod: bool)
262
264
263
265
# Parse Sven's output to get the name of the return status file
264
266
match = re .search ("\" (status_.*)\" in your dropbox" , sven_output )
265
- transfer_set ["status_files" ].append (os .path .join (self .task_config .sven_dropbox , match .group (1 )))
267
+ status_file = match .group (1 )
268
+ transfer_set ["xfer_ids" ].append (status_file .replace ("status_" , "" ))
269
+ transfer_set ["status_files" ].append (os .path .join (self .task_config .sven_dropbox , status_file ))
266
270
267
- # Initialize 'completed' to false for each file
271
+ # Initialize 'completed' and 'success' to false for each file
268
272
transfer_set ["completed" ].append (False )
273
+ transfer_set ["successes" ].append (False )
269
274
270
275
# Transfer the doorman script to Niagara.
271
276
# Note, this assumes we have unattended transfer capability.
@@ -284,7 +289,7 @@ def execute_transfer_data(self, transfer_set: Dict[str, Any], has_rstprod: bool)
284
289
# Now wait for the doorman script to run via cron on Niagara.
285
290
# Once complete, Sven's dropbox should fill up with status files.
286
291
wait_count = 0
287
- sleep_time = 300 # s
292
+ sleep_time = 60 # s
288
293
timeout_time = 5.75 * 3600 # s
289
294
max_wait_count = int (timeout_time / sleep_time )
290
295
@@ -295,14 +300,15 @@ def execute_transfer_data(self, transfer_set: Dict[str, Any], has_rstprod: bool)
295
300
logger .debug (f"Waiting for the service to complete on { server_name } " )
296
301
while not all (transfer_set ["completed" ]) and wait_count < max_wait_count :
297
302
sleep (sleep_time )
298
- for i in range (len (transfer_set ["status_files " ])):
303
+ for i in range (len (transfer_set ["locations " ])):
299
304
status_file = transfer_set ["status_files" ][i ]
300
305
if os .path .exists (status_file ):
301
306
# If this is a new status file, check if the transfer was successful
302
307
if not transfer_set ["completed" ][i ]:
303
308
transfer_set ["completed" ][i ] = True
304
309
with open (status_file ) as status_handle :
305
- transfer_set ["successes" ][i ] = status_handle .readlines ()[- 1 ] == "SUCCESS"
310
+ status_string = status_handle .readline ().rstrip ()
311
+ transfer_set ["successes" ][i ] = status_string == f"status.{ transfer_set ['xfer_ids' ][i ]} SUCCESS"
306
312
307
313
if transfer_set ["successes" ][i ]:
308
314
logger .info (f"Successfully archived { transfer_set ['locations' ][i ]} to HPSS!" )
0 commit comments