Skip to content

Commit 0b25ca4

Browse files
authored
Merge pull request #5 from oracle/docs_improve_dev_readme
Fixes the "launch_mlflow.sh" file. The copyright information was added in a wrong place
2 parents ee6196b + f6a18ba commit 0b25ca4

File tree

5 files changed

+66
-26
lines changed

5 files changed

+66
-26
lines changed

Makefile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,23 @@ CONTAINERDIR:=container-image
88
RND:=1
99

1010
clean:
11-
@rm -rf dist build oci_mlflow.egg-info
11+
@rm -rf dist build oci_mlflow.egg-info $(CONTAINERDIR)/run/*.whl
1212
@find ./ -name '*.pyc' -exec rm -f {} \;
1313
@find ./ -name 'Thumbs.db' -exec rm -f {} \;
1414
@find ./ -name '*~' -exec rm -f {} \;
1515

1616
dist: clean
1717
@python setup.py bdist_wheel
1818

19-
wheel: dist tmp-copy-whl
20-
2119
build-image:
2220
docker build --network host --build-arg RND=$(RND) -t $(IMAGE_NAME):$(TAG) -f container-image/Dockerfile .
21+
$(MAKE) clean
2322

2423
launch: build-image
2524
@docker run --rm -it --net host -v ~/.oci:/root/.oci --env-file .env --name oci-mlflow $(IMAGE_NAME):$(TAG)
2625

27-
launch-shell:
26+
launch-shell: build-image
2827
@docker run --rm -it --net host -v ~/.oci:/root/.oci --env-file .env --entrypoint bash --name oci-mlflow-shell $(IMAGE_NAME):$(TAG)
2928

30-
launch-shell-remote:
31-
@docker run --rm -it --net host --env-file .env --entrypoint bash --name oci-mlflow-shell $(IMAGE_NAME):$(TAG)
29+
wheel: dist
30+
@cp dist/*.whl container-image/run/

README-development.md

Lines changed: 54 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,22 @@ The target audience for this README is developers wanting to contribute to `OCI
77
python3 -m pip install -r dev-requirements.txt
88
```
99

10+
# Generating the wheel
11+
The OCI MLflow plugins are packaged as a wheel. To generate the wheel, you can run:
12+
13+
```
14+
make dist
15+
```
16+
17+
Alternatively you can run -
18+
19+
```
20+
python setup.py bdist_wheel
21+
```
22+
23+
This wheel can then be installed using pip.
24+
25+
1026
## Setting Up Tracking Server
1127

1228
Create a file called `.env` in the root folder of the project with following contents -
@@ -25,12 +41,14 @@ BACKEND_PROVIDER=sqllite
2541
# ------MySQL-----------------------
2642
# BACKEND_PROVIDER=mysql
2743
28-
# The database credentials can be stored in the Vault service, or they can be provided in the config. See more details how to save the credentials to the Vault - https://accelerated-data-science.readthedocs.io/en/latest/user_guide/secrets/mysql.html
44+
# The database credentials can be stored in the Vault service, or they can be provided in the config.
45+
# See more details how to save the credentials to the Vault -
46+
# https://accelerated-data-science.readthedocs.io/en/latest/user_guide/secrets/mysql.html
2947
3048
# DB_SECRET_OCID=ocid1.vaultsecret.oc1.iad..<unique_ID>
31-
# DBHOST=<host ip>
32-
# DBUSERNAME=<db username>
33-
# DBPASSWORD=<password>
49+
50+
# ----OR------------------------------
51+
# MLFLOW_BACKEND_STORE_URI=mysql+mysqlconnector://{username}:{password}@{host}:{db_port}/{db_name}
3452
# ------------------------------------
3553
3654
MLFLOW_SERVE_ARTIFACTS=1
@@ -44,27 +62,55 @@ MLFLOW_HOST=0.0.0.0
4462
To build an `oci-mlflow` container image run -
4563

4664
```
47-
make build-image
65+
make clean build-image
66+
```
67+
68+
Alternatively you can run -
69+
```
70+
docker build --network host --build-arg RND=1 -t oci-mlflow:latest -f container-image/Dockerfile .
4871
```
4972

5073
To build and launch tracking server run -
5174

5275
```
53-
make launch
76+
make clean launch
77+
```
78+
79+
Alternatively you can run -
80+
```
81+
docker build --network host --build-arg RND=1 -t oci-mlflow:latest -f container-image/Dockerfile .
82+
docker run --rm -it --net host -v ~/.oci:/root/.oci --env-file .env --name oci-mlflow:latest
5483
```
5584

5685
To build `oci-mlflow` wheel file and then rebuild and launch the container image, run -
5786

5887
```
59-
make wheel launch
88+
make clean wheel launch
89+
```
90+
91+
Alternatively you can run -
92+
93+
```
94+
python setup.py bdist_wheel
95+
cp dist/*.whl container-image/run/
96+
docker build --network host --build-arg RND=1 -t oci-mlflow:latest -f container-image/Dockerfile .
97+
docker run --rm -it --net host -v ~/.oci:/root/.oci --env-file .env --name oci-mlflow oci-mlflow:latest
6098
```
6199

62100
To build and start a shell prompt within `oci-mlflow` container image, run -
63101

64102
```
65-
make launch-shell
103+
make clean wheel launch-shell
66104
```
67105

106+
Alternatively you can run -
107+
108+
```
109+
python setup.py bdist_wheel
110+
cp dist/*.whl container-image/run/
111+
docker build --network host --build-arg RND=1 -t oci-mlflow:latest -f container-image/Dockerfile .
112+
docker run --rm -it --net host -v ~/.oci:/root/.oci --env-file .env --entrypoint bash --name oci-mlflow-shell oci-mlflow:latest
113+
```
68114

69115
# Running Tests
70116
The SDK uses pytest as its test framework. To run tests use:
@@ -81,12 +127,3 @@ python3 -m pip install -r dev-requirements.txt
81127
cd docs
82128
make html
83129
```
84-
85-
# Generating the wheel
86-
The OCI MLflow plugins are packaged as a wheel. To generate the wheel, you can run:
87-
88-
```
89-
make build
90-
```
91-
92-
This wheel can then be installed using pip.

container-image/Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,18 @@ ENV PATH="/miniconda/envs/${CONDA_ENV_NAME}}/bin:$PATH"
2424
RUN conda init bash && source ~/.bashrc && conda activate ${CONDA_ENV_NAME}
2525

2626
RUN mkdir ${MLFLOW_DIR}
27-
COPY ${CONTAINER_ARTIFACT_DIR}/run.py ${MLFLOW_DIR}/run.py
28-
COPY ${CONTAINER_ARTIFACT_DIR}/launch_mlflow.sh ${MLFLOW_DIR}/launch_mlflow.sh
27+
COPY ${CONTAINER_ARTIFACT_DIR}/run/* ${MLFLOW_DIR}/
2928
RUN chmod a+x ${MLFLOW_DIR}/launch_mlflow.sh
3029

3130
ENV MLFLOW_DIR=${MLFLOW_DIR}
3231

3332
EXPOSE 5000
3433

34+
RUN if [ -f ${MLFLOW_DIR}/oci_mlflow*.whl ]; then \
35+
local_whl=$(find ${MLFLOW_DIR} -name "*.whl" -exec basename {} \; | head -n 1 ); \
36+
source ~/.bashrc && conda activate ${CONDA_ENV_NAME} && pip install ${MLFLOW_DIR}/$local_whl; \
37+
fi
38+
3539
RUN echo "conda activate oci-mlflow">>/root/.bashrc
3640
SHELL ["/bin/bash", "--login", "-c"]
3741

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
#!/bin/bash --login
12
# Copyright (c) 2023 Oracle and/or its affiliates.
23
# Licensed under the Universal Permissive License v 1.0 as shown at
34
# https://oss.oracle.com/licenses/upl/
45

5-
#!/bin/bash --login
66
set -m -e -o pipefail
77

88
conda activate oci-mlflow

0 commit comments

Comments
 (0)