Skip to content

Latest commit

 

History

History
174 lines (129 loc) · 4.32 KB

File metadata and controls

174 lines (129 loc) · 4.32 KB

🛠️ Troubleshooting Guide - Lab 30: AI Test Suggestion Pipeline

Ollama not responding

Check Ollama service

(venv) toor@ip-172-31-10-252:~/ai-test-pipeline$ systemctl status ollama
● ollama.service - Ollama Service
     Loaded: loaded (/etc/systemd/system/ollama.service; enabled; preset: enabled)
     Active: active (running) since Sat 2026-04-12 15:54:08 UTC; 28min ago
   Main PID: 7421 (ollama)
      Tasks: 12 (limit: 2271)
     Memory: 4.2G
        CPU: 1min 18.522s

Restart if needed

(venv) toor@ip-172-31-10-252:~/ai-test-pipeline$ sudo systemctl restart ollama
(venv) toor@ip-172-31-10-252:~/ai-test-pipeline$ systemctl status ollama | head -8
● ollama.service - Ollama Service
     Loaded: loaded (/etc/systemd/system/ollama.service; enabled; preset: enabled)
     Active: active (running) since Sat 2026-04-12 16:23:09 UTC; 2s ago
   Main PID: 8894 (ollama)
      Tasks: 10 (limit: 2271)
     Memory: 86.7M
        CPU: 512ms

If not managed by systemd

(venv) toor@ip-172-31-10-252:~/ai-test-pipeline$ pkill ollama
(venv) toor@ip-172-31-10-252:~/ai-test-pipeline$ nohup ollama serve >/tmp/ollama.log 2>&1 &
(venv) toor@ip-172-31-10-252:~/ai-test-pipeline$ sleep 5
(venv) toor@ip-172-31-10-252:~/ai-test-pipeline$ ss -tulpen | grep 11434
tcp   LISTEN 0      4096          127.0.0.1:11434      0.0.0.0:*    users:(("ollama",pid=9012,fd=3))

Git repository errors

Ensure sample_project is initialized

(venv) toor@ip-172-31-10-252:~/ai-test-pipeline$ cd ~/ai-test-pipeline/sample_project
(venv) toor@ip-172-31-10-252:~/ai-test-pipeline/sample_project$ git status
On branch master
nothing to commit, working tree clean

If Git user identity is missing, set it locally

(venv) toor@ip-172-31-10-252:~/ai-test-pipeline/sample_project$ git config user.name "Lab User"
(venv) toor@ip-172-31-10-252:~/ai-test-pipeline/sample_project$ git config user.email "lab@example.com"
(venv) toor@ip-172-31-10-252:~/ai-test-pipeline/sample_project$ git config --list | grep '^user\.'
user.name=Lab User
user.email=lab@example.com

Import errors

Verify virtual environment is activated

toor@ip-172-31-10-252:~/ai-test-pipeline$ which python3
toor@ip-172-31-10-252:~/ai-test-pipeline$ source ~/ai-test-pipeline/venv/bin/activate
(venv) toor@ip-172-31-10-252:~/ai-test-pipeline$ which python3
/usr/bin/python3
/home/toor/ai-test-pipeline/venv/bin/python3

Reinstall packages if needed

(venv) toor@ip-172-31-10-252:~/ai-test-pipeline$ cd ~/ai-test-pipeline
(venv) toor@ip-172-31-10-252:~/ai-test-pipeline$ source venv/bin/activate
(venv) toor@ip-172-31-10-252:~/ai-test-pipeline$ pip install --force-reinstall openai gitpython requests
Collecting openai
Collecting gitpython
Collecting requests
...
Successfully installed anyio-4.9.0 certifi-2025.1.31 charset-normalizer-3.4.1 distro-1.9.0 gitdb-4.0.12 gitpython-3.1.44 httpx-0.28.1 idna-3.10 jiter-0.9.0 openai-1.76.0 pydantic-2.11.3 requests-2.31.0 sniffio-1.3.1 tqdm-4.67.1 typing-extensions-4.13.2 urllib3-2.3.0

AST parsing errors

The lab notes say to ensure valid Python syntax and UTF-8 encoding, and suggests using py_compile for verification.

(venv) toor@ip-172-31-10-252:~/ai-test-pipeline$ python3 -m py_compile src/code_analyzer.py src/test_suggester.py src/pipeline.py sample_project/calculator.py
(venv) toor@ip-172-31-10-252:~/ai-test-pipeline$ echo $?
0

Ollama model is too large or slow

The lab explicitly notes that even if codellama:7b is resource-heavy, the pipeline can still work with rule-based fallback suggestions when model output is unavailable or unparsable. That is what happened in this simulated run, and the overall workflow still completed successfully.


Final project snapshot

A realistic final directory state after completing the lab:

(venv) toor@ip-172-31-10-252:~/ai-test-pipeline$ ls -R
.:
sample_project
src
suggestions
tests
venv

./sample_project:
calculator.py

./src:
__pycache__
code_analyzer.py
pipeline.py
test_suggester.py

./src/__pycache__:
code_analyzer.cpython-312.pyc
pipeline.cpython-312.pyc
test_suggester.cpython-312.pyc

./suggestions:
report.md
test_suggestions.json

./tests:
test_analyzer.py