-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
113 lines (98 loc) · 2.94 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
#!/bin/bash
# As the processes are running in parallel to kill them you need to use the following commands in shell
# kill $(lsof -t -i:3000) to kill the client
# kill $(lsof -t -i:8090) to kill the server
# kill $(lsof -t -i:8000) to kill the MQ
# ls | grep Prediction | tr '\n' ' '
defualt:
@$(MAKE) server &
@$(MAKE) client &
@$(MAKE) watcher
kill:
@if lsof -t -i:8090 > /dev/null 2>&1; then \
echo "Server exists."; \
echo "Shutting down server"; \
kill $(shell lsof -t -i:8090);\
echo "Server has been shutdown"; \
else \
echo "Server doesn't exist!"; \
fi
@if lsof -t -i:3000 > /dev/null 2>&1; then \
echo "Client exists";\
echo "Shutting down client"; \
kill $(shell lsof -t -i:3000);\
echo "Client has been shutdown"; \
else \
echo "Client doesn't exist!"; \
fi
@if lsof -t -i:8000 > /dev/null 2>&1; then \
echo "MQ server exists."; \
echo "Shutting down MQ server"; \
kill $(shell lsof -t -i:8000);\
echo "MQ server has been shutdown"; \
else \
echo "MQ Server doesn't exist!"; \
fi
server:
@echo "Work Started"
@echo ""
@if [ $(shell ls | grep pyvenv.cfg) = "pyvenv.cfg" ]; then\
echo "Yes python venv exists" ;\
echo "" ;\
source bin/activate;\
$(MAKE) mq & \
$(MAKE) startTheServer;\
else\
echo "python venv doesn't exist";\
echo "Initiating venv";\
python3 -m venv . ;\
source bin/activate ;\
echo "Initiated venv";\
echo "Now installing necessary libraries ... ";\
pip install opencv-python;\
pip install tensorflow;\
pip install numpy;\
pip install matplotlib;\
pip install flask;\
pip install flask_cors;\
echo "changing keras 3 to its older version 2 because of compatibality issues";\
TF_USE_LEGACY_KERAS=1 ;\
echo "Switched to keras 2";\
$(MAKE) startTheServer;\
fi
startTheServer:
@echo "Initiating Web Server ..."
@python main.py
client:
@cd frontend/reactfront && npm start
mq:
@if [ "$(shell ls | grep -E 'falsePrediction|truePrediction')" = "" ]; then\
echo "No prediction files exist";\
mkdir falsePrediction ;\
mkdir truePrediction ;\
mkdir truePrediction/0 ;\
mkdir truePrediction/1 ;\
mkdir truePrediction/2 ;\
mkdir truePrediction/3 ;\
mkdir truePrediction/4 ;\
mkdir truePrediction/5 ;\
mkdir truePrediction/6 ;\
mkdir truePrediction/7 ;\
mkdir truePrediction/8 ;\
mkdir truePrediction/9 ;\
source bin/activate ;\
echo "Initiating MQ server ..." ;\
python ImgDataMQServer.py ;\
else\
echo "Prediction files exist";\
source bin/activate ;\
echo "Initiating MQ server ..." ;\
python ImgDataMQServer.py ;\
fi
watcher:
@echo "Initiating watcher ..."
@python watcher.py
startRabitmq:
@docker run -d --name DreamDrawMQ -p 8080:15692 -p 5672:5672 rabbitmq
# The port 8080 is consumer i.e we can send images to add in MQ here
# The port 5672 is producer i.e we can get images that are in MQ from this port