-
Notifications
You must be signed in to change notification settings - Fork 59
/
Makefile.rules
146 lines (137 loc) · 5.64 KB
/
Makefile.rules
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
.PHONY: all pr-stats ib-files clean clean_up_old_files FORCE_TARGET
.DEFAULT_GOAL := all
empty:=
space:=$(epmty) $(empty)
SCRIPT_DIRECTORY :=$(dir $(strip $(lastword $(MAKEFILE_LIST))))
TIMESTAMP_FILE := data/timestamps.txt
START_DATE :=
ALL_RELVALS :=
ALL_INPUTS :=
ALL_UNITTESTS :=
ALL_JOB_REPORTS :=
ALL_COMMANDS :=
ALL_WF_TIMES :=
WF_TIMES :=
ifeq ($(strip $(FORCE_BUILD)),yes)
FORCE_BUILD:=FORCE_TARGET
else
ifeq ($(strip $(wildcard $(TIMESTAMP_FILE))),)
FORCE_BUILD:=FORCE_TARGET
endif
endif
define RunCommand
@if [ -e $$< ] ; then \
[ -d $$(@D) ] || mkdir -p $$(@D) &&\
echo $1 &&\
($1 > $$@) || rm -f $$@;\
else \
rm -f $$@ ;\
fi
endef
define set_times
for file in $(1) ; do \
stamp="`grep \" $$file\$$\" $(TIMESTAMP_FILE)`" ;\
[ "X$$stamp" = "X" ] && continue ;\
[ -e $$file ] || continue;\
touch -t $$stamp ;\
done
endef
define update_timestamp
for file in $(1) ; do \
[ -e $$file ] || continue ; \
echo "`date -r $$file +%Y%m%d%H%M.%S` $$file" >> $@; \
done
endef
pyRelValFile=$(if $(strip $(wildcard $(1)/pyRelValPartialLogs)),$(1)/pyRelValPartialLogs,$(1)/pyRelValMatrixLogs.zip)
#dir,arch,queue,date
define ProcessLogs
START_DATE := $(firstword $(sort $(START_DATE) $4))
ALL_RELVALS += data/relvals/$2/$4/$3.json
ALL_INPUTS += data/inputs/$2/$3/$4.csv
ALL_UNIT_TESTS += data/unitTests/$2/$4/$3.json
ALL_GPU_UNIT_TESTS += data/GPU/unitTests/$2/$4/$3.json
ALL_JOB_REPORTS += data/jobreports/$2/$3/$4.csv
ALL_COMMANDS += data/commands/$2/$4/$3.json
WF_TIMES_$2_$3 += $(wildcard $1/pyRelValMatrixLogs/run/relval-times.json)
WF_TIMES += $2_$3
data/relvals/$2/$4/$3.json: $1/pyRelValMatrixLogs/run/runall-report-step123-.log set_timestamps $(FORCE_BUILD)
$(call RunCommand,$(SCRIPT_DIRECTORY)/process-run123-logs $$<)
data/unitTests/$2/$4/$3.json: $1/unitTests-summary.log set_timestamps $(FORCE_BUILD)
$(call RunCommand,$(SCRIPT_DIRECTORY)/process-unitTestSummary-logs $$<)
data/GPU/unitTests/$2/$4/$3.json: $1/GPU/unitTests-summary.log set_timestamps $(FORCE_BUILD)
$(call RunCommand,$(SCRIPT_DIRECTORY)/process-unitTestSummary-logs $$<)
data/commands/$2/$4/$3.json: $(call pyRelValFile,$1) set_timestamps $(FORCE_BUILD)
$(call RunCommand,$(SCRIPT_DIRECTORY)/process-step-commands $$< data/commands/objs)
data/jobreports/$2/$3/$4.csv: $(call pyRelValFile,$1) set_timestamps $(FORCE_BUILD)
$(call RunCommand,$(SCRIPT_DIRECTORY)/process-job-reports $$<)
data/inputs/$2/$3/$4.csv: $(call pyRelValFile,$1) set_timestamps $(FORCE_BUILD)
$(call RunCommand,$(SCRIPT_DIRECTORY)/log-input-files $$< | sort)
endef
define RelValTimes
ALL_WF_TIMES += data/relvaltime/$1/$2.json
data/relvaltime/$1/$2.json: $(WF_TIMES_$(1)_$(2))
$(call RunCommand,$(SCRIPT_DIRECTORY)/relval-times.py $$^)
endef
-include Releases.mk
WF_TIMES := $(sort $(WF_TIMES))
$(foreach r,$(WF_TIMES),$(eval $(call RelValTimes,$(word 1,$(subst _CMSSW_,$(space),$r)),CMSSW_$(word 2,$(subst _CMSSW_,$(space),$r)))))
ALL_RULES := $(ALL_RELVALS) $(ALL_UNIT_TESTS) $(ALL_GPU_UNIT_TESTS) $(ALL_JOB_REPORTS) $(ALL_COMMANDS) $(ALL_WF_TIMES)
FORCE_TARGET:
@:
%/pyRelValMatrixLogs/run/runall-report-step123-.log:
@:
%/unitTests-summary.log:
@:
%/pyRelValMatrixLogs.zip:
@:
%/pyRelValMatrixLogs/run/relval-times.json:
@:
data/cmsdist-config.json: FORCE_TARGET
[ -d $(@D) ] || mkdir -p $(@D) &&\
$(SCRIPT_DIRECTORY)/process-cmsdist > $@
pr-stats:
mkdir -p data/stats && $(SCRIPT_DIRECTORY)/process_prs_stats.py -p $(SCRIPT_DIRECTORY)/../cms-prs/cms-sw/cmssw > data/stats/pr-stats.csv
$(SCRIPT_DIRECTORY)/process_prs_stats.py -o -p $(SCRIPT_DIRECTORY)/../cms-prs/cms-sw/cmssw > data/stats/pr-open-stats.csv
cp data/stats/pr-open-stats.csv data/stats/pr-all-open-stats.csv
$(SCRIPT_DIRECTORY)/process_prs_stats.py -ol -p $(SCRIPT_DIRECTORY)/../cms-prs/cms-sw/cmsdist >> data/stats/pr-all-open-stats.csv
$(SCRIPT_DIRECTORY)/process_prs_stats.py -ogl -p $(SCRIPT_DIRECTORY)/../cms-prs/cms-data >> data/stats/pr-all-open-stats.csv
$(SCRIPT_DIRECTORY)/process_prs_stats.py -ogl -p $(SCRIPT_DIRECTORY)/../cms-prs/cms-externals >> data/stats/pr-all-open-stats.csv
$(SCRIPT_DIRECTORY)/process_prs_circles_json.py -p $(SCRIPT_DIRECTORY)/../cms-prs/cms-sw/cmssw -g "../cms-prs/cms-data,../cms-prs/cms-externals" > data/stats/pr-all-open-circles.json
mkdir -p stats && $(SCRIPT_DIRECTORY)/process_prs_stats.py -c > stats/categories.js
ib-files: $(ALL_INPUTS)
mkdir -p data/inputs && cat data/inputs/*/*/*.csv | sort -u -r > data/inputs/all-ibs.csv
clean:
rm -rf data/relvals
rm -rf data/unitTests
rm -rf data/GPU/unitTests
rm -rf data/commands
rm -rf data/jobreports
rm -rf data/inputs
rm -rf data/stats
rm -rf data/relvaltimes
clean_up_old_files: $(ALL_RULES)
$(SCRIPT_DIRECTORY)/cleanup-old-results -d "$(START_DATE)"
set_timestamps: FORCE_TARGET
@touch -t 198001010101.00 $@
@[ -e $(TIMESTAMP_FILE) ] || exit 0
@$(call set_times,$(ALL_RELVALS))
@$(call set_times,$(ALL_INPUTS))
@$(call set_times,$(ALL_UNIT_TESTS))
@$(call set_times,$(ALL_GPUUNIT_TESTS))
@$(call set_times,$(ALL_JOB_REPORTS))
@$(call set_times,$(ALL_COMMANDS))
@$(call set_times,$(ALL_WF_TIMES))
$(TIMESTAMP_FILE): $(ALL_RULES)
@rm -f $@ && rm -f set_timestamps && touch $@
@mkdir -p data/commands/objs
@echo 'ForceType application/json' > data/commands/objs/.htaccess
@chmod -R a+r data
@$(call update_timestamp,$(ALL_RELVALS))
@$(call update_timestamp,$(ALL_INPUTS))
@$(call update_timestamp,$(ALL_UNIT_TESTS))
@$(call update_timestamp,$(ALL_GPU_UNIT_TESTS))
@$(call update_timestamp,$(ALL_JOB_REPORTS))
@$(call update_timestamp,$(ALL_COMMANDS))
@$(call update_timestamp,$(ALL_WF_TIMES))
all: data/cmsdist-config.json clean_up_old_files pr-stats $(TIMESTAMP_FILE)
@echo Done all