Skip to content

Elite RL Training Pipeline #7

Elite RL Training Pipeline

Elite RL Training Pipeline #7

Workflow file for this run

name: Elite RL Training Pipeline
on:
schedule:
# 10 runs per day: Every 2.4 hours
- cron: '0 0 * * *' # 12:00 AM UTC
- cron: '24 2 * * *' # 2:24 AM UTC
- cron: '48 4 * * *' # 4:48 AM UTC
- cron: '12 7 * * *' # 7:12 AM UTC
- cron: '36 9 * * *' # 9:36 AM UTC
- cron: '0 12 * * *' # 12:00 PM UTC
- cron: '24 14 * * *' # 2:24 PM UTC
- cron: '48 16 * * *' # 4:48 PM UTC
- cron: '12 19 * * *' # 7:12 PM UTC
- cron: '36 21 * * *' # 9:36 PM UTC
workflow_dispatch:
jobs:
train_and_evaluate:
runs-on: ubuntu-latest
timeout-minutes: 180
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential wget
# Install TA-Lib from source (required for ta-lib Python package)
cd /tmp
wget -q http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
tar -xzf ta-lib-0.4.0-src.tar.gz
cd ta-lib/
./configure --prefix=/usr > /dev/null 2>&1
make > /dev/null 2>&1
sudo make install > /dev/null 2>&1
cd ~
echo "TA-Lib installed successfully"
- name: Install Python dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
- name: Configure Git
run: |
git config --global user.email "bot@meridian.algo"
git config --global user.name "MidnightAI Bot"
- name: Run training
env:
COMET_API_KEY: ${{ secrets.COMET_API_KEY }}
COMET_PROJECT: midnight-rl
INITIAL_CAPITAL: 10000
run: |
python src/main.py --mode train --initial-capital 10000
- name: Get run number
id: run_number
run: |
if [ -f models/run_counter.txt ]; then
RUN_NUM=$(cat models/run_counter.txt)
else
RUN_NUM=1
fi
echo "run_num=$RUN_NUM" >> $GITHUB_OUTPUT
echo "Run number: $RUN_NUM"
# Calculate if this is a milestone run (every 5 runs)
REMAINDER=$((RUN_NUM % 5))
if [ $REMAINDER -eq 0 ]; then
echo "is_milestone=true" >> $GITHUB_OUTPUT
else
echo "is_milestone=false" >> $GITHUB_OUTPUT
fi
- name: Create milestone tag every 5 runs
if: steps.run_number.outputs.is_milestone == 'true'
run: |
RUN_NUM=${{ steps.run_number.outputs.run_num }}
TAG_NAME="milestone-run-${RUN_NUM}"
git tag -a "${TAG_NAME}" -m "Training Milestone: Run ${RUN_NUM} completed"
git push origin "${TAG_NAME}" || echo "Tag push failed, continuing..."
- name: Commit and push results
run: |
git add -A
RUN_NUM=${{ steps.run_number.outputs.run_num }}
TIMESTAMP=$(date -u +'%Y-%m-%d %H:%M UTC')
git commit -m "Training Run ${RUN_NUM} - ${TIMESTAMP}" || echo "No changes to commit"
# Push with retry logic
for i in {1..3}; do
git push origin main && break || sleep 5
done