moved all files to subproject
This commit is contained in:
58
ceph_bench/generate_samples.py
Normal file
58
ceph_bench/generate_samples.py
Normal file
@@ -0,0 +1,58 @@
|
||||
# copyright: Canonical
|
||||
import os
|
||||
import subprocess
|
||||
from uuid import uuid4
|
||||
|
||||
from loguru import logger as log
|
||||
from tqdm import tqdm
|
||||
|
||||
from definitions import INST_STO_ROOT, SAMPLES, TEST_FILES
|
||||
|
||||
if __name__ == "__main__":
|
||||
for path, data in SAMPLES.items():
|
||||
log.info(f"processing {path}")
|
||||
os.makedirs(INST_STO_ROOT + path, exist_ok=True)
|
||||
for x in tqdm(range(data["number"])):
|
||||
subprocess.run(
|
||||
[
|
||||
"dd",
|
||||
"if=/dev/urandom",
|
||||
f"of={INST_STO_ROOT+path}/{x}",
|
||||
f"bs={int(data['size']*1000)}",
|
||||
"count=1",
|
||||
],
|
||||
capture_output=True,
|
||||
# shell=True,
|
||||
)
|
||||
|
||||
for path, data in SAMPLES.items():
|
||||
log.info(f"processing RANDOM {path}")
|
||||
os.makedirs(INST_STO_ROOT + "Rand", exist_ok=True)
|
||||
for x in tqdm(range(data["number"])):
|
||||
subprocess.run(
|
||||
[
|
||||
"dd",
|
||||
"if=/dev/urandom",
|
||||
f"of={INST_STO_ROOT}Rand/{uuid4()}",
|
||||
f"bs={int(data['size']*1000)}",
|
||||
"count=1",
|
||||
],
|
||||
capture_output=True,
|
||||
# shell=True,
|
||||
)
|
||||
|
||||
for path, data in TEST_FILES.items():
|
||||
log.info(f"processing tests {path}")
|
||||
os.makedirs(INST_STO_ROOT + "test", exist_ok=True)
|
||||
for x in tqdm(range(data["number"])):
|
||||
subprocess.run(
|
||||
[
|
||||
"dd",
|
||||
"if=/dev/urandom",
|
||||
f"of={INST_STO_ROOT}test/{uuid4()}",
|
||||
f"bs={int(data['size']*1000)}",
|
||||
"count=1",
|
||||
],
|
||||
capture_output=True,
|
||||
# shell=True,
|
||||
)
|
||||
Reference in New Issue
Block a user