Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ray Fingerprint binproto and Updater Script #439

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
services:
ray:
image: rayproject/ray:${RAY_VERSION}
ports:
- "8265:8265"
command: sh -c "ray start --head --dashboard-host=0.0.0.0 && tail -f /dev/null"
97 changes: 97 additions & 0 deletions google/fingerprinters/web/scripts/updater/community/ray/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/usr/bin/env bash

# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

source ../../common.sh

SCRIPT_PATH="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)"
# Root path to the web fingerprinter plugin.
PROJECT_ROOT="$(cd -- "${SCRIPT_PATH}/../../../.." >/dev/null 2>&1 ; pwd -P)"
# Path to the configurations for starting a live instance of Ray.
RAY_APP_PATH="${SCRIPT_PATH}/app"
# Path to the temporary data holder.
TMP_DATA="/tmp/RAY_fingerprints"
# Path to the local git repository for Ray codebase.
GIT_REPO="${TMP_DATA}/repo"
# Path to the directory of all the updated fingerprints data.
FINGERPRINTS_PATH="${TMP_DATA}/fingerprints"
# Json data of the final result.
JSON_DATA="${FINGERPRINTS_PATH}/fingerprint.json"
# Binary proto data of the final result.
BIN_DATA="${FINGERPRINTS_PATH}/fingerprint.binproto"
# Read all the versions to be fingerprinted.
readarray -t ALL_VERSIONS < "${SCRIPT_PATH}/versions.txt"
mkdir -p "${FINGERPRINTS_PATH}"

startRay() {
local version="$1"
pushd "${RAY_APP_PATH}" >/dev/null
RAY_VERSION="${version}" docker compose up -d
popd >/dev/null
}

stopRay() {
local version="$1"
pushd "${RAY_APP_PATH}" >/dev/null
RAY_VERSION="${version}" docker compose down --volumes --remove-orphans
popd >/dev/null
}

createFingerprintForDashboard() {
local ray_version="$1"

echo "Fingerprinting Ray version ${ray_version} ..."
# Start a live instance of Ray.
startRay "${ray_version}"
# Arbitrarily chosen so that Ray is up and running.
echo "Waiting for Ray ${ray_version} to be ready ..."
sleep 30

# Checkout the repository to the correct tag.
checkOutRepo "${GIT_REPO}" "ray-${ray_version}"

updateFingerprint \
"ray" \
"${ray_version}" \
"${FINGERPRINTS_PATH}" \
"${GIT_REPO}/dashboard" \
"http://localhost:8265"

# Stop the live instance of Ray.
stopRay "${ray_version}"
}


# Convert the existing data file to a human-readable json file.
convertFingerprint \
"${PROJECT_ROOT}/src/main/resources/fingerprinters/web/data/community/ray.binproto" \
"${JSON_DATA}"

# Fetch Ray codebase.
if [[ ! -d "${GIT_REPO}" ]] ; then
git clone https://github.com/ray-project/ray.git "${GIT_REPO}"
fi

# Update for all the versions listed in versions.txt file.
for ray_version in "${ALL_VERSIONS[@]}"; do
createFingerprintForDashboard "${ray_version}"
done

convertFingerprint "${JSON_DATA}" "${BIN_DATA}"

echo "Fingerprint updated for Ray. Please commit the following file:"
echo " ${BIN_DATA}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
0.8.7
1.0.0
1.0.1
1.1.0
1.2.0
1.3.0
1.4.0
1.4.1
1.5.0
1.5.1
1.5.2
1.6.0
1.7.0
1.7.1
1.8.0
1.9.0
1.9.1
1.9.2
1.10.0
1.11.0
1.11.1
1.12.0
1.12.1
1.13.0
1.13.1
2.0.0
2.0.1
2.1.0
2.2.0
2.3.0
2.3.1
2.4.0
2.5.0
2.5.1
2.6.0
2.6.1
2.6.2
2.7.0
2.7.1
2.8.0
2.8.1
2.9.0
2.9.1
2.9.2
2.9.3
2.10.0
Loading
Loading