|
@@ -3,6 +3,87 @@ version: 2.1
|
|
orbs:
|
|
orbs:
|
|
python: circleci/python@2
|
|
python: circleci/python@2
|
|
|
|
|
|
|
|
+commands:
|
|
|
|
+ run_chatgpt_api_test:
|
|
|
|
+ parameters:
|
|
|
|
+ inference_engine:
|
|
|
|
+ type: string
|
|
|
|
+ steps:
|
|
|
|
+ - run:
|
|
|
|
+ name: Run chatgpt api integration test (<<parameters.inference_engine>>)
|
|
|
|
+ command: |
|
|
|
|
+ source env/bin/activate
|
|
|
|
+
|
|
|
|
+ # Start first instance
|
|
|
|
+ DEBUG_DISCOVERY=9 DEBUG=9 python3 main.py --inference-engine <<parameters.inference_engine>> --node-id "node1" --listen-port 5678 --broadcast-port 5679 --chatgpt-api-port 8000 --chatgpt-api-response-timeout-secs 900 > output1.log 2>&1 &
|
|
|
|
+ PID1=$!
|
|
|
|
+
|
|
|
|
+ # Start second instance
|
|
|
|
+ DEBUG_DISCOVERY=9 DEBUG=9 python3 main.py --inference-engine <<parameters.inference_engine>> --node-id "node2" --listen-port 5679 --broadcast-port 5678 --chatgpt-api-port 8001 --chatgpt-api-response-timeout-secs 900 > output2.log 2>&1 &
|
|
|
|
+ PID2=$!
|
|
|
|
+
|
|
|
|
+ # Wait for discovery
|
|
|
|
+ sleep 10
|
|
|
|
+
|
|
|
|
+ # Function to check if processes are still running
|
|
|
|
+ check_processes() {
|
|
|
|
+ if ! kill -0 $PID1 2>/dev/null; then
|
|
|
|
+ echo "First instance (PID $PID1) died unexpectedly. Log output:"
|
|
|
|
+ cat output1.log
|
|
|
|
+ exit 1
|
|
|
|
+ fi
|
|
|
|
+ if ! kill -0 $PID2 2>/dev/null; then
|
|
|
|
+ echo "Second instance (PID $PID2) died unexpectedly. Log output:"
|
|
|
|
+ cat output2.log
|
|
|
|
+ exit 1
|
|
|
|
+ fi
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ # Check processes before proceeding
|
|
|
|
+ check_processes
|
|
|
|
+
|
|
|
|
+ response_1=$(curl -s http://localhost:8000/v1/chat/completions \
|
|
|
|
+ -H "Content-Type: application/json" \
|
|
|
|
+ -d '{
|
|
|
|
+ "model": "llama-3.1-8b",
|
|
|
|
+ "messages": [{"role": "user", "content": "Keep responses concise. Who was the king of pop?"}],
|
|
|
|
+ "temperature": 0.7
|
|
|
|
+ }')
|
|
|
|
+ echo "Response 1: $response_1"
|
|
|
|
+
|
|
|
|
+ # Check processes after first response
|
|
|
|
+ check_processes
|
|
|
|
+
|
|
|
|
+ response_2=$(curl -s http://localhost:8001/v1/chat/completions \
|
|
|
|
+ -H "Content-Type: application/json" \
|
|
|
|
+ -d '{
|
|
|
|
+ "model": "llama-3.1-8b",
|
|
|
|
+ "messages": [{"role": "user", "content": "Keep responses concise. Who was the king of pop?"}],
|
|
|
|
+ "temperature": 0.7
|
|
|
|
+ }')
|
|
|
|
+ echo "Response 2: $response_2"
|
|
|
|
+
|
|
|
|
+ # Check processes after second response
|
|
|
|
+ check_processes
|
|
|
|
+
|
|
|
|
+ # Stop both instances
|
|
|
|
+ kill $PID1 $PID2
|
|
|
|
+
|
|
|
|
+ echo ""
|
|
|
|
+ if ! echo "$response_1" | grep -q "Michael Jackson" || ! echo "$response_2" | grep -q "Michael Jackson"; then
|
|
|
|
+ echo "Test failed: Response does not contain 'Michael Jackson'"
|
|
|
|
+ echo "Response 1: $response_1"
|
|
|
|
+ echo ""
|
|
|
|
+ echo "Response 2: $response_2"
|
|
|
|
+ echo "Output of first instance:"
|
|
|
|
+ cat output1.log
|
|
|
|
+ echo "Output of second instance:"
|
|
|
|
+ cat output2.log
|
|
|
|
+ exit 1
|
|
|
|
+ else
|
|
|
|
+ echo "Test passed: Response from both nodes contains 'Michael Jackson'"
|
|
|
|
+ fi
|
|
|
|
+
|
|
jobs:
|
|
jobs:
|
|
unit_test:
|
|
unit_test:
|
|
macos:
|
|
macos:
|
|
@@ -84,80 +165,10 @@ jobs:
|
|
source env/bin/activate
|
|
source env/bin/activate
|
|
pip install --upgrade pip
|
|
pip install --upgrade pip
|
|
pip install .
|
|
pip install .
|
|
- - run:
|
|
|
|
- name: Run chatgpt api integration test
|
|
|
|
- command: |
|
|
|
|
- source env/bin/activate
|
|
|
|
-
|
|
|
|
- # Start first instance
|
|
|
|
- DEBUG_DISCOVERY=9 DEBUG=9 python3 main.py --inference-engine mlx --node-id "node1" --listen-port 5678 --broadcast-port 5679 --chatgpt-api-port 8000 --chatgpt-api-response-timeout-secs 900 > output1.log 2>&1 &
|
|
|
|
- PID1=$!
|
|
|
|
-
|
|
|
|
- # Start second instance
|
|
|
|
- DEBUG_DISCOVERY=9 DEBUG=9 python3 main.py --inference-engine mlx --node-id "node2" --listen-port 5679 --broadcast-port 5678 --chatgpt-api-port 8001 --chatgpt-api-response-timeout-secs 900 > output2.log 2>&1 &
|
|
|
|
- PID2=$!
|
|
|
|
-
|
|
|
|
- # Wait for discovery
|
|
|
|
- sleep 10
|
|
|
|
-
|
|
|
|
- # Function to check if processes are still running
|
|
|
|
- check_processes() {
|
|
|
|
- if ! kill -0 $PID1 2>/dev/null; then
|
|
|
|
- echo "First instance (PID $PID1) died unexpectedly. Log output:"
|
|
|
|
- cat output1.log
|
|
|
|
- exit 1
|
|
|
|
- fi
|
|
|
|
- if ! kill -0 $PID2 2>/dev/null; then
|
|
|
|
- echo "Second instance (PID $PID2) died unexpectedly. Log output:"
|
|
|
|
- cat output2.log
|
|
|
|
- exit 1
|
|
|
|
- fi
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- # Check processes before proceeding
|
|
|
|
- check_processes
|
|
|
|
-
|
|
|
|
- response_1=$(curl -s http://localhost:8000/v1/chat/completions \
|
|
|
|
- -H "Content-Type: application/json" \
|
|
|
|
- -d '{
|
|
|
|
- "model": "llama-3.1-8b",
|
|
|
|
- "messages": [{"role": "user", "content": "Keep responses concise. Who was the king of pop?"}],
|
|
|
|
- "temperature": 0.7
|
|
|
|
- }')
|
|
|
|
- echo "Response 1: $response_1"
|
|
|
|
-
|
|
|
|
- # Check processes after first response
|
|
|
|
- check_processes
|
|
|
|
-
|
|
|
|
- response_2=$(curl -s http://localhost:8001/v1/chat/completions \
|
|
|
|
- -H "Content-Type: application/json" \
|
|
|
|
- -d '{
|
|
|
|
- "model": "llama-3.1-8b",
|
|
|
|
- "messages": [{"role": "user", "content": "Keep responses concise. Who was the king of pop?"}],
|
|
|
|
- "temperature": 0.7
|
|
|
|
- }')
|
|
|
|
- echo "Response 2: $response_2"
|
|
|
|
-
|
|
|
|
- # Check processes after second response
|
|
|
|
- check_processes
|
|
|
|
-
|
|
|
|
- # Stop both instances
|
|
|
|
- kill $PID1 $PID2
|
|
|
|
-
|
|
|
|
- echo ""
|
|
|
|
- if ! echo "$response_1" | grep -q "Michael Jackson" || ! echo "$response_2" | grep -q "Michael Jackson"; then
|
|
|
|
- echo "Test failed: Response does not contain 'Michael Jackson'"
|
|
|
|
- echo "Response 1: $response_1"
|
|
|
|
- echo ""
|
|
|
|
- echo "Response 2: $response_2"
|
|
|
|
- echo "Output of first instance:"
|
|
|
|
- cat output1.log
|
|
|
|
- echo "Output of second instance:"
|
|
|
|
- cat output2.log
|
|
|
|
- exit 1
|
|
|
|
- else
|
|
|
|
- echo "Test passed: Response from both nodes contains 'Michael Jackson'"
|
|
|
|
- fi
|
|
|
|
|
|
+ - run_chatgpt_api_test:
|
|
|
|
+ inference_engine: mlx
|
|
|
|
+ - run_chatgpt_api_test:
|
|
|
|
+ inference_engine: tinygrad
|
|
|
|
|
|
workflows:
|
|
workflows:
|
|
version: 2
|
|
version: 2
|