Last active
February 25, 2020 04:02
-
-
Save mo6020/cac488dc5f3e677dc083683a02138c98 to your computer and use it in GitHub Desktop.
file_gopher wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import random | |
import math | |
from math import exp, expm1 | |
num_files_total = 1000000 | |
width = 7 | |
num_files_per_p = int(num_files_total/width) | |
count = 0 | |
total_size = 0 | |
p_count = 763 | |
while count < num_files_total: | |
depth = random.randint(3,7) | |
#avg_file_size = int(math.pow(2,random.randint(1,1))*1024) | |
avg_file_size = 4096 | |
size = avg_file_size * num_files_per_p | |
total_size = total_size + size | |
count = count + num_files_per_p | |
depth = depth + 1 | |
directory = '/mnt/vol2/p' + str(p_count) | |
command = '/tmp/file_gopher-master/bin/linux/file_gopher ' + '-D ' + str(depth) + ' -s ' + str(size) + ' -n ' + str(num_files_per_p) + ' -d ' + str(directory) | |
os.system(command) | |
print command | |
p_count = p_count + 1 | |
print 'Total # of files created: ' + str(count) | |
print 'Total size of dataset (GB): ' + (str(int(total_size/(1024*1024*1024)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment