-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
99 lines (82 loc) · 3.81 KB
/
Makefile
File metadata and controls
99 lines (82 loc) · 3.81 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
# Define all phony targets (targets that don't represent files)
.PHONY: clean clean-build clean-venv clean-cache setup install setup-all orchestrate \
coordinator github-sensor hackmd-sensor processor-gh processor-hackmd \
run-all demo-coordinator demo-github demo-hackmd docker-clean docker-rebuild up down
VENV_DIR ?= .venv
PYTHON_EXECUTABLE_FOR_VENV_CREATION ?= python3.12 # Make sure this command works on your system
# Setup targets
setup: $(VENV_DIR)/.pip_ready
@echo "Root virtual environment is ready at $(VENV_DIR)"
@echo "To activate, run: source $(VENV_DIR)/bin/activate"
install: $(VENV_DIR)/.installed_root_requirements
@echo "Root requirements from requirements.txt are installed in $(VENV_DIR)."
@echo "Installing/checking koi-net package into $(VENV_DIR)..."
. $(VENV_DIR)/bin/activate && $(VENV_DIR)/bin/pip install koi-net
@echo "koi-net installation/check complete."
# --- Helper targets for venv and root requirements ---
# Marker file indicating venv is created and base pip is ready
$(VENV_DIR)/.pip_ready:
@echo "Creating root virtual environment in $(VENV_DIR) using $(PYTHON_EXECUTABLE_FOR_VENV_CREATION)..."
$(PYTHON_EXECUTABLE_FOR_VENV_CREATION) -m venv $(VENV_DIR)
@echo "Ensuring pip is installed and up-to-date in $(VENV_DIR)..."
. $(VENV_DIR)/bin/activate && $(VENV_DIR)/bin/python -m ensurepip --upgrade --default-pip
. $(VENV_DIR)/bin/activate && $(VENV_DIR)/bin/pip install --upgrade pip
@touch $@
# Marker file indicating requirements.txt are installed
$(VENV_DIR)/.installed_root_requirements: $(VENV_DIR)/.pip_ready requirements.txt
@echo "Installing root requirements from requirements.txt into $(VENV_DIR)..."
. $(VENV_DIR)/bin/activate && $(VENV_DIR)/bin/pip install -r requirements.txt
@touch $@
# --- End of modified/added section for setup and install ---
setup-all:
@echo "Setting up all node repositories..."
python orchestrator.py
clean:
@echo "Starting full cleanup..."
@$(MAKE) clean-cache
@$(MAKE) clean-venv
@$(MAKE) clean-build
@echo "Clean complete."
# Cleaning targets
clean-build:
@echo "Removing build artifacts..."
@find . -type d -name '__pycache__' -exec rm -rf {} + 2>/dev/null || true
@find . -type d -name '*.egg-info' -exec rm -rf {} + 2>/dev/null || true
@find . -type d -name 'dist' -exec rm -rf {} + 2>/dev/null || true
@find . -type d -name 'build' -exec rm -rf {} + 2>/dev/null || true
@echo "Build artifacts removed."
clean-venv:
@echo "Removing virtual environments..."
@rm -rf .venv || true
@find . -name ".venv" -type d -exec rm -rf {} + 2>/dev/null || true
@echo "Virtual environments removed."
clean-cache:
@echo "Removing problematic files from cache directories (e.g., .DS_Store)..."
@find . -name ".DS_Store" -type f -exec rm -f {} + 2>/dev/null || true
@echo "Removing cache directories and files..."
@find . -name ".koi" -type d -exec rm -rf {} + 2>/dev/null || true
@find . -name ".rid_cache" -type d -exec rm -rf {} + 2>/dev/null || true
@find . -name "event_queues.json" -type f -exec rm -f {} + 2>/dev/null || true
# @find . -name "config.yaml" -type f -exec rm -f {} + 2>/dev/null || true
# @echo "Cache and config.yaml files removed."
# Orchestration target
orchestrator: install
. $(VENV_DIR)/bin/activate && python simple_orchestrator.py
# Individual node runners
coordinator:
@echo "Running Coordinator Node..."
.venv/bin/python -m coordinator_node
github-sensor:
@echo "Running Github Sensor Node..."
.venv/bin/python -m github_sensor_node
hackmd-sensor:
@echo "Running HackMD Sensor Node..."
rm -rf koi-net-hackmd-sensor-node/node.sensor.log
.venv/bin/python -m hackmd_sensor_node
processor-gh: clean-cache
@echo "Running GitHub Processor Node..."
.venv/bin/python -m processor_github_node
processor-hackmd:
@echo "Running HackMD Processor Node..."
rm node.proc.log >/dev/null || true
.venv/bin/python -m hackmd_processor_node