Skip to content

Commit 4fb92b0

Browse files
Update venv and loki
1 parent 9d6cedc commit 4fb92b0

File tree

3 files changed

+45
-20
lines changed

3 files changed

+45
-20
lines changed

Makefile

+38-11
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,67 @@
11
POETRY_HOME := $(CURDIR)/.poetry
22
POETRY := $(POETRY_HOME)/bin/poetry
33

4+
MIN_PYTHON_VERSION := 3.10
5+
6+
PYTHON_VERSIONS := 3.11 3.10
7+
8+
PYTHON := $(shell \
9+
for ver in $(PYTHON_VERSIONS); do \
10+
if command -v python$$ver >/dev/null 2>&1; then echo python$$ver; exit 0; fi; \
11+
done \
12+
)
13+
14+
ifndef PYTHON
15+
$(error "Python version $(MIN_PYTHON_VERSION) or higher is required but not found.")
16+
endif
17+
418
.PHONY: pre-install
519
pre-install:
20+
@echo "🐍 Using Python interpreter: $(PYTHON)"
621
@echo "🐍 Checking if Python is installed"
7-
@command -v python3 >/dev/null 2>&1 || { echo >&2 "Python is not installed. Aborting."; exit 1; }
22+
@command -v $(PYTHON) >/dev/null 2>&1 || { echo >&2 "$(PYTHON) is not installed. Aborting."; exit 1; }
823
@echo "🐍 Checking Python version"
9-
@python3 --version | grep -E "Python 3\.(10|[1-9][1-9])" >/dev/null 2>&1 || { echo >&2 "Python version 3.10 or higher is required. Aborting."; exit 1; }
24+
@$(PYTHON) --version | grep -E "Python 3\.(1[0-9]|[2-9][0-9])" >/dev/null 2>&1 || { echo >&2 "Python $(MIN_PYTHON_VERSION) or higher is required. Aborting."; exit 1; }
1025
@echo "📦 Checking if Poetry is installed"
1126
@if ! command -v poetry >/dev/null 2>&1 || [ ! -d "$(POETRY_HOME)" ]; then \
12-
echo "Poetry is not installed or POETRY_HOME does not exist. Installing Poetry."; \
13-
curl -sSL https://install.python-poetry.org | POETRY_HOME=$(POETRY_HOME) python3 -; \
14-
fi
27+
echo "Poetry is not installed or POETRY_HOME does not exist. Installing Poetry."; \
28+
curl -sSL https://install.python-poetry.org | POETRY_HOME=$(POETRY_HOME) $(PYTHON) -; \
29+
fi
30+
@echo "📦 Configuring Poetry"
31+
@if [ -z "$$CONDA_PREFIX" ] && [ -z "$$VIRTUAL_ENV" ]; then \
32+
echo "Configuring Poetry to create a virtual environment."; \
33+
$(POETRY) config virtualenvs.in-project true; \
34+
else \
35+
echo "Configuring Poetry to use the existing environment."; \
36+
$(POETRY) config virtualenvs.create false; \
37+
fi
38+
@echo "📦 Setting Poetry to use $(PYTHON)"
39+
@$(POETRY) env use $(PYTHON) || { echo "Failed to set Python version for Poetry. Aborting."; exit 1; }
1540

1641
.PHONY: install
1742
install: pre-install ## Install the poetry environment and install the pre-commit hooks
1843
@echo "📦 Installing dependencies with Poetry"
1944
@PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring $(POETRY) install --with core
2045
@echo "🔧 Installing pre-commit hooks"
2146
@$(POETRY) run pre-commit install
22-
@echo "🐚 Activating virtual environment"
23-
@$(POETRY) shell
47+
@$(MAKE) shell
2448

2549
.PHONY: full-install
2650
full-install: pre-install ## Install the poetry environment and install the pre-commit hooks
2751
@echo "📦 Installing dependencies with Poetry"
2852
@PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring $(POETRY) install --with core,docs,dev
2953
@echo "🔧 Installing pre-commit hooks"
3054
@$(POETRY) run pre-commit install
31-
@echo "🐚 Activating virtual environment"
32-
@$(POETRY) shell
55+
@$(MAKE) shell
3356

3457
.PHONY: shell
3558
shell: ## Start a shell in the poetry environment
36-
@echo "🐚 Activating virtual environment"
37-
@$(POETRY) shell
59+
@if [ -z "$$CONDA_PREFIX" ] && [ -z "$$VIRTUAL_ENV" ]; then \
60+
echo "🐚 Activating virtual environment"; \
61+
$(POETRY) shell; \
62+
else \
63+
echo "🐚 Conda or virtual environment detected, skipping Poetry shell activation"; \
64+
fi
3865

3966
.PHONY: sync
4067
sync: ## Sync the lock file

nebula/addons/waf/loki-config.yml

+7-8
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,18 @@ query_scheduler:
2222
schema_config:
2323
configs:
2424
- from: 2020-10-24
25-
store: boltdb-shipper
25+
store: tsdb
2626
object_store: filesystem
27-
schema: v11
27+
schema: v13
2828
index:
2929
prefix: index_
3030
period: 24h
3131

3232
storage_config:
33-
boltdb_shipper:
34-
active_index_directory: /loki/boltdb-shipper-active
35-
cache_location: /loki/boltdb-shipper-cache
36-
cache_ttl: 24h # Can be increased for faster performance over longer query periods, uses more disk space
37-
filesystem:
38-
directory: /loki/chunks
33+
tsdb:
34+
dir: /loki/tsdb
35+
wal:
36+
dir: /loki/wal
3937

4038
compactor:
4139
working_directory: /loki/boltdb-shipper-compactor
@@ -45,6 +43,7 @@ limits_config:
4543
max_query_length: 0h
4644
max_query_series: 100000
4745
reject_old_samples_max_age: 168h
46+
allow_structured_metadata: false
4847

4948
table_manager:
5049
retention_deletes_enabled: false

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ protobuf = "4.25.3"
4949
qtconsole = "5.6.0"
5050
aiohttp = "3.10.5"
5151
async-timeout = "4.0.3"
52-
netifaces = "0.11.0"
5352
tcconfig = "0.29.1"
5453
geopy = "2.4.1"
5554
numpy = "2.1.1"

0 commit comments

Comments
 (0)