-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile_present.py
44 lines (34 loc) · 1.17 KB
/
file_present.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
import csv
from pymemcache.client import base
import pickle
client = base.Client(('localhost', 11211))
files = []
with open('trace.csv', mode='r') as trace_file:
trace_reader = csv.reader(trace_file)
for row in list(trace_reader):
files.append(row[-1])
files.pop(0)
client.delete_multi(files)
for file in files:
result = client.get(file)
if result is not None:
client.set(file,"ansj")
print("FILE PRESENT")
dbfile = open('pckl_upload', 'rb')
db_upload = pickle.load(dbfile)
# for k,v in db.items():
# print(k,v)
dbfile.close()
db_upload["cache_requests"] = [["Time","File Name","Cache Hit","Time Taken (in microseconds)"]]
dbfile = open('pckl_upload', 'wb')
pickle.dump(db_upload, dbfile)
dbfile.close()
dbfile = open('pckl_download', 'rb')
db_download = pickle.load(dbfile)
# for k,v in db.items():
# print(k,v)
dbfile.close()
db_download["download_requests"] = [["Time","File Name","Files Downloaded","Num Global Blocks","Num Local Parity","Time To Download (in microseconds)","Time To Decode (in microseconds)","Total Time Taken (in microseconds)"]]
dbfile = open('pckl_download', 'wb')
pickle.dump(db_download, dbfile)
dbfile.close()