-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (59 loc) · 2.15 KB
/
Copy pathMakefile
File metadata and controls
74 lines (59 loc) · 2.15 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
SRCPATH := scheduler/src:worker/src
PYTEST ?= pytest -q
.DEFAULT_GOAL := help
.PHONY: help up down logs ps restart rebuild scale-worker venv clean-venv
## Show available commands
help:
@echo ""
@echo "Distributed Task Scheduler — available commands:"
@echo ""
@awk 'BEGIN {FS = ":.*##"} \
/^[a-zA-Z_-]+:.*##/ { \
printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 \
}' $(MAKEFILE_LIST)
@echo ""
## Build and start all services
up: ## Build and start scheduler, workers and database
docker compose up -d --build
## Stop all services and remove volumes
down: ## Stop all containers and remove volumes
docker compose down -v
## Show container status
ps: ## Show running containers
docker compose ps
## Tail container logs
logs: ## Follow logs from all services
docker compose logs -f --tail=200
## Restart all containers
restart: ## Restart all services
docker compose restart
## Rebuild containers from scratch
rebuild: ## Rebuild all images and restart
docker compose down
docker compose up -d --build
## Scale worker containers
scale-worker: ## Scale workers (example: make scale-worker N=3)
docker compose up -d --scale worker=$(N)
## Create Python virtual environment
venv: ## Create venv and install dependencies
python3 -m venv .venv
. .venv/bin/activate && pip install --upgrade pip
. .venv/bin/activate && pip install -r requirements.txt
## Remove virtual environment
clean-venv: ## Delete local virtual environment
rm -rf .venv
## Run all tests (sets PYTHONPATH to include scheduler and worker src)
test: ## Run all tests (sets PYTHONPATH to $(SRCPATH))
PYTHONPATH=$(SRCPATH) $(PYTEST)
## Run only worker tests
test-worker: ## Run only worker tests (sets PYTHONPATH=worker/src)
PYTHONPATH=worker/src $(PYTEST) worker/test
## Run only scheduler tests
test-scheduler: ## Run only scheduler tests (sets PYTHONPATH=scheduler/src)
PYTHONPATH=scheduler/src $(PYTEST) scheduler/test
## Run a single test file (usage: make test-file TEST=path/to/test_file.py)
test-file: ## Run a single test file: make test-file TEST=path/to/test.py
@if [ -z "$(TEST)" ]; then \
echo "Please set TEST=path/to/test_file.py"; exit 1; \
fi
PYTHONPATH=$(SRCPATH) $(PYTEST) $(TEST)