Skip to content

Commit 8f45567

Browse files
committed
Add Mlflow Fingerprint
1 parent ff506ed commit 8f45567

File tree

4 files changed

+596
-0
lines changed

4 files changed

+596
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: '2'
2+
services:
3+
mlflow:
4+
image: ghcr.io/mlflow/mlflow:${MLFLOW_VERSION}
5+
ports:
6+
- "5000:5000"
7+
command: sh -c "mlflow server --host 0.0.0.0 --port 5000"
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2024 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -e
18+
19+
source ../../common.sh
20+
21+
SCRIPT_PATH="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)"
22+
# Root path to the web fingerprinter plugin.
23+
PROJECT_ROOT="$(cd -- "${SCRIPT_PATH}/../../../.." >/dev/null 2>&1 ; pwd -P)"
24+
# Path to the configurations for starting a live instance of MLflow.
25+
APP_PATH="${SCRIPT_PATH}/app"
26+
# Path to the temporary data holder.
27+
TMP_DATA="/tmp/mlflow_fingerprints"
28+
# Path to the local git repository for MLflow codebase.
29+
GIT_REPO="${TMP_DATA}/repo"
30+
# Path to the directory of all the updated fingerprints data.
31+
FINGERPRINTS_PATH="${TMP_DATA}/fingerprints"
32+
# Json data of the final result.
33+
JSON_DATA="${FINGERPRINTS_PATH}/fingerprint.json"
34+
# Binary proto data of the final result.
35+
BIN_DATA="${FINGERPRINTS_PATH}/fingerprint.binproto"
36+
# Read all the versions to be fingerprinted.
37+
readarray -t ALL_VERSIONS < "${SCRIPT_PATH}/versions.txt"
38+
39+
mkdir -p "${FINGERPRINTS_PATH}"
40+
41+
BINPROTO="${PROJECT_ROOT}/src/main/resources/fingerprinters/web/data/community/mlflow.binproto"
42+
43+
44+
StartMLflow() {
45+
local version="$1"
46+
pushd "${APP_PATH}" >/dev/null
47+
MLFLOW_VERSION="${version}" docker-compose up -d
48+
popd >/dev/null
49+
}
50+
51+
StopMLflow() {
52+
local version="$1"
53+
pushd "${APP_PATH}" >/dev/null
54+
MLFLOW_VERSION="${version}" docker-compose down --volumes --remove-orphans
55+
popd >/dev/null
56+
}
57+
58+
CreateFingerprintForMLflow() {
59+
local mlflowVersion="$1"
60+
61+
echo "Fingerprinting MLflow version ${mlflowVersion} ..."
62+
# Start a live instance of MLflow.
63+
StartMLflow "${mlflowVersion}"
64+
65+
# Arbitrarily chosen so that MLflow is up and running.
66+
echo "Waiting for MLflow ${mlflowVersion} to be ready ..."
67+
sleep 20
68+
69+
# Checkout the repository to the correct tag.
70+
checkOutRepo "${GIT_REPO}" "${mlflowVersion}"
71+
72+
updateFingerprint \
73+
"mlflow" \
74+
"${mlflowVersion}" \
75+
"${FINGERPRINTS_PATH}" \
76+
"${GIT_REPO}/mlflow" \
77+
"http://localhost:5000"
78+
79+
# Stop the live instance of MLflow.
80+
StopMLflow "${mlflowVersion}"
81+
}
82+
83+
# Convert the existing data file to a human-readable json file.
84+
# convertFingerprint "${BINPROTO}" "${JSON_DATA}"
85+
86+
# Fetch MLflow codebase.
87+
if [[ ! -d "${GIT_REPO}" ]] ; then
88+
git clone https://github.com/mlflow/mlflow "${GIT_REPO}"
89+
fi
90+
91+
# Get versions
92+
for mlflow_version in "${ALL_VERSIONS[@]}"; do
93+
CreateFingerprintForMLflow "${mlflow_version}"
94+
done
95+
96+
convertFingerprint "${JSON_DATA}" "${BIN_DATA}"
97+
98+
echo "Fingerprint updated for MLflow. Please commit the following file:"
99+
echo " ${BIN_DATA}"
100+
echo "to"
101+
echo " ${BINPROTO}"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
v1.30.0
2+
v2.0.0rc0
3+
v2.0.0
4+
v2.0.1
5+
v2.1.0
6+
v2.1.1
7+
v2.2.0
8+
v2.2.1
9+
v2.2.2
10+
v2.3.0
11+
v2.3.1
12+
v2.3.2
13+
v2.4.0
14+
v2.4.1
15+
v2.4.2
16+
v2.5.0
17+
v2.6.0
18+
v2.7.0
19+
v2.7.1
20+
v2.8.1
21+
v2.9.0
22+
v2.9.1
23+
v2.9.2
24+
v2.10.0
25+
v2.10.1
26+
v2.10.2
27+
v2.11.0
28+
v2.11.1
29+
v2.11.2
30+
v2.11.3

0 commit comments

Comments
 (0)