Files
canonical-stuff/run.py
2023-09-05 16:47:21 +02:00

28 lines
817 B
Python

"Test connectivity on a small subset of files."
# copyright: Canonical
import datetime
import subprocess
from pathlib import Path
from loguru import logger as log
SERV_URL = "172.172.0.196::share_rsync"
TARGET = "/mnt/inststo/test"
if __name__ == "__main__":
for x in range(10):
start = datetime.datetime.now()
subprocess.run(
[
"rsync",
"-a",
f"{SERV_URL}/inststo/test",
f"/mnt/inststo",
],
capture_output=True,
# shell=True,
)
time = datetime.datetime.now() - start
size = sum(f.stat().st_size for f in Path(TARGET).glob("**/*") if f.is_file())
log.info(f"{size/time.total_seconds()/1000/1000/8} MB/s")
subprocess.run(["rm", "-rf", TARGET])