|
|
@ -43,6 +43,7 @@ def main():
|
|
|
|
|
|
|
|
|
|
|
|
while True:
|
|
|
|
while True:
|
|
|
|
time, states, jobstates = get_data()
|
|
|
|
time, states, jobstates = get_data()
|
|
|
|
|
|
|
|
print(f'data got at {time}')
|
|
|
|
assert time not in ts.data
|
|
|
|
assert time not in ts.data
|
|
|
|
ts.data[time] = (states, jobstates)
|
|
|
|
ts.data[time] = (states, jobstates)
|
|
|
|
ts.states |= states.keys()
|
|
|
|
ts.states |= states.keys()
|
|
|
@ -52,6 +53,7 @@ def main():
|
|
|
|
# Should probably save elsewhere and do atomic rename, but whatever.
|
|
|
|
# Should probably save elsewhere and do atomic rename, but whatever.
|
|
|
|
with open(pickle_file, 'wb') as f:
|
|
|
|
with open(pickle_file, 'wb') as f:
|
|
|
|
pickle.dump(ts, f)
|
|
|
|
pickle.dump(ts, f)
|
|
|
|
|
|
|
|
print('pickle saved')
|
|
|
|
|
|
|
|
|
|
|
|
# Show the plot
|
|
|
|
# Show the plot
|
|
|
|
x = sorted(ts.data.keys()) # times
|
|
|
|
x = sorted(ts.data.keys()) # times
|
|
|
@ -60,6 +62,7 @@ def main():
|
|
|
|
# ys are transposed – we need vectors by times, not by states.
|
|
|
|
# ys are transposed – we need vectors by times, not by states.
|
|
|
|
ys = list(zip(*ys))
|
|
|
|
ys = list(zip(*ys))
|
|
|
|
plt.stackplot(x, *ys)
|
|
|
|
plt.stackplot(x, *ys)
|
|
|
|
|
|
|
|
print('showing plot')
|
|
|
|
plt.show(block=False)
|
|
|
|
plt.show(block=False)
|
|
|
|
|
|
|
|
|
|
|
|
plt.pause(poll_rate)
|
|
|
|
plt.pause(poll_rate)
|
|
|
|