Skip to content

Commit ba753bf

Browse files
committed
parallel calls test
1 parent a4c5713 commit ba753bf

File tree

2 files changed

+62
-1
lines changed

2 files changed

+62
-1
lines changed

.github/workflows/python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ jobs:
3434
env:
3535
RZP_API_KEY: ${{ secrets.RZP_API_KEY }}
3636
RZP_API_SECRET: ${{ secrets.RZP_API_SECRET }}
37-
run: python3 order_connect.py
37+
run: bash run_parallel_orders.sh

run_parallel_orders.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
3+
# Create logs directory if it doesn't exist
4+
mkdir -p logs
5+
6+
# Clear any existing log files
7+
rm -f logs/order_*.log
8+
9+
echo "Starting 10 parallel instances of order_connect.py..."
10+
echo "Logs will be saved in the 'logs' folder"
11+
echo "================================================"
12+
13+
# Array to store process IDs
14+
pids=()
15+
16+
# Start 10 parallel processes
17+
for i in {1..10}; do
18+
echo "Starting instance $i..."
19+
python3 order_connect.py > logs/order_instance_$i.log 2>&1 &
20+
pids+=($!)
21+
done
22+
23+
echo "All 10 instances started. PIDs: ${pids[@]}"
24+
echo "Waiting for all processes to complete..."
25+
26+
# Wait for all background processes to complete
27+
for pid in "${pids[@]}"; do
28+
wait $pid
29+
echo "Process $pid completed"
30+
done
31+
32+
echo "================================================"
33+
echo "All instances completed!"
34+
echo "Check the logs folder for individual instance outputs:"
35+
ls -la logs/
36+
37+
# Optional: Create a summary log
38+
echo "Creating summary log..."
39+
echo "Summary of all parallel order creation attempts" > logs/summary.log
40+
echo "Generated at: $(date)" >> logs/summary.log
41+
echo "================================================" >> logs/summary.log
42+
43+
for i in {1..10}; do
44+
echo "" >> logs/summary.log
45+
echo "=== Instance $i ===" >> logs/summary.log
46+
if [ -f "logs/order_instance_$i.log" ]; then
47+
cat logs/order_instance_$i.log >> logs/summary.log
48+
else
49+
echo "Log file not found for instance $i" >> logs/summary.log
50+
fi
51+
done
52+
53+
echo "Summary log created at logs/summary.log"
54+
echo "Individual logs available at logs/order_instance_[1-10].log"
55+
56+
# Display summary log content in terminal
57+
echo ""
58+
echo "================================================"
59+
echo "SUMMARY LOG CONTENT:"
60+
echo "================================================"
61+
cat logs/summary.log

0 commit comments

Comments
 (0)