forked from reframe-hpc/reframe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_pipeline_progress.py
More file actions
42 lines (35 loc) · 1.12 KB
/
Copy pathplot_pipeline_progress.py
File metadata and controls
42 lines (35 loc) · 1.12 KB
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
import json
import matplotlib.pyplot as plt
import os
import sys
if __name__ == '__main__':
with open(sys.argv[1]) as fp:
raw_data = json.load(fp)
for state, steps in raw_data.items():
print(state, len(steps))
try:
mode = sys.argv[2]
if mode not in ('steps', 'time'):
print(f'unknown mode: {mode}')
sys.exit(1)
except IndexError:
mode = 'steps'
if mode == 'steps':
x_label = '# Steps'
x_values = range(len(raw_data['startup']))
else:
x_label = 'Time (s)'
x_values = [x[1] for x in raw_data['startup']]
y_values = []
for x in raw_data.values():
step_values = [s[0] for s in x]
y_values.append(step_values)
fig, ax = plt.subplots()
ax.stackplot(x_values, y_values, labels=raw_data.keys(), alpha=1)
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
ax.set_title('Pipeline progress')
ax.set_xlabel(x_label)
ax.set_ylabel('Number of tasks')
figname = os.path.splitext(sys.argv[1])[0] + '_' + mode + '.png'
plt.savefig(figname, bbox_inches='tight')
plt.show()