Skip to content

Commit 08bc547

Browse files
authored
Sudivate/fixdeployaci (#178)
1 parent 275ba5c commit 08bc547

File tree

5 files changed

+50
-54
lines changed

5 files changed

+50
-54
lines changed
Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,28 @@
11
name: mlopspython_ci
22

33
dependencies:
4-
54
# The python interpreter version.
6-
- python=3.7.5
5+
- python=3.7.5
76

87
# dependencies with versions aligned with conda_dependencies.yml.
9-
- numpy=1.18.1
10-
- pandas=1.0.0
11-
- scikit-learn=0.22.1
12-
13-
# dependencies for MLOps with R.
14-
- r=3.6.0
15-
- r-essentials=3.6.0
8+
- numpy=1.18.1
9+
- pandas=1.0.0
10+
- scikit-learn=0.22.1
11+
# dependencies for MLOps with R.
12+
- r=3.6.0
13+
- r-essentials=3.6.0
1614

17-
- pip=20.0.2
18-
- pip:
19-
20-
# dependencies with versions aligned with conda_dependencies.yml.
21-
- azureml-sdk==1.0.79
15+
- pip=20.0.2
16+
- pip:
17+
# dependencies with versions aligned with conda_dependencies.yml.
18+
- azureml-sdk==1.0.85
2219

23-
# Additional pip dependencies for the CI environment.
24-
- pytest==5.3.1
25-
- pytest-cov==2.8.1
26-
- requests==2.22.0
27-
- python-dotenv==0.10.3
28-
- flake8==3.7.9
29-
- flake8_formatter_junit_xml==0.0.6
30-
- azure-cli==2.0.77
31-
- tox==3.14.3
20+
# Additional pip dependencies for the CI environment.
21+
- pytest==5.3.1
22+
- pytest-cov==2.8.1
23+
- requests==2.22.0
24+
- python-dotenv==0.10.3
25+
- flake8==3.7.9
26+
- flake8_formatter_junit_xml==0.0.6
27+
- azure-cli==2.0.81
28+
- tox==3.14.3

diabetes_regression/conda_dependencies.yml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,28 @@
44
name: diabetes_regression_sklearn
55

66
dependencies:
7-
87
# The python interpreter version.
9-
- python=3.7.5
8+
- python=3.7.5
109

1110
# Required by azureml-defaults, installed separately through Conda to
1211
# get a prebuilt version and not require build tools for the install.
13-
- psutil=5.6 #latest
14-
15-
- numpy=1.18.1
16-
- pandas=1.0.0
17-
- scikit-learn=0.22.1
18-
#- r-essentials
19-
#- tensorflow
20-
#- keras
12+
- psutil=5.6 #latest
2113

22-
- pip=20.0.2
23-
- pip:
14+
- numpy=1.18.1
15+
- pandas=1.0.0
16+
- scikit-learn=0.22.1
17+
#- r-essentials
18+
#- tensorflow
19+
#- keras
2420

25-
# Dependencies for training environment.
21+
- pip=20.0.2
22+
- pip:
23+
# Dependencies for training environment.
2624

27-
- azureml-core==1.0.79
25+
- azureml-core==1.0.85
2826

29-
# Dependencies for scoring environment.
27+
# Dependencies for scoring environment.
3028

31-
# You must list azureml-defaults as a pip dependency
32-
- azureml-defaults==1.0.79
33-
- inference-schema[numpy-support]==1.0.1
29+
# You must list azureml-defaults as a pip dependency
30+
- azureml-defaults==1.0.85
31+
- inference-schema[numpy-support]==1.0.1

environment_setup/Dockerfile

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
FROM conda/miniconda3
22

33
LABEL org.label-schema.vendor = "Microsoft" \
4-
org.label-schema.url = "https://hub.docker.com/r/microsoft/mlopspython" \
5-
org.label-schema.vcs-url = "https://github.com/microsoft/MLOpsPython"
4+
org.label-schema.url = "https://hub.docker.com/r/microsoft/mlopspython" \
5+
org.label-schema.vcs-url = "https://github.com/microsoft/MLOpsPython"
66

77
COPY diabetes_regression/ci_dependencies.yml /setup/
88

9-
RUN conda env create -f /setup/ci_dependencies.yml
10-
119
# activate environment
1210
ENV PATH /usr/local/envs/mlopspython_ci/bin:$PATH
13-
RUN /bin/bash -c "source activate mlopspython_ci"
1411

15-
# Verify conda installation.
16-
# This serves as workaround for https://github.com/conda/conda/issues/8537 (conda env create doesn't fail
17-
# if pip installation fails, for example due to a wrong package version).
18-
# The `az` command is not available if pip has not run (and installed azure-cli).
19-
RUN az --version
12+
RUN conda update -n base -c defaults conda && \
13+
conda install python=3.7.5 && \
14+
conda env create -f /setup/ci_dependencies.yml && \
15+
/bin/bash -c "source activate mlopspython_ci" && \
16+
az --version

ml_service/util/create_scoring_image.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from azureml.core import Workspace
44
from azureml.core.image import ContainerImage, Image
55
from azureml.core.model import Model
6+
import shutil
67
from ml_service.util.env_variables import Env
78

89
e = Env()
@@ -29,8 +30,10 @@
2930
sources_dir = 'diabetes_regression'
3031
path_to_scoring = os.path.join(".", sources_dir, "scoring")
3132
cwd = os.getcwd()
33+
# Copy conda_dependencies.yml into scoring as this method does not accept relative paths. # NOQA: E501
34+
shutil.copy(os.path.join(".", sources_dir,
35+
"conda_dependencies.yml"), path_to_scoring)
3236
os.chdir(path_to_scoring)
33-
3437
image_config = ContainerImage.image_configuration(
3538
execution_script=e.score_script,
3639
runtime="python",
@@ -40,7 +43,8 @@
4043
)
4144

4245
image = Image.create(
43-
name=e.image_name, models=[model], image_config=image_config, workspace=ws
46+
name=e.image_name, models=[
47+
model], image_config=image_config, workspace=ws
4448
)
4549

4650
os.chdir(cwd)

tests/unit/code_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def test_train_model():
1515
run = Mock(Run)
1616
reg = train_model(run, data, alpha=1.2)
1717

18-
run.log.assert_called_with("mse", 0.029843893480256872,
18+
run.log.assert_called_with("mse", 0.029843893480257067,
1919
description='Mean squared error metric')
2020

2121
preds = reg.predict([[1], [2]])

0 commit comments

Comments
 (0)