-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_multiply_events.py
50 lines (38 loc) · 1.17 KB
/
test_multiply_events.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
event_count = 100.00
import json
from pathlib import Path
import random
def ok_event(fn):
data = json.loads(fn.read_text())
return data['type'] in [
'task_added',
#'deletion_warning_sent',
#'run_annotated',
'run_download_provided',
#'run_download_removed'
"email_sent",
#"archive_deletion_warning_sent",
]
events = [x for x in (Path("data/events").glob("*.json"))]
count = len(events) -1
while count < event_count:
nf = f"0691734943_999_{count}.json"
input = {
'type': 'fake-event',
'data': ["xyz" * 300] * 10
}
output = Path("data/events") / nf
output.write_text(json.dumps(input))
count += 1
if False:
def ok_task(fn):
data = json.loads(fn.read_text())
return data['status'] == 'done'
tasks = [x for x in (Path("data/tasks").glob("*.json")) if ok_task(x)]
count = len(tasks)
while count < event_count:
nf = f"0691734943_999_{count}.json"
input = random.choice(tasks)
output = Path("data/tasks") / nf
output.write_text(input.read_text())
count += 1