Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ def __init__(self, start_time: float, cron_interval: int, event_count: int, user
end_time = time()
self.end_time = int(end_time)

import random
self.record_path = "records_output-" + str(round(time())) + "-" + str(random.randint(1, 1000000))

def _generate_cron_intervals(self):
return [self.start_time + i * self.cron_interval
for i in range(1, int((self.end_time - self.start_time) / self.cron_interval))]
Expand Down Expand Up @@ -249,9 +252,13 @@ def to_file(self, record_class, per_file: int):
"""
count = 0
id = 0
if not os.path.exists(record_class.__name__ + "/"):
os.mkdir(record_class.__name__ + "/")
f = open(record_class.__name__ + "/" + "{0:014b}".format(id), "w")
if not os.path.exists("records/" + self.record_path + "/"):
os.mkdir("records/" + self.record_path + "/")

if not os.path.exists("records/" + self.record_path + "/" + record_class.__name__ + "/"):
os.mkdir("records/" + self.record_path + "/" + record_class.__name__ + "/")

f = open("records/" + self.record_path + "/" + record_class.__name__ + "/" + "{0:014d}".format(id), "w")

if record_class == CloudRecord:
f.write("APEL-cloud-message: v0.4\n")
Expand All @@ -269,7 +276,7 @@ def to_file(self, record_class, per_file: int):
if record_class == StorageRecord:
f.write("</STORAGES>")

f = open(record_class.__name__ + "/" + "{0:014b}".format(id), "w")
f = open("records/" + self.record_path + "/" + record_class.__name__ + "/" + "{0:014d}".format(id), "w")
if record_class == CloudRecord:
f.write("APEL-cloud-message: v0.4\n")
if record_class == PublicIpUsageRecord:
Expand Down