Input data: part 2
This commit is contained in:
parent
4bebd07e82
commit
911799160d
33
input.py
33
input.py
|
@ -4,8 +4,6 @@ import sys
|
||||||
|
|
||||||
filename = sys.argv[1]
|
filename = sys.argv[1]
|
||||||
|
|
||||||
print(filename)
|
|
||||||
|
|
||||||
with open(filename) as file:
|
with open(filename) as file:
|
||||||
text = file.readlines()
|
text = file.readlines()
|
||||||
|
|
||||||
|
@ -17,4 +15,33 @@ requestDescriptionCount = tokenised[0][2]
|
||||||
cacheCount = tokenised[0][3]
|
cacheCount = tokenised[0][3]
|
||||||
cacheSize = tokenised[0][4]
|
cacheSize = tokenised[0][4]
|
||||||
|
|
||||||
print(videoCount)
|
videoSizes = tokenised[1]
|
||||||
|
|
||||||
|
endpointDatacenterLatencies = []
|
||||||
|
endpointCacheLatencies = []
|
||||||
|
i = 2
|
||||||
|
for endpoint in range(0, int(endpointCount)):
|
||||||
|
endpointDatacenterLatencies.append(tokenised[endpoint + i][0])
|
||||||
|
|
||||||
|
endpointCacheLatencies.append({})
|
||||||
|
endpointCacheCount = tokenised[endpoint + i][1]
|
||||||
|
for cache in range(0, int(endpointCacheCount)):
|
||||||
|
cacheId = tokenised[endpoint + 1 + cache + i][0]
|
||||||
|
cacheLatency = tokenised[endpoint + 1 + cache + i][1]
|
||||||
|
endpointCacheLatencies[endpoint][cacheId] = cacheLatency
|
||||||
|
i += int(endpointCacheCount)
|
||||||
|
|
||||||
|
|
||||||
|
i += int(endpointCount)
|
||||||
|
|
||||||
|
requestDescriptions = []
|
||||||
|
for video in range(0, int(videoCount)):
|
||||||
|
requestDescriptions.append({})
|
||||||
|
|
||||||
|
for requestDescription in range(0, int(requestDescriptionCount)):
|
||||||
|
video = int(tokenised[i + requestDescription][0])
|
||||||
|
endpoint = int(tokenised[i + requestDescription][1])
|
||||||
|
requestCount = int(tokenised[i + requestDescription][2])
|
||||||
|
requestDescriptions[video][endpoint] = requestCount
|
||||||
|
|
||||||
|
print(requestDescriptions)
|
||||||
|
|
Loading…
Reference in New Issue