name: Continuous Training
on:
push:
branches:
- workflow_continuous_training
# Para que github action corra el worflow con este crontab, es decir cada 6 horas
schedule:
- cron: '0 */6 * * *'
# Por si queremos correrlo manualmente
workflow_dispatch:
inputs:
reason:
description: Why to run this?
required: false
default: running CT
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write # need this for OIDC
contents: write
pull-requests: write
issues: read
packages: none
jobs:
continuous-training:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Set AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-session-name: aws_testing_session
role-to-assume: ${{ secrets.AWS_IAM_ROLE }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Train model
run: |
pip install pipenv
pipenv install
pipenv run python
pip install -r src/requirements.txt
dvc pull model/model.pkl.dvc -r model-tracker
dvc unprotect model/model.pkl
dvc repro -f
echo "Training Completed"
dvc add model/model.pkl
dvc push model/model.pkl -r model-track
# Running dvc unprotect guarantees that the target files or directories (targets) in the workspace are physically “unlinked” from the cache and can be safely updated.
- name: Commit .dvc file changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "github-actions[bot]"
git add model/model.pkl.dvc
git commit -m "Updating model serialization"
- uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- uses: iterative/setup-cml@v1
- name: Push metrics
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cat report.txt >> report.md
cml-publish prediction_behavior.png --md >> report.md
cml-send-comment report.md
¿Quieres ver más aportes, preguntas y respuestas de la comunidad?
o inicia sesión.