in dataflux_core/benchmarking/dataflux_client_threaded_bench.py [0:0]
def main() -> None:
args = parse_args()
list_start_time = time.time()
print(f"Listing operation started at {list_start_time}")
list_result = fast_list.ListingController(args.num_workers,
args.project,
args.bucket,
prefix=args.prefix).run()
list_end_time = time.time()
if args.bucket_file_count and len(list_result) != args.bucket_file_count:
raise AssertionError(
f"Expected {args.bucket_file_count} files, but got {len(list_result)}"
)
print(
f"{len(list_result)} objects listed in {list_end_time - list_start_time} seconds"
)
size = sum([x[1] for x in list_result])
print(f"Starting download of: {size} bytes of data...")
download_params = download.DataFluxDownloadOptimizationParams(
args.max_compose_bytes)
download_start_time = time.time()
print(f"Download operation started at {download_start_time}")
download_result = download.dataflux_download_threaded(
args.project,
args.bucket,
list_result,
dataflux_download_optimization_params=download_params,
threads=args.threads,
)
download_end_time = time.time()
total_size = sum([len(x) for x in download_result])
if args.bucket_file_size and total_size != args.bucket_file_size:
raise AssertionError(
f"Expected {args.bucket_file_size} bytes but got {total_size} bytes"
)
print(
f"{total_size} bytes across {len(list_result)} objects downloaded in {download_end_time - download_start_time} seconds using {args.threads} threads"
)