(path, write_count, interval)
| 189 | from tempfile import TemporaryDirectory |
| 190 | |
| 191 | def write_random_data(path, write_count, interval): |
| 192 | with open(path, "wb") as f: |
| 193 | for i in range(write_count): |
| 194 | time.sleep(random.random() * interval) |
| 195 | letters = random.choices(string.ascii_lowercase, k=10) |
| 196 | data = f'{path}-{i:02}-{"".join(letters)}\n' |
| 197 | f.write(data.encode()) |
| 198 | f.flush() |
| 199 | |
| 200 | def start_write_threads(directory, file_count): |
| 201 | paths = [] |