-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
download_resume sender/receiver handshake
Summary: the diff ensures that wdt receiver imposes its download_resume (if = true) on the sender. it also makes sure that download_resume with delete_extra_files=true, the set of files are kept identical on the sender and receiver. Reviewed By: ldemailly Differential Revision: D4251809 fbshipit-source-id: 725c3ef02f2a10339223aca9958703ad49ae3e3c
- Loading branch information
Showing
9 changed files
with
175 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#! /usr/bin/env python | ||
|
||
# the test is similar to wdt_dl_resume_test1.py | ||
# we initiate a transfer and cancel it 2/3+ in flight | ||
# we make sure the second transfer finishes the job | ||
# but takes less than 50% of the first one | ||
# 1/3 ~= 50% * 2/3 | ||
# in the end the test ensures that receiver imposes | ||
# -enable_download_resumption on the sender | ||
|
||
from time import time | ||
from common_utils import * | ||
|
||
root_dir = create_test_directory("/tmp") | ||
generate_random_files(100 * 1024 * 1024) | ||
|
||
start_test("receiver -enable_download_resumption imposes it on sender") | ||
test_count = get_test_count() | ||
start_time = time.time() | ||
start_receiver("-num_ports=1 -avg_mbytes_per_sec=10 -enable_download_resumption -abort_after_seconds=7 -delete_extra_files=true") | ||
run_sender("-avg_mbytes_per_sec=10 -block_size_mbytes=1") | ||
check_transfer_status(True, True) | ||
dur1 = time.time() - start_time | ||
start_time = time.time() | ||
start_receiver("-num_ports=1 -avg_mbytes_per_sec=10 -enable_download_resumption -delete_extra_files=true") | ||
run_sender("-avg_mbytes_per_sec=10 -block_size_mbytes=1") | ||
check_transfer_status() | ||
dur2 = time.time() - start_time | ||
# 1.9 = 2 with 5% tolerance | ||
if dur1 < 1.9 * dur2: | ||
print("Aborted previously, this run should take < 50% of prev cycle") | ||
exit(1) | ||
exit(verify_transfer_success()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#! /usr/bin/env python | ||
|
||
# the test ensures that when the receiver is with enable_download_resumption | ||
# this will also impose it on the sender as well as set of files is kept | ||
# the same as delete_extra_files is true on the receiver. | ||
# there was a bug where we did not delete these files when | ||
# sender/receiver mismatch on enable_download_resumption | ||
|
||
from time import time | ||
from common_utils import * | ||
import os | ||
|
||
|
||
def delete_one_dst_file(): | ||
dst_dir = get_dest_dir() | ||
file_name = os.path.join(dst_dir, "file0") | ||
os.remove(file_name) | ||
|
||
|
||
def rename_one_src_file(): | ||
src_dir = get_source_dir() | ||
new_file_name = os.path.join(src_dir, "file55") | ||
src_file_name = os.path.join(src_dir, "file0") | ||
os.rename(src_file_name, new_file_name) | ||
|
||
|
||
root_dir = create_test_directory("/tmp") | ||
generate_random_files(100 * 1024 * 1024) | ||
|
||
start_test("receiver -enable_download_resumption imposes it on sender") | ||
# first we measure how long it takes for a full transfer | ||
test_count = get_test_count() | ||
start_time = time.time() | ||
start_receiver("-num_ports=1 -avg_mbytes_per_sec=10 -enable_download_resumption -delete_extra_files=true") | ||
run_sender("-avg_mbytes_per_sec=10 -block_size_mbytes=1") | ||
check_transfer_status() | ||
dur1 = time.time() - start_time | ||
# we delete one file from the dst directory and make sure | ||
# the transfer takes a small portion of the previous cycle runtime | ||
delete_one_dst_file() | ||
start_time = time.time() | ||
start_receiver("-num_ports=1 -avg_mbytes_per_sec=10 -enable_download_resumption -delete_extra_files=true") | ||
run_sender("-avg_mbytes_per_sec=10 -block_size_mbytes=1") | ||
check_transfer_status() | ||
dur2 = time.time() - start_time | ||
if dur1 < 12 * dur2: | ||
print("Single deletion of a file < 8% wall clock of overall cycle") | ||
exit(1) | ||
# next we rename one of the src file and check if | ||
# the transfer takes less than 8% of the prev cycle | ||
rename_one_src_file() | ||
start_time = time.time() | ||
start_receiver("-num_ports=1 -avg_mbytes_per_sec=10 -enable_download_resumption -delete_extra_files=true") | ||
run_sender("-avg_mbytes_per_sec=10 -block_size_mbytes=1") | ||
check_transfer_status() | ||
dur3 = time.time() - start_time | ||
if dur1 < 12 * dur3: | ||
print("Single addition of a file < 8% wall clock of overall cycle") | ||
exit(1) | ||
# the set of files should be identical | ||
exit(verify_transfer_success()) |