-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (36 loc) · 1.29 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
VENV=.venv
BIN=${VENV}/bin
PYTHON=${BIN}/python
CONTAINER = my-wabbit
PID_TRANSCRIBE = transcribe.pid
PID_DOWNLOAD = download.pid
PID_EMBEDDING = embedding.pid
PLAYLIST_ID ?= default_playlist_id
.PHONY: all transcribe download embedding start-rmq
init:
python -m venv ${VENV}
${PYTHON} -m pip install -r requirements.txt
batch: stop start-rmq sleep transcribe embedding download
start-rmq:
# removes existing rabbitmq container
docker ps -a | grep ${CONTAINER} && docker rm -f ${CONTAINER} || true
docker run --rm -d --hostname wabbit --name ${CONTAINER} -p 5672:5672 rabbitmq:3.10-alpine
sleep: start-rmq
# waits for 10 seconds
sleep 10
transcribe: start-rmq
mkdir -p data/transcriptions/
${PYTHON} batch/transcribe.py & echo $$! > $(PID_TRANSCRIBE)
embedding: start-rmq transcribe
${PYTHON} batch/embedding.py & echo $$! > $(PID_EMBEDDING)
download: start-rmq transcribe embedding
mkdir -p data/ytdl/
${PYTHON} batch/download.py --playlist_id ${PLAYLIST_ID} & echo $$! > $(PID_DOWNLOAD)
stop:
-kill `cat $(PID_TRANSCRIBE)` 2>/dev/null || true
-kill `cat $(PID_DOWNLOAD)` 2>/dev/null || true
-kill `cat $(PID_EMBEDDING)` 2>/dev/null || true
rm -f $(PID_TRANSCRIBE) $(PID_DOWNLOAD) $(PID_EMBEDDING)
clean-logs:
rm data/download.log data/embedding.log data/transcribe.log
clean: stop clean-logs