Skip to content

Cron - Prediction Evaluation #4165

Cron - Prediction Evaluation

Cron - Prediction Evaluation #4165

Workflow file for this run

name: Cron - Prediction Evaluation
on:
workflow_dispatch:
schedule:
- cron: '*/15 0-8 * * 2-6' # every 15 minutes from 12-4 AM EST and again 8PM-12AM (Monday to Friday)
jobs:
scripts:
runs-on: ubuntu-latest
outputs:
exitcode: ${{ steps.fetch-metadata.outputs.exitcode }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
ref: ${{ github.ref }}
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip' # caching pip dependencies
- run: |
echo "::group::pip install -r scripts/requirements.txt"
pip install -r scripts/requirements.txt
echo "::endgroup::"
- name: Restore cached API calls
id: cache-api-restore
uses: actions/cache/restore@v4
with:
path: |
data/.av
key: api-${{ runner.os }}-${{ github.run_id }}
restore-keys: |
api-${{ runner.os }}
- name: Fetch Metadata
id: fetch-metadata
env:
AV_API_KEY: ${{ secrets.AV_API_KEY }}
run: |
set +e
python scripts/fetch_labels.py
echo "exitcode=$?" >> $GITHUB_OUTPUT
- name: Save API results
id: cache-primes-save
uses: actions/cache/save@v4
with:
path: |
data/.av
key: ${{ steps.cache-api-restore.outputs.cache-primary-key }}
- name: Fail if Unexpected Error Code
run: |
if [[ ${{ steps.fetch-metadata.outputs.exitcode }} != "0" && ${{ steps.fetch-metadata.outputs.exitcode }} != "7" ]]; then
echo "Exit code was: ${{ steps.fetch-metadata.outputs.exitcode }}"
exit 1
fi
- name: Update Labels
if: ${{ steps.fetch-metadata.outputs.exitcode == 0 }}
run: python scripts/set_labels.py
- name: Evalute Performance
if: ${{ steps.fetch-metadata.outputs.exitcode == 0 }}
run: python scripts/predict/evaluate.py
- name: Update Front End Data
if: ${{ steps.fetch-metadata.outputs.exitcode == 0 }}
run: ./scripts/update_front_end.sh
- name: Update Data
if: ${{ steps.fetch-metadata.outputs.exitcode == 0 }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add data/data.db view/src/contexts/predictions/data/
git commit -m "Updating Prediction Result Data for $(date)"
git push