Skip to content

Commit

Permalink
Default to Python 3.8 and merge linter with tests (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Gonzalez-Martin authored Sep 17, 2021
1 parent fb16fa5 commit 643085e
Show file tree
Hide file tree
Showing 15 changed files with 68 additions and 41 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/lint.yml

This file was deleted.

45 changes: 31 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,40 @@ name: MLServer Tests

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
tests:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
make install-dev
- name: Lint
run: |
make lint
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9"]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7.10
- name: Install dependencies
run: |
make install-dev
- name: Test
run: |
make test
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
make install-dev
- name: Test
run: |
make test
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7-slim
FROM python:3.8-slim

SHELL ["/bin/bash", "-c"]

Expand Down
7 changes: 6 additions & 1 deletion runtimes/mlflow/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import sys
import mlflow
import pytest
import numpy as np
Expand Down Expand Up @@ -38,7 +39,11 @@ def model_uri(tmp_path) -> str:

@pytest.fixture
def pytorch_model_uri() -> str:
return os.path.join(TESTDATA_PATH, "pytorch_model")
pytorch_model_path = os.path.join(TESTDATA_PATH, "pytorch_model")
if sys.version_info >= (3, 8):
return os.path.join(pytorch_model_path, "3.8")

return os.path.join(pytorch_model_path, "3.7")


@pytest.fixture
Expand Down
13 changes: 13 additions & 0 deletions runtimes/mlflow/tests/testdata/pytorch_model/3.8/MLmodel
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
artifact_path: model
flavors:
python_function:
data: data
env: conda.yaml
loader_module: mlflow.pytorch
pickle_module_name: mlflow.pytorch.pickle_module
python_version: 3.8.11
pytorch:
model_data: data
pytorch_version: 1.9.0+cu102
run_id: 9de1eacb96d7421b85ac1ca4286a99f2
utc_time_created: '2021-09-16 11:24:30.236714'
11 changes: 11 additions & 0 deletions runtimes/mlflow/tests/testdata/pytorch_model/3.8/conda.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
channels:
- conda-forge
dependencies:
- python=3.8.11
- pip
- pip:
- mlflow
- torch==1.9.0+cu102
- torchvision==0.10.0+cu102
- cloudpickle==1.6.0
name: mlflow-env
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mlflow.pytorch.pickle_module
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
mlflow
torch==1.9.0+cu102
torchvision==0.10.0+cu102
cloudpickle==1.6.0
2 changes: 1 addition & 1 deletion tests/test_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async def test_pool_load(
# Trigger a process scale up
await inference_pool.predict(inference_request)

assert len(executor._processes) == sum_model_settings.parallel_workers
assert 1 <= len(executor._processes) <= sum_model_settings.parallel_workers


async def test_pool_predict(
Expand Down

0 comments on commit 643085e

Please sign in to comment.