-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmakefile
More file actions
247 lines (209 loc) · 8.03 KB
/
makefile
File metadata and controls
247 lines (209 loc) · 8.03 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
#
# vi should "set expandtab&". Makefile cmds require tab
# Valid job targets are:
# init-jobs: init the jobs in the $JOBS var found in jobs.config
# run-jobs: run the jobs list
# clean-jobs: clean all artifacts generated by init-jobs and run-jobs, but not run dirs
# init-all: init ALL dirs under REGULUS
# run-all: run all dirs
# clean-all: clean all artifacts generated by init-all and run-all, but not run dirs
#
# Valid lab targets are: (Job targets make "init-lab" as necessary. No need to make it explicitly)
# init-lab: discover and verify the cluster specified in lab.config. Save results in ./.LAB
# clean-lab remove all state knowledge about this cluster.
#
include ./jobs.config
SHELL := /bin/bash
.PHONY: help confirm_execute summary
LOG_FILE := jobs.log-$(shell date "+%Y-%m-%d-%H-%M-%S")
# Default target
help:
@echo "======================================================================"
@echo " REGULUS - Network Performance Benchmark Framework"
@echo "======================================================================"
@echo ""
@echo "Job Targets (work with JOBS defined in jobs.config):"
@echo " make init-jobs - Initialize jobs in JOBS variable"
@echo " make run-jobs - Run jobs in JOBS variable"
@echo " make clean-jobs - Clean artifacts from jobs"
@echo " make report-jobs - Show jobs with errors (run-*.log.error)"
@echo " make reindex-jobs - Reindex jobs"
@echo " make dry-run-jobs - Dry run jobs without execution"
@echo " make jobs - Run jobs and save to timestamped log"
@echo ""
@echo "Batch Targets (work with ALL benchmark directories):"
@echo " make init-all - Initialize ALL benchmark dirs (requires confirmation)"
@echo " make run-all - Run ALL benchmark dirs (requires confirmation)"
@echo " make clean-all - Clean ALL benchmark dirs (requires confirmation)"
@echo " make dry-run-all - Dry run ALL benchmark dirs (requires confirmation)"
@echo ""
@echo "Lab/Environment Targets:"
@echo " make init-lab - Discover cluster from lab.config, generate .LAB files"
@echo " make clean-lab - Remove .LAB files"
@echo " make inventory - Run inventory collection"
@echo " make clean-inventory - Clean inventory artifacts"
@echo ""
@echo "Report Targets (delegate to REPORT/):"
@echo " make report-summary - Generate report (JSON, HTML, CSV)"
@echo " make report-summary-with-testbed-info - Generate report with testbed info"
@echo " make report-dashboard - Start interactive web dashboard"
@echo " make report-dashboard-stop - Stop dashboard instances"
@echo " make report-dashboard-restart - Restart dashboard"
@echo " make report-flatten - Flatten report.json to NDJSON"
@echo " make report-es-upload - Upload to ElasticSearch"
@echo " make report-es-full - Full ES workflow (summary + upload)"
@echo ""
@echo "Batch Management (from REPORT/build_report/):"
@echo " make es-list-batches - List all upload batches"
@echo " make es-show-last-batch - Show most recent batch"
@echo " make es-batch-info ES_BATCH_ID=<uuid> - Show batch details"
@echo " make es-delete-batch ES_BATCH_ID=<uuid> - Delete bad batch"
@echo ""
@echo "Configuration:"
@echo " JOBS config: ./jobs.config"
@echo " Lab config: ./lab.config"
@echo " ES config: ES_URL and ES_INDEX from lab.config or environment"
@echo ""
@echo "For more details on report targets: cd REPORT && make help"
@echo "======================================================================"
init-jobs: init-lab
echo JOBS=$$JOBS
@for dir in $(JOBS); do \
echo "Executing script in $$dir"; \
$(MAKE) -C $$dir init; \
done
clean-jobs:
@for dir in $(JOBS); do \
echo "Executing script in $$dir"; \
$(MAKE) -C $$dir clean; \
done
run-jobs: init-lab
@echo JOBS=$$JOBS
@for dir in $(JOBS); do \
echo "Executing script in $$dir"; \
$(MAKE) -C $$dir run; \
done
# show jobs that generated "run-*.log.error"
report-jobs:
@for dir in $(JOBS); do \
echo "Check jobs status $$dir"; \
prefix=$$(ls -l $$dir/latest | awk '/->/ {print $$NF}' | sed 's|/$$||'); \
if [ -e "$$dir/$$prefix.log.error" ]; then \
(ls $$dir/$$prefix.log.error); \
fi \
done
reindex-jobs:
@for dir in $(JOBS); do \
echo "Reindex jobs $$dir"; \
$(MAKE) -C $$dir reindex; \
done
# Also can be done with setting jobs.config.DRY_RUN=1; make run-jobs
dry-run-jobs: init-lab
echo JOBS=$$JOBS
@for dir in $(JOBS); do \
echo "Executing script in $$dir"; \
$(MAKE) -C $$dir dry-run; \
done
# Lazy aliasing "make run-jobs > log" to "make jobs"
jobs:
@make run-jobs 2>&1 | tee $(LOG_FILE)
confirm_execute:
@echo "Are you sure you want to execute the target? [y/N] " && read ans && [ $${ans:-N} = y ]
init-all: confirm_execute $(LAB_TARGET)
@dirs=$$(find . -type f -name reg_expand.sh -exec dirname {} \;); \
for dir in $$dirs; do \
echo "Entering directory $$dir"; \
$(MAKE) -C $$dir init; \
done
run-all: confirm_execute init-lab
@dirs=$$(find . -type f -name reg_expand.sh -exec dirname {} \;); \
for dir in $$dirs; do \
echo "Entering directory $$dir"; \
$(MAKE) -C $$dir run; \
done
# Also can be done with setting jobs.config.DRY_RUN=1; make run-all
dry-run-all: confirm_execute $(LAB_TARGET)
@dirs=$$(find . -type f -name reg_expand.sh -exec dirname {} \;); \
for dir in $$dirs; do \
echo "Entering directory $$dir"; \
$(MAKE) -C $$dir dry-run; \
done
clean-all: confirm_execute
@dirs=$$(find . -type f -name reg_expand.sh -exec dirname {} \;); \
for dir in $$dirs; do \
echo "Entering directory $$dir"; \
$(MAKE) -C $$dir clean; \
done
# Lab targets
.PHONY: clean-lab init-lab SRIOV_INIT $(LAB_TARGET) inventory
LAB_TARGET := ${GEN_LAB_JSON}
LAB_TARGET_ENV := ${GEN_LAB_ENV}
LAB_SOURCE := ${REG_ROOT}/lab.config
$(OLAB_TARGET): $(OLAB_SOURCE) ./bin/lab-analyzer
@output=$$(./bin/lab-analyzer); \
if [ $$? -ne 0 ]; then \
echo "Error: lab-analyzer failed"; \
exit 1; \
fi; \
echo "$$output" > $@; \
jq -r 'to_entries | .[] | "\(.key)=\(.value)"' $@ > ${LAB_TARGET_ENV};
$(LAB_TARGET): $(LAB_SOURCE) ./bin/lab-analyzer
@set -e; \
tmpfile=$$(mktemp); \
echo "Running lab-analyzer..."; \
./bin/lab-analyzer --output "$$tmpfile"; \
if [ $$? -ne 0 ]; then \
echo "Error: lab-analyzer failed"; \
rm -f "$$tmpfile"; \
exit 1; \
fi; \
mv "$$tmpfile" $@; \
jq -r 'to_entries | .[] | "\(.key)=\(.value)"' $@ > ${LAB_TARGET_ENV}
# This top setting.env is needed before other *-config can run.
SRIOV_INIT:
@echo "[SRIOV_INIT] initializing..." >&2
@{ \
pushd SETUP_GROUP/SRIOV/INSTALL >/dev/null && \
make --no-print-directory init || exit 1; \
popd >/dev/null; \
} || { echo "❌ SRIOV_INIT failed" >&2; exit 1; }
inventory:
@@echo "[INVENTORY] initializing..." >&2
@{ \
pushd INVENTORY >/dev/null && \
make --no-print-directory run || exit 1; \
popd >/dev/null; \
} || { echo "❌ INVENTORY failed" >&2; exit 1; }
clean-inventory:
@@echo "[INVENTORY] clearing..." >&2
@{ \
pushd INVENTORY >/dev/null && \
make --no-print-directory clean || exit 1; \
popd >/dev/null; \
} || { echo "❌ INVENTORY failed" >&2; exit 1; }
# Init LAB info if lab.config changes. Do not output anything to spoil the json file
init-lab: $(LAB_TARGET) SRIOV_INIT inventory
@true
.SECONDARY: $(LAB_SOURCE)
#
clean-lab:
@ rm -f $(LAB_TARGET) $(LAB_TARGET_ENV)
# =============================================================================
# Report Targets (delegate to REPORT/Makefile)
# =============================================================================
report-summary:
@$(MAKE) -C REPORT summary
report-summary-with-testbed-info:
@$(MAKE) -C REPORT summary-with-testbed-info
report-dashboard:
@$(MAKE) -C REPORT dashboard
report-dashboard-stop:
@$(MAKE) -C REPORT dashboard-stop
report-dashboard-restart:
@$(MAKE) -C REPORT dashboard-restart
report-flatten:
@$(MAKE) -C REPORT flatten
report-es-upload:
@$(MAKE) -C REPORT es-upload
report-es-full:
@$(MAKE) -C REPORT es-full