-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
126 lines (103 loc) · 3.37 KB
/
Makefile
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
IMAGE_NAME = partycrasher:latest
EXTERNAL_PORT = 5000
SQLITE = sqlite3 -csv -header
CORPUS_NAME = lp_big
# Stolen from:
# https://gist.github.com/rcmachado/af3db315e31383502660#gistcomment-1585632
.PHONY: help
help: ## Prints this message and exits
$(info Available targets)
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
replaced = sub( /^## /, "", helpMsg ); \
if (replaced == 0) { \
helpMsg = $$0; \
replaced = sub( /^[^:]*:.* ## /, "", helpMsg ); \
} \
if (replaced) \
print $$1 helpMsg; \
} \
{ helpMsg = $$0 }' \
$(MAKEFILE_LIST) | column -ts:
.PHONY: start
start: ## Starts the server locally (does not use Docker).
python partycrasher/rest/service.py \
--port=$(EXTERNAL_PORT) \
--debug \
--config=config.py
.PHONY: gunicorn
gunicorn: ## Starts the server locally (does not use Docker).
gunicorn \
--access-logfile gunicorn-access.log \
--error-logfile gunicorn-error.log \
--log-level debug \
--worker-class sync \
--bind 0.0.0.0:$(EXTERNAL_PORT) \
--timeout 60 \
--pid gunicorn.pid \
--capture-output \
--workers 8 \
partycrasher.rest.validator
.PHONY: build
build: ## Builds the `partycrasher` Docker image
docker build --tag $(IMAGE_NAME) .
.PHONY: run
run: ## Runs the `partycrasher` Docker container.
docker run -d -p $(EXTERNAL_PORT):5000/tcp --name partycrasher $(IMAGE_NAME)
.PHONY: kill
kill: ## Stops and removes the `partycrasher` container.
docker rm -f partycrasher
# .PHONY: test
# test: kill build ## Runs the unit tests within a **new** `partycrasher` container.
# docker run -t -i --name partycrasher $(IMAGE_NAME) python setup.py test
.PHONY: test
test:
python setup.py test
.PHONY: reset
reset: build kill run ## Rebuilds the `partycrasher` container and runs it.
.PHONY: buckettest
buckettest: lp.json ## Destroys the database, uploads, and evaluates data from Launchpad.
# gunicorn --access-logfile gunicorn-access.log \
# --error-logfile gunicorn-error.log \
# --log-level debug \
# --workers 32 \
# --worker-class sync \
# --bind localhost:5000 \
# --timeout 60 \
# --pid gunicorn.pid \
# --capture-output \
# --daemon partycrasher.rest_service_validator
# sleep 1
# echo "Gunicorn started on: " `cat gunicorn.pid`
# sleep 1
python lp/buckettest.py $< http://localhost:$(EXTERNAL_PORT)/
# echo kill `cat gunicorn.pid`
# kill `cat gunicorn.pid`
# Output summaries
.PHONY:
summary: recursion.R $(CORPUS_NAME).sqlite
Rscript $<
# Create the pickled corpus file.
$(CORPUS_NAME).sqlite: recursion_info.py $(CORPUS_NAME).json
python $<
# Downloads the crashes.
%.json.xz:
curl --fail --remote-name https://pizza.cs.ualberta.ca/$@
# How to decompress any xz file.
%: %.xz
xz --decompress --keep $<
CSVS = $(addsuffix .csv,$(basename $(wildcard recursion_results/*.sql)))
.PHONY: csvs
csvs: $(CSVS) lp/functions.csv lp/first-functions.csv
lp/functions.csv: recursion_info.py $(CORPUS_NAME).sqlite
./$< functions $@
lp/first-functions.csv: recursion_info.py $(CORPUS_NAME).sqlite
./$< first-functions $@
# Create a CSV from an SQL query over the crashes database.
%.csv: %.sql $(CORPUS_NAME).sqlite
sqlite3 -header -csv $(CORPUS_NAME).sqlite < $< > $@
recursion_results/entropy_with_recursion.csv: recursion_results/2000_with_recursion.csv
echo "id,entropy" > $@
./get-ent.sh $< >> $@
recursion_results/entropy_without_recursion.csv: recursion_results/2000_without_recursion.csv
echo "id,entropy" > $@
./get-ent.sh $< >> $@