Skip to content

Commit

Permalink
Move mlflow packages to virtual environment in R samples (#3486)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-shepherd authored Jan 10, 2025
1 parent 05dcd4c commit 45e1d97
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
14 changes: 7 additions & 7 deletions cli/jobs/single-step/r/accidents/docker-context/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ FROM rocker/tidyverse:latest

# Install python
RUN apt-get update -qq && \
apt-get install -y python3-pip tcl tk libz-dev libpng-dev
apt-get install -y python3-pip tcl tk libz-dev libpng-dev && \
apt-get install -y python3-venv

RUN /usr/bin/python3 -m venv /usr/venv/
RUN bash /usr/venv/bin/activate

RUN ln -f /usr/bin/python3 /usr/bin/python
RUN ln -f /usr/bin/pip3 /usr/bin/pip
RUN pip install -U pip

# Install azureml-mlflow
RUN pip install azureml-mlflow
RUN pip install mlflow

# Create link for python
RUN ln -f /usr/bin/python3 /usr/bin/python
RUN /usr/venv/bin/pip install azureml-mlflow
RUN /usr/venv/bin/pip install mlflow

# Install additional R packages
RUN R -e "install.packages(c('mlflow'), repos = 'https://cloud.r-project.org/')"
Expand Down
1 change: 1 addition & 0 deletions cli/jobs/single-step/r/accidents/job.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
$schema: https://azuremlschemas.azureedge.net/latest/commandJob.schema.json
code: src
command: >-
source /usr/venv/bin/activate
Rscript accidents.R
--data ${{inputs.training_data}}
inputs:
Expand Down
14 changes: 7 additions & 7 deletions cli/jobs/single-step/r/iris/docker-context/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ FROM rocker/tidyverse:latest

# Install python
RUN apt-get update -qq && \
apt-get install -y python3-pip tcl tk libz-dev libpng-dev
apt-get install -y python3-pip tcl tk libz-dev libpng-dev && \
apt-get install -y python3-venv

RUN /usr/bin/python3 -m venv /usr/venv/
RUN bash /usr/venv/bin/activate

RUN ln -f /usr/bin/python3 /usr/bin/python
RUN ln -f /usr/bin/pip3 /usr/bin/pip
RUN pip install -U pip

# Install azureml-mlflow
RUN pip install azureml-mlflow
RUN pip install mlflow

# Create link for python
RUN ln -f /usr/bin/python3 /usr/bin/python
RUN /usr/venv/bin/pip install azureml-mlflow
RUN /usr/venv/bin/pip install mlflow

# Install additional R packages
RUN R -e "install.packages(c('mlflow'), repos = 'https://cloud.r-project.org/')"
Expand Down
1 change: 1 addition & 0 deletions cli/jobs/single-step/r/iris/job.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
$schema: https://azuremlschemas.azureedge.net/latest/commandJob.schema.json
command: >
source /usr/venv/bin/activate
Rscript train.R
--data_folder ${{inputs.iris}}
code: src
Expand Down

0 comments on commit 45e1d97

Please sign in to comment.