Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add bash shell version for testing, update test models #44

Merged
merged 3 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/deploy-shell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Deploy Python 3.11 Image

env:
REGISTRY: ghcr.io
IMAGE_NAME: numerai_predict

on:
workflow_dispatch:
push:
branches:
- master

jobs:
public-py311-image:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v2

- name: Extract short git SHA
run: echo "GIT_REF=`git rev-parse --short HEAD`" >> $GITHUB_ENV

- name: Log in to Github Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}_shell

- name: Push Docker image as LATEST to Github Container registry
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
file: ./py3.11/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}_shell:latest
labels: ${{ steps.meta.outputs.labels }}

- name: Push Docker image git ref to Github Container registry
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
file: ./py3.11/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}_shell:${{ env.GIT_REF }}
labels: ${{ steps.meta.outputs.labels }}

internal-py311-image:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v2

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.MODEL_UPLOADS_ACCOUNT_ID }}:role/github-actions
aws-region: us-west-2

- name: Build and Push Docker Image
run: ACCOUNT_ID=${{ secrets.MODEL_UPLOADS_ACCOUNT_ID }} make push_latest_shell
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ build_3_10: ## Build Python 3.10 container
build_3_11: ## Build Python 3.11 container
docker build --build-arg GIT_REF=${GIT_REF} -t ${NAME}_py_3_11:${GIT_REF} -t ${NAME}_py_3_11:latest -f py3.11/Dockerfile .

.PHONY: build_shell
build_shell: ## Build Python 3.11 container
docker build --build-arg GIT_REF=${GIT_REF} -t ${NAME}_shell:${GIT_REF} -t ${NAME}_shell:latest -f shell/Dockerfile .

.PHONY: test
test: test_3_9 test_3_10 test_3_11 ## Test all container versions

Expand Down Expand Up @@ -71,6 +75,14 @@ push_latest_3_11: build_3_11## Release Python 3.11 contianer tagged latest
docker push ${ECR_REPO}/${NAME}_py_3_11:${GIT_REF}
docker push ${ECR_REPO}/${NAME}_py_3_11:latest

.PHONY: push_latest_shell
push_latest_shell: build_shell## Release Python 3.11 contianer tagged latest
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin ${ECR_REPO}
docker tag ${NAME}_shell:${GIT_REF} ${ECR_REPO}/${NAME}_shell:${GIT_REF}
docker tag ${NAME}_shell:latest ${ECR_REPO}/${NAME}_shell:latest
docker push ${ECR_REPO}/${NAME}_shell:${GIT_REF}
docker push ${ECR_REPO}/${NAME}_shell:latest

.PHONY: push_stable
push_stable: push_stable_3_9 push_stable_3_10 push_stable_3_11 ## Push all container tagged stable

Expand Down
4 changes: 2 additions & 2 deletions predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--dataset",
default="v4.3/live_int8.parquet",
default="v5.0/live.parquet",
help="Numerapi dataset path or local file.",
)
parser.add_argument(
"--benchmarks",
default="v4.3/live_benchmark_models.parquet",
default="v5.0/live_benchmark_models.parquet",
help="Numerapi benchmark model path or local file.",
)
parser.add_argument("--model", required=True, help="Pickled model file or URL")
Expand Down
16 changes: 16 additions & 0 deletions shell/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM python:3.11-slim

ARG GIT_REF
ENV GIT_REF=$GIT_REF
RUN apt-get update -yqq \
&& apt-get install -yqq --no-install-recommends \
build-essential \
cmake \
git \
python3-dev

COPY ./requirements.txt .
RUN pip install --upgrade pip
RUN pip install -r requirements.txt

COPY ./predict.py .
Binary file modified tests/models/model_3_10.pkl
Binary file not shown.
Binary file modified tests/models/model_3_10_legacy.pkl
Binary file not shown.
Binary file modified tests/models/model_3_11.pkl
Binary file not shown.
Binary file modified tests/models/model_3_11_legacy.pkl
Binary file not shown.
Binary file modified tests/models/model_3_9.pkl
Binary file not shown.
Binary file modified tests/models/model_3_9_legacy.pkl
Binary file not shown.
Loading