← back to Exo
fix ci output streaming
7a02acdcd5443b500251832bd97dcbab32325b1a · 2024-08-22 15:08:47 +0100 · Alex Cheema
Files touched
Diff
commit 7a02acdcd5443b500251832bd97dcbab32325b1a
Author: Alex Cheema <alexcheema123@gmail.com>
Date: Thu Aug 22 15:08:47 2024 +0100
fix ci output streaming
---
.circleci/config.yml | 42 +++++++++++++++++++++++++++++++++---------
1 file changed, 33 insertions(+), 9 deletions(-)
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 25e55826..8528a54c 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -16,21 +16,40 @@ commands:
command: |
source env/bin/activate
- # Function to run a command with real-time output and capture
- run_with_output() {
- local log_file=$1
- shift
- "$@" > >(tee -a "$log_file") 2>&1 &
+ # Create named pipes
+ mkfifo output1_pipe output2_pipe
+
+ # Start output streaming in the background
+ tee output1.log < output1_pipe &
+ tee output2.log < output2_pipe &
+
+ # Function to run a command and redirect output
+ run_instance() {
+ local instance=$1
+ local port=$2
+ local api_port=$3
+
+ HF_HOME="$(pwd)/.hf_cache_$instance" \
+ DEBUG_DISCOVERY=7 \
+ DEBUG=7 \
+ python3 main.py \
+ --inference-engine <<parameters.inference_engine>> \
+ --node-id "$instance" \
+ --listen-port $port \
+ --broadcast-port $((port + 1)) \
+ --chatgpt-api-port $api_port \
+ --chatgpt-api-response-timeout-secs 900 \
+ > ${instance}_pipe 2>&1 &
+
echo $!
}
- # Start first instance
+ # Start instances
echo "Starting first instance..."
- PID1=$(run_with_output output1.log HF_HOME="$(pwd)/.hf_cache_node1" DEBUG_DISCOVERY=7 DEBUG=7 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)
+ PID1=$(run_instance "node1" 5678 8000)
- # Start second instance
echo "Starting second instance..."
- PID2=$(run_with_output output2.log HF_HOME="$(pwd)/.hf_cache_node2" DEBUG_DISCOVERY=7 DEBUG=7 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)
+ PID2=$(run_instance "node2" 5679 8001)
# Wait for discovery
echo "Waiting for discovery..."
@@ -96,6 +115,11 @@ commands:
echo "Test passed: Response from both nodes contains 'Michael Jackson'"
fi
+ # Clean up
+ kill $PID1 $PID2
+ wait
+ rm output1_pipe output2_pipe
+
jobs:
unit_test:
macos:
← ad695696 run on every commit on main, reuqire approval on other branc
·
back to Exo
·
ci tail log files 9513c4fd →