Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,10 @@ RUN apt-get update \

WORKDIR /opt/llmize

ARG INSTALL_ENRICH=false
RUN python3 -m pip install --no-cache-dir --break-system-packages "ollama>=0.5" \
&& if [ "$INSTALL_ENRICH" = "true" ]; then \
python3 -m pip install --no-cache-dir --break-system-packages tooluniverse "PyYAML>=6" ; \
fi
RUN python3 -m pip install --no-cache-dir --break-system-packages "ollama>=0.5"

# TEST_MODEL is baked in for offline runs; LLMIZE_MODEL is the runtime default.
# Set BAKE_MODEL=true to also bake LLMIZE_MODEL for air-gapped use.
# TEST_MODEL is baked in for offline runs, LLMIZE_MODEL is the runtime default.
# Set BAKE_MODEL=true to also bake LLMIZE_MODEL for isolated use.
ARG TEST_MODEL=smollm2:135m
ARG LLMIZE_MODEL=gemma4
ENV LLMIZE_MODEL=${LLMIZE_MODEL}
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ source .venv/bin/activate
python3 -m pip install -r requirements.txt
```

This installs `ollama` plus the optional enrich stack
(`tooluniverse`, `PyYAML`). Enrich is optional, the pipeline can run without
it but enrich gives more context.
This installs `ollama` plus the optional enrich stack (`tooluniverse`, `PyYAML`).
Enrich is optional, the pipeline can run withoutit but enrich gives more context.

### 3. Run the pipeline
```bash
Expand Down
27 changes: 0 additions & 27 deletions check_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,32 +73,6 @@ def _ollama_server_and_models() -> list:
return [server_ok, model_check]


def _tooluniverse() -> Check:
if importlib.util.find_spec("tooluniverse") is None:
return Check(
"ToolUniverse (optional, --enrich)", WARN,
"not installed; gene enrichment will be skipped. "
"Install with: python3 -m pip install tooluniverse PyYAML",
required=False,
)
try:
from enrich import EntityEnricher
enricher = EntityEnricher()
except Exception as exc:
return Check(
"ToolUniverse (optional, --enrich)", WARN,
f"installed but failed to initialise ({type(exc).__name__}); enrichment will be skipped.",
required=False,
)
if enricher.available:
return Check("ToolUniverse (optional, --enrich)", OK, "ready (gene-lookup tool resolved)", required=False)
return Check(
"ToolUniverse (optional, --enrich)", WARN,
"installed but no gene-lookup tool matched. Set LLMIZE_GENE_TOOL to a valid tool name.",
required=False,
)


def _descriptor_schema() -> Check:
path = os.path.join(PROJECT_ROOT, "json_reduction", "descriptor_schema.json")
if os.path.exists(path):
Expand Down Expand Up @@ -126,7 +100,6 @@ def _data_dir_writable() -> Check:
def run_checks() -> list:
checks = [_python_version(), _ollama_package()]
checks += _ollama_server_and_models()
checks.append(_tooluniverse())
checks.append(_descriptor_schema())
checks.append(_data_dir_writable())
return checks
Expand Down
18 changes: 5 additions & 13 deletions docker/boot_ollama.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
#!/usr/bin/env bash
# Start the in-container Ollama server, wait for it, and pull the model.
#
# Reusable so both the image ENTRYPOINT (docker run) and the Nextflow process
# script can call it. The server is started with nohup + disown so it survives
# this script exiting and is reachable by later commands in the same task.
#
# Honours:
# LLMIZE_MODEL - model tag to pull/run (default: gemma4)
# OLLAMA_HOST - server/client endpoint (default: 127.0.0.1:11434)
# Start the in-container Ollama server and pull the model. nohup + disown let the
# server survive this script exiting so later commands in the task can reach it.
# Honours LLMIZE_MODEL (default gemma4) and OLLAMA_HOST (default 127.0.0.1:11434).
set -euo pipefail

MODEL="${LLMIZE_MODEL:-gemma4}"
ENDPOINT="http://${OLLAMA_HOST:-127.0.0.1:11434}"

# Start the server only if one isn't already answering.
if ! curl -sf "${ENDPOINT}/api/tags" >/dev/null 2>&1; then
echo "[boot] starting 'ollama serve'..."
nohup ollama serve >/tmp/ollama.log 2>&1 &
Expand All @@ -33,9 +26,8 @@ for i in $(seq 1 60); do
fi
done

# Skip the pull if the model is already present (baked into the image, or cached
# on a mounted volume). This is what makes an offline / air-gapped image work:
# 'ollama pull' would otherwise contact the registry even for an existing model.
# Skip the pull when the model is already present (baked in or volume-cached) so the
# image works offline; 'ollama pull' would otherwise contact the registry regardless.
if ollama list 2>/dev/null | grep -qF "${MODEL}"; then
echo "[boot] model '${MODEL}' already present; skipping pull (offline-safe)."
else
Expand Down
1 change: 0 additions & 1 deletion docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ set -euo pipefail

source /opt/llmize/docker/boot_ollama.sh

# Default to the env preflight if no command was given.
if [ "$#" -eq 0 ]; then
exec python3 /opt/llmize/pipeline.py --check
fi
Expand Down
Loading
Loading