Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
120 lines (92 loc) · 3.29 KB
/
Copy pathMakefile
File metadata and controls
120 lines (92 loc) · 3.29 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
DC = docker compose
EXEC = docker exec -it
ENV = --env-file .env
BACKEND_FILE = docker_compose/backend.yaml
DATABASE_FILE = docker_compose/database.yaml
OLLAMA_FILE = docker_compose/ollama.yaml
BACKEND_CONTAINER = fastapi
DATABASE_CONTAINER = postgres
POSTGRES_USER = user # Change this to your user
POSTGRES_DB = my_db # Change this to your database name
# Command to execute a Python script inside the backend container
# Usage: make run-script FILE=/path/to/your_script.py
# File paths:
# Scraper module
# - nlp_pipeline/scraper/a_fetch_commits.py
# - nlp_pipeline/scraper/b_filter_commits.py
# - nlp_pipeline/scraper/c_fetch_diffs.py
# - nlp_pipeline/scraper/d_collect_data.py
# - nlp_pipeline/scraper/main.py
# Word2Vector module
# - nlp_pipeline/word2vector/a_download_python_files.py
# - nlp_pipeline/word2vector/b_tokenize_python_files.py
# - nlp_pipeline/word2vector/c_train_model.py
# - nlp_pipeline/word2vector/visualisation/cluster_visualisation.py
# - nlp_pipeline/word2vector/visualisation/similarity_heatmap.py
# - nlp_pipeline/word2vector/main.py
# LSTM module
# - nlp_pipeline/lstm/a_data_preparation.py
# - nlp_pipeline/lstm/b_train_model.py
# - nlp_pipeline/lstm/c_generate_report.py
# - nlp_pipeline/lstm/visualisation/confusion_matrix.py
# - nlp_pipeline/lstm/visualisation/precision_recall_curve.py
# - nlp_pipeline/lstm/visualisation/prediction_probability_histogram.py
# - nlp_pipeline/lstm/visualisation/roc_curve.py
# - nlp_pipeline/lstm/main.py
.PHONY: run-script
run-script:
$(EXEC) $(BACKEND_CONTAINER) /bin/bash -c "python $(FILE)"
.PHONY: backend
backend:
$(DC) -f $(BACKEND_FILE) $(ENV) up --build -d
.PHONY: backend-down
backend-down:
$(DC) -f $(BACKEND_FILE) $(ENV) down --remove-orphans
.PHONY: backend-logs
backend-logs:
$(DC) -f ${BACKEND_FILE} $(ENV) logs -f
.PHONY: backend-exec
backend-exec:
$(EXEC) $(BACKEND_CONTAINER) /bin/bash
.PHONY: backend-make-migrations
backend-make-migrations:
$(EXEC) $(BACKEND_CONTAINER) /bin/bash -c "alembic revision --autogenerate -m 'migration'"
.PHONY: backend-migrate
backend-migrate:
$(EXEC) $(BACKEND_CONTAINER) /bin/bash -c "alembic upgrade head"
.PHONY: backend-downgrade-migrations
backend-downgrade-migrations:
$(EXEC) $(BACKEND_CONTAINER) /bin/bash -c "alembic downgrade base"
.PHONY: backend-create-admin
backend-create-admin:
$(EXEC) $(BACKEND_CONTAINER) /bin/bash -c "python web_backend/users/actions/create_admin.py"
.PHONY: database
database:
$(DC) -f $(DATABASE_FILE) $(ENV) up --build -d
.PHONY: database-down
database-down:
$(DC) -f $(DATABASE_FILE) $(ENV) down --remove-orphans
.PHONY: database-logs
database-logs:
$(DC) -f $(DATABASE_FILE) $(ENV) logs -f
.PHONY: database-exec
database-exec:
$(EXEC) $(DATABASE_CONTAINER) psql -U $(POSTGRES_USER) -d $(POSTGRES_DB)
.PHONY: ollama
ollama:
$(DC) -f docker_compose/ollama.yaml up --build -d
.PHONY: ollama-down
ollama-down:
$(DC) -f docker_compose/ollama.yaml down --remove-orphans
.PHONY: ollama-logs
ollama-logs:
$(DC) -f docker_compose/ollama.yaml logs -f
.PHONY: all
all:
$(DC) -f $(DATABASE_FILE) -f $(BACKEND_FILE) -f $(OLLAMA_FILE) $(ENV) up --build -d
.PHONY: all-down
all-down:
$(DC) -f $(DATABASE_FILE) -f $(BACKEND_FILE) -f $(OLLAMA_FILE) $(ENV) down --remove-orphans
.PHONY: all-logs
all-logs:
$(DC) -f $(DATABASE_FILE) -f $(BACKEND_FILE) -f $(OLLAMA_FILE) $(ENV) logs -f