forked from diux-dev/cluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfill_efs.py
executable file
·32 lines (26 loc) · 965 Bytes
/
fill_efs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python
import numpy as np
import math
import argparse
parser = argparse.ArgumentParser(description='script to fill EFS with data')
parser.add_argument('--gb', type=int, default=100, metavar='N',
help='how many GBs to dump')
parser.add_argument('--chunk_gb', type=int, default=1, metavar='N',
help='how many GBs to dump')
parser.add_argument('--fn', type=str, default="fill", metavar='N',
help='filename')
args = parser.parse_args()
def main():
chunk_size = args.chunk_gb*1e9
current_size = 0
file_counter = 0
max_file_counter = int(math.ceil(args.gb/args.chunk_gb))
while current_size < args.gb*1e9:
fn = args.fn+"-%05d-of-%05d"%(file_counter, max_file_counter)
file_counter+=1
with open(fn, 'wb') as out:
out.write(np.random.bytes(chunk_size))
print("Wrote %5.1f GBs"%(current_size/1e9))
current_size+=chunk_size
if __name__=='__main__':
main()