Skip to content

Commit

Permalink
update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ajithvcoder committed Nov 4, 2024
1 parent a45de89 commit 9ddc26e
Showing 1 changed file with 31 additions and 28 deletions.
59 changes: 31 additions & 28 deletions .github/workflows/ec2-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,36 +138,36 @@ jobs:
# if torch.cuda.is_available():
# print(f'Device: {torch.cuda.get_device_name(0)}')"

- name: Pull Docker image from ECR
run: |
docker pull ${{secrets.AWS_ECR_LOGIN_URI}}/${{ secrets.ECR_REPOSITORY_NAME }}:latest
ls -a
# - name: Pull Docker image from ECR
# run: |
# docker pull ${{secrets.AWS_ECR_LOGIN_URI}}/${{ secrets.ECR_REPOSITORY_NAME }}:latest
# ls -a

- name: Run DVC commands in container
run: |
mkdir -p model_storage
docker run --gpus=all \
-v "$(pwd)/model_storage:/workspace/model_storage" \
-e AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} \
-e AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} \
-e AWS_DEFAULT_REGION=${{ secrets.AWS_REGION }} \
${{ secrets.AWS_ECR_LOGIN_URI }}/${{ secrets.ECR_REPOSITORY_NAME }}:latest \
/bin/bash -c "
dvc pull -r myremote && \
mkdir -p model_storage && \
dvc repro -f
"
# # Wait a moment to ensure the container has started
# sleep 5
ls model_storage/
# - name: Run DVC commands in container
# run: |
# mkdir -p model_storage
# docker run --gpus=all \
# -v "$(pwd)/model_storage:/workspace/model_storage" \
# -e AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} \
# -e AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} \
# -e AWS_DEFAULT_REGION=${{ secrets.AWS_REGION }} \
# ${{ secrets.AWS_ECR_LOGIN_URI }}/${{ secrets.ECR_REPOSITORY_NAME }}:latest \
# /bin/bash -c "
# dvc pull -r myremote && \
# mkdir -p model_storage && \
# dvc repro -f
# "

# # # Wait a moment to ensure the container has started
# # sleep 5

# ls model_storage/

# # Print logs from the container
# docker logs $CONTAINER_ID
# # # Print logs from the container
# # docker logs $CONTAINER_ID

# # Stop the container after retrieving logs
# docker stop $CONTAINER_ID
# # # Stop the container after retrieving logs
# # docker stop $CONTAINER_ID

- name: List files in folder
run: |
Expand All @@ -183,6 +183,8 @@ jobs:
env:
REPO_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
mkdir model_storage
touch model_storage/model_checkpoint.txt
repo="ajithvcoder/emlo4-session-08-ajithvcoder"
latest_commit=$(curl -s -H "Authorization: token $REPO_TOKEN" \
"https://api.github.com/repos/$repo/commits?per_page=1" | \
Expand All @@ -196,7 +198,8 @@ jobs:
- name: Read best checkpoint file name
id: read_checkpoint
run: |
checkpoint_file=$(head -n 1 ./model_storage/best_model_checkpoint.txt)
# checkpoint_file=$(head -n 1 ./model_storage/best_model_checkpoint.txt)
checkpoint_file="model_storage/model_checkpoint.txt"
echo "CHECKPOINT_FILE=$checkpoint_file" >> $GITHUB_ENV
- name: Upload checkpoint to S3
Expand Down

0 comments on commit 9ddc26e

Please sign in to comment.