Skip to content

reset the jupyters

reset the jupyters #59

name: Model Retraining on Push to Main - Ghithub Lab 2
on:
push:
branches:
- main # Trigger the workflow on pushes to the main branch
jobs:
retrain:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: pip install -r Labs/Github_Labs/Lab2/requirements.txt
- name: Generate and Store Timestamp
run: |
timestamp=$(date '+%Y%m%d%H%M%S')
echo "$timestamp" > timestamp.txt
id: timestamp
- name: Check File Permissions
run: |
ls -l Labs/Github_Labs/Lab2/src/train_model.py
- name: Set File Permissions
run: |
chmod +x Labs/Github_Labs/Lab2/src/train_model.py
- name: Retrain Model
run: |
timestamp=$(cat timestamp.txt) # Use the timestamp in your training script
python Labs/Github_Labs/Lab2/src/train_model.py --timestamp "$timestamp"
- name: Evaluate Model and Log Metrics
run: |
timestamp=$(cat timestamp.txt) # Use the timestamp in your training script
python Labs/Github_Labs/Lab2/src/evaluate_model.py --timestamp "$timestamp" # Assuming you have a script for model evaluation
metrics_filename="${timestamp}_metrics.json"
mv $metrics_filename Labs/Github_Labs/Lab2/metrics/$metrics_filename
continue-on-error: false # Continue even if evaluation fails
- name: Store and Version the New Model
run: |
timestamp=$(cat timestamp.txt)
model_filename="model_${timestamp}_dt_model.joblib"
mv $model_filename Labs/Github_Labs/Lab2/models/$model_filename
- name: Commit and Push Changes
run: |
git config --global user.email "26876927+raminmohammadi@users.noreply.github.com"
git config --global user.name "raminmohammadi"
git add Labs/Github_Labs/Lab2/metrics/$metrics_filename Labs/Github_Labs/Lab2/models/$model_filename
git commit -m "Add metrics and updated model"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}