return false instead of exiting in some functions. Added modification to split for md5
This commit is contained in:
14
utility.py
14
utility.py
@@ -31,8 +31,8 @@ def get_list (fail_tries,swift_conn,swift_container,prefix) :
|
||||
print(e)
|
||||
time.sleep(2)
|
||||
if fail_tries_counter == fail_tries - 1 :
|
||||
print("Maximum tries reached. Can't download remote list for container " + swift_container + " with prefix " +prefix +". Exiting.")
|
||||
sys.exit(-1)
|
||||
print("Maximum tries reached. Can't download remote list for container " + swift_container + " with prefix " +prefix +".")
|
||||
return False
|
||||
else:
|
||||
swift_conn = authentication.set_authentication ()
|
||||
else :
|
||||
@@ -76,8 +76,8 @@ def list_compute_correct_size (fail_tries,objects,swift_conn,swift_container,pre
|
||||
print(e)
|
||||
time.sleep(2)
|
||||
if fail_tries_counter == fail_tries - 1 :
|
||||
print("Maximum tries reached. Can't download sizes for all large files on container " + swift_container + " with prefix: " +prefix +". Exiting.")
|
||||
sys.exit(-1)
|
||||
print("Maximum tries reached. Can't download sizes for all large files on container " + swift_container + " with prefix: " +prefix +".")
|
||||
return False
|
||||
else:
|
||||
swift_conn = authentication.set_authentication ()
|
||||
else :
|
||||
@@ -87,7 +87,7 @@ def list_compute_correct_size (fail_tries,objects,swift_conn,swift_container,pre
|
||||
o["bytes"] = oheaders["content-length"]
|
||||
if "_xg10v10_" in oheaders["x-object-manifest"]:
|
||||
split1 = oheaders["x-object-manifest"].split("_xg10v10_")[0]
|
||||
split2 = split1.split("/")[1]
|
||||
split2 = split1.split("/")[-1]
|
||||
o["hash"] = split2
|
||||
else:
|
||||
print("Impossible to get remote large file md5. Cause: Not uploaded with xgiovio method (md5 in x-object-manifest)")
|
||||
@@ -177,8 +177,8 @@ def listall (objects,prefix):
|
||||
|
||||
def check_segments_size (size_limit_reading_os,size_limit_to_segment):
|
||||
if size_limit_reading_os%2 != 0 or size_limit_to_segment%2 != 0 or size_limit_reading_os > size_limit_to_segment or size_limit_reading_os < 16 or not is_power_of_2(size_limit_reading_os) or not is_power_of_2(size_limit_to_segment):
|
||||
print ("Error size segments")
|
||||
sys.exit(-2)
|
||||
return False
|
||||
return True
|
||||
|
||||
def is_power_of_2 (number):
|
||||
result = math.log(number,2)
|
||||
|
||||
Reference in New Issue
Block a user