You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lock one file exclusivly (only the subtenant and instance_id who make the lock can unlock the file. If the file is locked by one other subtenant or instance_id, it will retry many time (<max_try_nb) to get the lock.
r_json=MSA_API.process_content(constants.FAILED, 'After waiting '+str(nb_sec)+' secondes, lock could not be obtained on the file '+lock_file_name+' (full_path='+lock_file_path+') : '+wait_message, process_param, True)
315
+
else:
316
+
r_json=MSA_API.process_content(constants.FAILED, 'After waiting '+str(nb_sec)+' secondes, lock could not be obtained on the file '+lock_file_name+', full_path='+lock_file_path, process_param, True)
317
+
else:
318
+
r_json=MSA_API.process_content(constants.ENDED, 'Lock obtained on the file '+lock_file_name+', full_path='+lock_file_path, process_param, True)
message='Lock released on the file {}, full_path={}'.format(lock_file_name, lock_file_path)
364
+
365
+
whilenotrelease_obtainedandtries<max_try_nb:
366
+
file_content_lower=''
367
+
ifos.path.exists(lock_file_path):
368
+
withopen(lock_file_path) asf_file:
369
+
file_content=f_file.read().lower()
370
+
iflock_content_lowerinfile_content.lower():
371
+
# Lock file already done by this instance, we can unlock it
372
+
os.remove(lock_file_path)
373
+
release_obtained=True
374
+
continue
375
+
elif"locked by"infile_content.lower():
376
+
wait_message='Wait, lock file already done by : '+file_content
377
+
378
+
tries=tries+1
379
+
# if process_param['UBIQUBEID']:
380
+
# update_asynchronous_task_details(wait_message)
381
+
time.sleep(sleep_time)
382
+
383
+
else:
384
+
message='Lock file not exist ({}, full_path={}), it was already unlocked '.format(lock_file_name, lock_file_path)
385
+
release_obtained=True
386
+
continue
387
+
iftries>=max_try_nb:
388
+
nb_sec=max_try_nb*sleep_time
389
+
r_json=MSA_API.process_content(constants.FAILED, 'After waiting '+str(nb_sec)+' secondes, lock could not be released on the file '+lock_file_name+', full_path='+lock_file_path+' : '+wait_message, process_param, True)
0 commit comments