2020-04-15 08:10:22 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2020-05-05 10:47:49 -07:00
|
|
|
# Push caller's shell options (quietly)
|
|
|
|
{ SHELLOPTS_STACK="${SHELLOPTS_STACK-}|$(set +o); set -$-"; } 2> /dev/null
|
2020-04-15 08:10:22 -07:00
|
|
|
|
2020-05-05 10:47:49 -07:00
|
|
|
set -eo pipefail
|
|
|
|
if [ -z "${TRAVIS_PULL_REQUEST-}" ] || [ -n "${OSTYPE##darwin*}" ]; then set -ux; fi
|
2020-04-15 08:10:22 -07:00
|
|
|
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd)"
|
2022-04-13 18:11:30 +01:00
|
|
|
WORKSPACE_DIR="${ROOT_DIR}/.."
|
2020-04-15 08:10:22 -07:00
|
|
|
|
2020-04-21 09:53:08 -07:00
|
|
|
suppress_output() {
|
|
|
|
"${WORKSPACE_DIR}"/ci/suppress_output "$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
keep_alive() {
|
|
|
|
"${WORKSPACE_DIR}"/ci/keep_alive "$@"
|
|
|
|
}
|
|
|
|
|
2020-05-12 22:06:04 -07:00
|
|
|
# Calls the provided command with set -x temporarily suppressed
|
|
|
|
suppress_xtrace() {
|
|
|
|
{
|
|
|
|
local restore_shell_state=""
|
|
|
|
if [ -o xtrace ]; then set +x; restore_shell_state="set -x"; fi
|
|
|
|
} 2> /dev/null
|
|
|
|
local status=0
|
|
|
|
"$@" || status=$?
|
|
|
|
${restore_shell_state}
|
|
|
|
{ return "${status}"; } 2> /dev/null
|
|
|
|
}
|
|
|
|
|
2020-05-05 10:47:49 -07:00
|
|
|
# If provided the names of one or more environment variables, returns 0 if any of them is triggered.
|
2020-04-15 08:10:22 -07:00
|
|
|
# Usage: should_run_job [VAR_NAME]...
|
|
|
|
should_run_job() {
|
|
|
|
local skip=0
|
|
|
|
if [ -n "${1-}" ]; then # were any triggers provided? (if not, then the job will always run)
|
|
|
|
local envvar active_triggers=()
|
|
|
|
for envvar in "$@"; do
|
|
|
|
if [ "${!envvar}" = 1 ]; then
|
2020-05-05 10:47:49 -07:00
|
|
|
# success! we found at least one of the given triggers is occurring
|
|
|
|
active_triggers+=("${envvar}=${!envvar}")
|
2020-04-15 08:10:22 -07:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ 0 -eq "${#active_triggers[@]}" ]; then
|
|
|
|
echo "Job is not triggered by any of $1; skipping job."
|
2020-05-02 13:37:52 -07:00
|
|
|
sleep 15 # make sure output is flushed
|
2020-04-15 08:10:22 -07:00
|
|
|
skip=1
|
|
|
|
else
|
2020-05-02 13:37:52 -07:00
|
|
|
echo "Job is triggered by: ${active_triggers[*]}"
|
2020-04-15 08:10:22 -07:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
return "${skip}"
|
|
|
|
}
|
|
|
|
|
2020-04-29 21:19:02 -07:00
|
|
|
# Idempotent environment loading
|
2020-04-15 08:10:22 -07:00
|
|
|
reload_env() {
|
2020-05-05 10:47:49 -07:00
|
|
|
# Try to only modify CI-specific environment variables here (TRAVIS_... or GITHUB_...),
|
|
|
|
# e.g. for CI cross-compatibility.
|
|
|
|
# Normal environment variables should be set up at software installation time, not here.
|
2020-04-29 21:19:02 -07:00
|
|
|
|
|
|
|
if [ -n "${GITHUB_PULL_REQUEST-}" ]; then
|
|
|
|
case "${GITHUB_PULL_REQUEST}" in
|
|
|
|
[1-9]*) TRAVIS_PULL_REQUEST="${GITHUB_PULL_REQUEST}";;
|
|
|
|
*) TRAVIS_PULL_REQUEST=false;;
|
|
|
|
esac
|
|
|
|
export TRAVIS_PULL_REQUEST
|
2020-04-15 08:10:22 -07:00
|
|
|
fi
|
2020-04-29 21:19:02 -07:00
|
|
|
|
2020-06-15 17:27:17 -07:00
|
|
|
if [ "${GITHUB_ACTIONS-}" = true ] && [ -z "${TRAVIS_BRANCH-}" ]; then
|
2020-05-05 10:47:49 -07:00
|
|
|
# Define TRAVIS_BRANCH to make Travis scripts run on GitHub Actions.
|
|
|
|
TRAVIS_BRANCH="${GITHUB_BASE_REF:-${GITHUB_REF}}" # For pull requests, the base branch name
|
|
|
|
TRAVIS_BRANCH="${TRAVIS_BRANCH#refs/heads/}" # Remove refs/... prefix
|
|
|
|
# TODO(mehrdadn): Make TRAVIS_BRANCH be a named ref (e.g. 'master') like it's supposed to be.
|
|
|
|
# For now we use a hash because GitHub Actions doesn't clone refs the same way as Travis does.
|
|
|
|
TRAVIS_BRANCH="${GITHUB_HEAD_SHA:-${TRAVIS_BRANCH}}"
|
|
|
|
export TRAVIS_BRANCH
|
2020-04-29 21:19:02 -07:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
need_wheels() {
|
|
|
|
local error_code=1
|
|
|
|
case "${OSTYPE}" in
|
|
|
|
linux*) if [ "${LINUX_WHEELS-}" = 1 ]; then error_code=0; fi;;
|
|
|
|
darwin*) if [ "${MAC_WHEELS-}" = 1 ]; then error_code=0; fi;;
|
|
|
|
msys*) if [ "${WINDOWS_WHEELS-}" = 1 ]; then error_code=0; fi;;
|
|
|
|
esac
|
|
|
|
return "${error_code}"
|
|
|
|
}
|
|
|
|
|
2020-05-01 14:08:57 -07:00
|
|
|
upload_wheels() {
|
|
|
|
local branch="" commit
|
|
|
|
commit="$(git rev-parse --verify HEAD)"
|
|
|
|
if [ -z "${branch}" ]; then branch="${GITHUB_BASE_REF-}"; fi
|
|
|
|
if [ -z "${branch}" ]; then branch="${GITHUB_REF#refs/heads/}"; fi
|
2020-05-05 10:47:49 -07:00
|
|
|
if [ -z "${branch}" ]; then branch="${TRAVIS_BRANCH-}"; fi
|
2020-05-01 14:08:57 -07:00
|
|
|
if [ -z "${branch}" ]; then echo "Unable to detect branch name" 1>&2; return 1; fi
|
|
|
|
local local_dir="python/dist"
|
|
|
|
if [ -d "${local_dir}" ]; then
|
2020-05-12 22:06:04 -07:00
|
|
|
ls -a -l -- "${local_dir}"
|
|
|
|
local remote_dir
|
|
|
|
for remote_dir in latest "${branch}/${commit}"; do
|
|
|
|
if command -V aws; then
|
|
|
|
aws s3 sync --acl public-read --no-progress "${local_dir}" "s3://ray-wheels/${remote_dir}"
|
|
|
|
fi
|
|
|
|
done
|
2020-05-01 14:08:57 -07:00
|
|
|
fi
|
2020-06-18 14:12:12 -07:00
|
|
|
(
|
|
|
|
cd "${WORKSPACE_DIR}"/python
|
|
|
|
if ! python -s -c "import ray, sys; sys.exit(0 if ray._raylet.OPTIMIZED else 1)"; then
|
|
|
|
echo "ERROR: Uploading non-optimized wheels! Performance will suffer for users!"
|
|
|
|
false
|
|
|
|
fi
|
|
|
|
)
|
2020-05-01 14:08:57 -07:00
|
|
|
}
|
|
|
|
|
2020-06-12 21:32:10 -07:00
|
|
|
test_core() {
|
2020-07-15 09:34:33 -07:00
|
|
|
local args=(
|
|
|
|
"//:*"
|
|
|
|
)
|
|
|
|
case "${OSTYPE}" in
|
|
|
|
msys)
|
|
|
|
args+=(
|
|
|
|
-//:core_worker_test
|
2020-09-24 20:15:28 -07:00
|
|
|
-//:event_test
|
2020-07-15 09:34:33 -07:00
|
|
|
-//:gcs_server_rpc_test
|
2022-03-30 17:29:08 -07:00
|
|
|
-//:ray_syncer_test # TODO (iycheng): it's flaky on windows. Add it back once we figure out the cause
|
2022-05-14 20:35:40 -07:00
|
|
|
-//:gcs_client_reconnection_test
|
2020-07-15 09:34:33 -07:00
|
|
|
)
|
|
|
|
;;
|
|
|
|
esac
|
2021-01-13 15:17:11 -08:00
|
|
|
# shellcheck disable=SC2046
|
2022-04-13 18:11:30 +01:00
|
|
|
bazel test --config=ci --build_tests_only $(./ci/run/bazel_export_options) -- "${args[@]}"
|
2020-06-12 21:32:10 -07:00
|
|
|
}
|
2020-05-01 14:08:57 -07:00
|
|
|
|
2022-06-02 02:41:38 +00:00
|
|
|
prepare_docker() {
|
2022-07-29 20:53:40 +00:00
|
|
|
rm "${WORKSPACE_DIR}"/python/dist/* ||:
|
2022-06-02 02:41:38 +00:00
|
|
|
pushd "${WORKSPACE_DIR}/python"
|
2022-08-08 23:29:42 +00:00
|
|
|
pip install -e . --verbose
|
2022-06-02 02:41:38 +00:00
|
|
|
python setup.py bdist_wheel
|
|
|
|
tmp_dir="/tmp/prepare_docker_$RANDOM"
|
|
|
|
mkdir -p $tmp_dir
|
|
|
|
cp "${WORKSPACE_DIR}"/python/dist/*.whl $tmp_dir
|
2022-07-29 20:53:40 +00:00
|
|
|
wheel=$(ls "${WORKSPACE_DIR}"/python/dist/)
|
2022-06-02 02:41:38 +00:00
|
|
|
base_image=$(python -c "import sys; print(f'rayproject/ray-deps:nightly-py{sys.version_info[0]}{sys.version_info[1]}-cpu')")
|
|
|
|
echo "
|
|
|
|
FROM $base_image
|
|
|
|
|
|
|
|
ENV LC_ALL=C.UTF-8
|
|
|
|
ENV LANG=C.UTF-8
|
|
|
|
COPY ./*.whl /
|
|
|
|
EXPOSE 8000
|
|
|
|
EXPOSE 10001
|
2022-07-29 23:18:13 +00:00
|
|
|
RUN pip install /${wheel}[serve]
|
2022-06-02 02:41:38 +00:00
|
|
|
RUN sudo apt update && sudo apt install curl -y
|
|
|
|
" > $tmp_dir/Dockerfile
|
|
|
|
|
|
|
|
pushd $tmp_dir
|
|
|
|
docker build . -t ray_ci:v1
|
|
|
|
popd
|
|
|
|
|
|
|
|
popd
|
|
|
|
}
|
|
|
|
|
2022-01-05 10:49:14 -08:00
|
|
|
# For running Python tests on Windows.
|
2020-04-29 21:19:02 -07:00
|
|
|
test_python() {
|
2020-07-28 18:10:23 -07:00
|
|
|
local pathsep=":" args=()
|
2020-04-29 21:19:02 -07:00
|
|
|
if [ "${OSTYPE}" = msys ]; then
|
2020-07-28 18:10:23 -07:00
|
|
|
pathsep=";"
|
2020-06-12 21:32:10 -07:00
|
|
|
args+=(
|
2020-09-10 15:54:37 -07:00
|
|
|
python/ray/serve/...
|
2020-07-28 18:10:23 -07:00
|
|
|
python/ray/tests/...
|
2022-01-25 19:20:16 +02:00
|
|
|
-python/ray/serve:conda_env # pip field in runtime_env not supported
|
2022-03-16 10:14:44 -07:00
|
|
|
-python/ray/serve:test_cross_language # Ray java not built on Windows yet.
|
2022-07-15 15:48:43 -07:00
|
|
|
-python/ray/serve:test_gcs_failure # Fork not supported in windows
|
2022-07-18 14:39:36 -07:00
|
|
|
-python/ray/serve:test_standalone2 # Multinode not supported on Windows
|
2022-08-12 15:12:20 -07:00
|
|
|
-python/ray/serve:test_gradio
|
2022-09-01 10:46:15 -07:00
|
|
|
-python/ray/serve:test_gradio_visualization
|
2022-09-01 12:08:04 -07:00
|
|
|
-python/ray/serve:test_air_integrations_gpu
|
2022-01-14 09:16:22 +02:00
|
|
|
-python/ray/tests:test_actor_advanced # crashes in shutdown
|
2021-04-01 10:16:42 -07:00
|
|
|
-python/ray/tests:test_autoscaler # We don't support Autoscaler on Windows
|
2020-06-12 21:32:10 -07:00
|
|
|
-python/ray/tests:test_autoscaler_aws
|
2020-09-24 20:15:28 -07:00
|
|
|
-python/ray/tests:test_cli
|
2021-02-07 13:11:38 -08:00
|
|
|
-python/ray/tests:test_client_init # timeout
|
2021-04-01 10:16:42 -07:00
|
|
|
-python/ray/tests:test_command_runner # We don't support Autoscaler on Windows
|
2021-04-01 08:54:43 -07:00
|
|
|
-python/ray/tests:test_gcs_fault_tolerance # flaky
|
2021-08-25 09:27:31 -07:00
|
|
|
-python/ray/serve:test_get_deployment # address violation
|
2020-06-12 21:32:10 -07:00
|
|
|
-python/ray/tests:test_global_gc
|
2020-07-08 10:25:08 +08:00
|
|
|
-python/ray/tests:test_job
|
2020-06-12 21:32:10 -07:00
|
|
|
-python/ray/tests:test_memstat
|
2021-01-26 16:12:13 -08:00
|
|
|
-python/ray/tests:test_multi_node_3
|
2021-12-27 21:59:00 +02:00
|
|
|
-python/ray/tests:test_object_manager # OOM on test_object_directory_basic
|
2020-08-07 13:30:39 -07:00
|
|
|
-python/ray/tests:test_resource_demand_scheduler
|
2020-07-15 09:34:33 -07:00
|
|
|
-python/ray/tests:test_stress # timeout
|
|
|
|
-python/ray/tests:test_stress_sharded # timeout
|
2021-05-04 17:45:37 -04:00
|
|
|
-python/ray/tests:test_k8s_operator_unit_tests
|
2021-04-30 19:16:47 -10:00
|
|
|
-python/ray/tests:test_tracing # tracing not enabled on windows
|
2022-03-24 08:11:17 -07:00
|
|
|
-python/ray/tests:kuberay/test_autoscaling_e2e # irrelevant on windows
|
2022-07-27 13:45:00 -07:00
|
|
|
-python/ray/tests/xgboost/... # Requires ML dependencies, should not be run on Windows
|
|
|
|
-python/ray/tests/lightgbm/... # Requires ML dependencies, should not be run on Windows
|
|
|
|
-python/ray/tests/horovod/... # Requires ML dependencies, should not be run on Windows
|
|
|
|
-python/ray/tests/ray_lightning/... # Requires ML dependencies, should not be run on Windows
|
2020-06-12 21:32:10 -07:00
|
|
|
)
|
2020-07-28 18:10:23 -07:00
|
|
|
fi
|
|
|
|
if [ 0 -lt "${#args[@]}" ]; then # Any targets to test?
|
|
|
|
install_ray
|
2021-12-21 20:16:34 -08:00
|
|
|
|
|
|
|
# Shard the args.
|
|
|
|
BUILDKITE_PARALLEL_JOB=${BUILDKITE_PARALLEL_JOB:-'0'}
|
|
|
|
BUILDKITE_PARALLEL_JOB_COUNT=${BUILDKITE_PARALLEL_JOB_COUNT:-'1'}
|
2022-04-13 18:11:30 +01:00
|
|
|
test_shard_selection=$(python ./ci/run/bazel-sharding.py --exclude_manual --index "${BUILDKITE_PARALLEL_JOB}" --count "${BUILDKITE_PARALLEL_JOB_COUNT}" "${args[@]}")
|
2021-12-21 20:16:34 -08:00
|
|
|
|
2020-07-28 18:10:23 -07:00
|
|
|
# TODO(mehrdadn): We set PYTHONPATH here to let Python find our pickle5 under pip install -e.
|
|
|
|
# It's unclear to me if this should be necessary, but this is to make tests run for now.
|
|
|
|
# Check why this issue doesn't arise on Linux/Mac.
|
|
|
|
# Ideally importing ray.cloudpickle should import pickle5 automatically.
|
2021-12-21 20:16:34 -08:00
|
|
|
# shellcheck disable=SC2046,SC2086
|
|
|
|
bazel test --config=ci \
|
2022-04-13 18:11:30 +01:00
|
|
|
--build_tests_only $(./ci/run/bazel_export_options) \
|
2021-12-21 20:16:34 -08:00
|
|
|
--test_env=PYTHONPATH="${PYTHONPATH-}${pathsep}${WORKSPACE_DIR}/python/ray/pickle5_files" \
|
2022-06-14 20:24:02 +03:00
|
|
|
--test_env=CI="1" \
|
|
|
|
--test_env=RAY_CI_POST_WHEEL_TESTS="1" \
|
2022-03-29 10:56:42 +03:00
|
|
|
--test_env=USERPROFILE="${USERPROFILE}" \
|
|
|
|
--test_output=streamed \
|
2021-12-21 20:16:34 -08:00
|
|
|
-- \
|
|
|
|
${test_shard_selection};
|
2020-04-29 21:19:02 -07:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2022-01-05 10:49:14 -08:00
|
|
|
# For running large Python tests on Linux and MacOS.
|
|
|
|
test_large() {
|
2022-04-22 04:48:53 -04:00
|
|
|
# shellcheck disable=SC2046
|
|
|
|
bazel test --config=ci $(./ci/run/bazel_export_options) --test_env=CONDA_EXE --test_env=CONDA_PYTHON_EXE \
|
2022-01-05 10:49:14 -08:00
|
|
|
--test_env=CONDA_SHLVL --test_env=CONDA_PREFIX --test_env=CONDA_DEFAULT_ENV --test_env=CONDA_PROMPT_MODIFIER \
|
2022-05-13 13:48:14 -07:00
|
|
|
--test_env=CI --test_tag_filters="large_size_python_tests_shard_${BUILDKITE_PARALLEL_JOB}" "$@" \
|
2022-01-05 10:49:14 -08:00
|
|
|
-- python/ray/tests/...
|
|
|
|
}
|
|
|
|
|
2020-04-29 21:19:02 -07:00
|
|
|
test_cpp() {
|
2021-09-17 12:13:56 +08:00
|
|
|
# C++ worker example need _GLIBCXX_USE_CXX11_ABI flag, but if we put the flag into .bazelrc, the linux ci can't pass.
|
|
|
|
# So only set the flag in c++ worker example. More details: https://github.com/ray-project/ray/pull/18273
|
|
|
|
echo build --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0" >> ~/.bazelrc
|
2020-08-28 13:53:36 +08:00
|
|
|
bazel build --config=ci //cpp:all
|
2021-01-13 15:17:11 -08:00
|
|
|
# shellcheck disable=SC2046
|
2022-04-13 18:11:30 +01:00
|
|
|
bazel test --config=ci $(./ci/run/bazel_export_options) --test_strategy=exclusive //cpp:all --build_tests_only
|
2021-06-11 11:49:13 +08:00
|
|
|
# run cluster mode test with external cluster
|
2021-08-13 12:22:37 +08:00
|
|
|
bazel test //cpp:cluster_mode_test --test_arg=--external_cluster=true --test_arg=--redis_password="1234" \
|
|
|
|
--test_arg=--ray_redis_password="1234"
|
2022-03-11 03:06:14 +08:00
|
|
|
bazel test --test_output=all //cpp:test_python_call_cpp
|
2021-02-01 19:24:33 +08:00
|
|
|
|
2021-08-13 12:22:37 +08:00
|
|
|
# run the cpp example
|
2021-09-24 23:39:00 +08:00
|
|
|
rm -rf ray-template && mkdir ray-template
|
|
|
|
ray cpp --generate-bazel-project-template-to ray-template
|
|
|
|
pushd ray-template && bash run.sh
|
2020-04-29 21:19:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
test_wheels() {
|
|
|
|
local result=0 flush_logs=0
|
|
|
|
|
|
|
|
if need_wheels; then
|
2022-04-13 18:11:30 +01:00
|
|
|
"${WORKSPACE_DIR}"/ci/build/test-wheels.sh || { result=$? && flush_logs=1; }
|
2020-04-15 08:10:22 -07:00
|
|
|
fi
|
2020-04-29 21:19:02 -07:00
|
|
|
|
|
|
|
if [ 0 -ne "${flush_logs}" ]; then
|
|
|
|
cat -- /tmp/ray/session_latest/logs/* || true
|
|
|
|
sleep 60 # Explicitly sleep 60 seconds for logs to go through
|
|
|
|
fi
|
|
|
|
|
|
|
|
return "${result}"
|
|
|
|
}
|
|
|
|
|
2020-05-05 10:47:49 -07:00
|
|
|
install_npm_project() {
|
|
|
|
if [ "${OSTYPE}" = msys ]; then
|
|
|
|
# Not Windows-compatible: https://github.com/npm/cli/issues/558#issuecomment-584673763
|
|
|
|
{ echo "WARNING: Skipping NPM due to module incompatibilities with Windows"; } 2> /dev/null
|
|
|
|
else
|
2021-04-28 01:11:57 +08:00
|
|
|
npm i -g yarn
|
|
|
|
yarn
|
2020-05-05 10:47:49 -07:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
build_dashboard_front_end() {
|
|
|
|
if [ "${OSTYPE}" = msys ]; then
|
|
|
|
{ echo "WARNING: Skipping dashboard due to NPM incompatibilities with Windows"; } 2> /dev/null
|
|
|
|
else
|
|
|
|
(
|
2021-09-15 11:17:15 -05:00
|
|
|
cd ray/dashboard/client
|
2021-01-18 00:44:24 -08:00
|
|
|
|
2021-06-14 11:30:55 -07:00
|
|
|
# skip nvm activation on buildkite linux instances.
|
|
|
|
if [ -z "${BUILDKITE-}" ] || [[ "${OSTYPE}" != linux* ]]; then
|
2021-01-18 00:44:24 -08:00
|
|
|
set +x # suppress set -x since it'll get very noisy here
|
|
|
|
. "${HOME}/.nvm/nvm.sh"
|
2021-10-19 14:13:06 -07:00
|
|
|
NODE_VERSION="14"
|
|
|
|
nvm install $NODE_VERSION
|
|
|
|
nvm use --silent $NODE_VERSION
|
2021-01-18 00:44:24 -08:00
|
|
|
fi
|
2020-05-05 10:47:49 -07:00
|
|
|
install_npm_project
|
2021-04-28 01:11:57 +08:00
|
|
|
yarn build
|
2020-05-05 10:47:49 -07:00
|
|
|
)
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-04-29 21:19:02 -07:00
|
|
|
build_sphinx_docs() {
|
|
|
|
(
|
|
|
|
cd "${WORKSPACE_DIR}"/doc
|
|
|
|
if [ "${OSTYPE}" = msys ]; then
|
|
|
|
echo "WARNING: Documentation not built on Windows due to currently-unresolved issues"
|
|
|
|
else
|
2022-03-25 01:04:02 +01:00
|
|
|
make html
|
|
|
|
make doctest
|
2020-04-29 21:19:02 -07:00
|
|
|
fi
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2022-03-29 01:08:53 -07:00
|
|
|
check_sphinx_links() {
|
|
|
|
(
|
|
|
|
cd "${WORKSPACE_DIR}"/doc
|
|
|
|
if [ "${OSTYPE}" = msys ]; then
|
|
|
|
echo "WARNING: Documentation not built on Windows due to currently-unresolved issues"
|
|
|
|
else
|
|
|
|
make linkcheck
|
|
|
|
fi
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-04-29 21:19:02 -07:00
|
|
|
install_cython_examples() {
|
2020-05-05 10:47:49 -07:00
|
|
|
(
|
|
|
|
cd "${WORKSPACE_DIR}"/doc/examples/cython
|
|
|
|
pip install scipy
|
|
|
|
python setup.py install --user
|
|
|
|
)
|
2020-04-29 21:19:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
install_go() {
|
2020-05-05 10:47:49 -07:00
|
|
|
local gimme_url="https://raw.githubusercontent.com/travis-ci/gimme/master/gimme"
|
2022-06-15 17:31:07 -07:00
|
|
|
suppress_xtrace eval "$(curl -f -s -L "${gimme_url}" | GIMME_GO_VERSION=1.18.3 bash)"
|
2020-05-05 10:47:49 -07:00
|
|
|
|
|
|
|
if [ -z "${GOPATH-}" ]; then
|
|
|
|
GOPATH="${GOPATH:-${HOME}/go_dir}"
|
|
|
|
export GOPATH
|
|
|
|
fi
|
2020-04-29 21:19:02 -07:00
|
|
|
}
|
|
|
|
|
2020-07-16 16:28:37 -07:00
|
|
|
_bazel_build_before_install() {
|
|
|
|
local target
|
2020-07-14 14:51:51 -07:00
|
|
|
if [ "${OSTYPE}" = msys ]; then
|
2020-07-16 16:28:37 -07:00
|
|
|
# On Windows, we perform as full of a build as possible, to ensure the repository always remains buildable on Windows.
|
2020-07-14 14:51:51 -07:00
|
|
|
# (Pip install will not perform a full build.)
|
2020-07-16 16:28:37 -07:00
|
|
|
target="//:*"
|
|
|
|
else
|
|
|
|
# Just build Python on other platforms.
|
|
|
|
# This because pip install captures & suppresses the build output, which causes a timeout on CI.
|
|
|
|
target="//:ray_pkg"
|
2020-07-14 14:51:51 -07:00
|
|
|
fi
|
2020-07-16 16:28:37 -07:00
|
|
|
# NOTE: Do not add build flags here. Use .bazelrc and --config instead.
|
2021-08-05 17:58:19 -07:00
|
|
|
|
2021-08-17 10:21:41 -07:00
|
|
|
if [ -z "${RAY_DEBUG_BUILD-}" ]; then
|
2021-08-05 17:58:19 -07:00
|
|
|
bazel build "${target}"
|
2021-08-17 10:21:41 -07:00
|
|
|
elif [ "${RAY_DEBUG_BUILD}" = "asan" ]; then
|
|
|
|
# bazel build --config asan "${target}"
|
|
|
|
echo "Not needed"
|
|
|
|
elif [ "${RAY_DEBUG_BUILD}" = "debug" ]; then
|
2021-08-05 17:58:19 -07:00
|
|
|
bazel build --config debug "${target}"
|
2021-08-17 10:21:41 -07:00
|
|
|
else
|
|
|
|
echo "Invalid config given"
|
|
|
|
exit 1
|
2021-08-05 17:58:19 -07:00
|
|
|
fi
|
2020-07-14 14:51:51 -07:00
|
|
|
}
|
2020-07-02 21:06:31 -07:00
|
|
|
|
2020-12-22 22:51:45 -08:00
|
|
|
|
|
|
|
_bazel_build_protobuf() {
|
|
|
|
bazel build "//:install_py_proto"
|
|
|
|
}
|
|
|
|
|
2020-07-14 14:51:51 -07:00
|
|
|
install_ray() {
|
|
|
|
# TODO(mehrdadn): This function should be unified with the one in python/build-wheel-windows.sh.
|
|
|
|
(
|
2020-05-05 10:47:49 -07:00
|
|
|
cd "${WORKSPACE_DIR}"/python
|
|
|
|
build_dashboard_front_end
|
2020-07-16 16:28:37 -07:00
|
|
|
keep_alive pip install -v -e .
|
2020-05-05 10:47:49 -07:00
|
|
|
)
|
2022-06-14 20:24:02 +03:00
|
|
|
(
|
|
|
|
# For runtime_env tests, wheels are needed
|
|
|
|
cd "${WORKSPACE_DIR}"
|
|
|
|
keep_alive pip wheel -e python -w .whl
|
|
|
|
)
|
2020-04-29 21:19:02 -07:00
|
|
|
}
|
|
|
|
|
2021-10-06 13:48:24 +01:00
|
|
|
validate_wheels_commit_str() {
|
|
|
|
if [ "${OSTYPE}" = msys ]; then
|
|
|
|
echo "Windows builds do not set the commit string, skipping wheel commit validity check."
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "${BUILDKITE_COMMIT}" ]; then
|
|
|
|
EXPECTED_COMMIT=${BUILDKITE_COMMIT:-}
|
|
|
|
else
|
|
|
|
EXPECTED_COMMIT=${TRAVIS_COMMIT:-}
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$EXPECTED_COMMIT" ]; then
|
|
|
|
echo "Could not validate expected wheel commits: TRAVIS_COMMIT is empty."
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
for whl in .whl/*.whl; do
|
|
|
|
basename=${whl##*/}
|
|
|
|
|
|
|
|
if [[ "$basename" =~ "_cpp" ]]; then
|
|
|
|
# cpp wheels cannot be checked this way
|
|
|
|
echo "Skipping CPP wheel ${basename} for wheel commit validation."
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
folder=${basename%%-cp*}
|
|
|
|
WHL_COMMIT=$(unzip -p "$whl" "${folder}.data/purelib/ray/__init__.py" | grep "__commit__" | awk -F'"' '{print $2}')
|
|
|
|
|
|
|
|
if [ "${WHL_COMMIT}" != "${EXPECTED_COMMIT}" ]; then
|
|
|
|
echo "Error: Observed wheel commit (${WHL_COMMIT}) is not expected commit (${EXPECTED_COMMIT}). Aborting."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Wheel ${basename} has the correct commit: ${WHL_COMMIT}"
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "All wheels passed the sanity check and have the correct wheel commit set."
|
|
|
|
}
|
|
|
|
|
2020-04-29 21:19:02 -07:00
|
|
|
build_wheels() {
|
2021-10-06 13:48:24 +01:00
|
|
|
# Create wheel output directory and empty contents
|
|
|
|
# If buildkite runners are re-used, wheels from previous builds might be here, so we delete them.
|
|
|
|
mkdir -p .whl
|
|
|
|
rm -rf .whl/* || true
|
|
|
|
|
2020-04-29 21:19:02 -07:00
|
|
|
case "${OSTYPE}" in
|
|
|
|
linux*)
|
|
|
|
# Mount bazel cache dir to the docker container.
|
|
|
|
# For the linux wheel build, we use a shared cache between all
|
|
|
|
# wheels, but not between different travis runs, because that
|
|
|
|
# caused timeouts in the past. See the "cache: false" line below.
|
2020-05-05 10:47:49 -07:00
|
|
|
local MOUNT_BAZEL_CACHE=(
|
|
|
|
-v "${HOME}/ray-bazel-cache":/root/ray-bazel-cache
|
2020-08-28 15:03:50 -07:00
|
|
|
-e "TRAVIS=true"
|
|
|
|
-e "TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST:-false}"
|
|
|
|
-e "encrypted_1c30b31fe1ee_key=${encrypted_1c30b31fe1ee_key-}"
|
|
|
|
-e "encrypted_1c30b31fe1ee_iv=${encrypted_1c30b31fe1ee_iv-}"
|
|
|
|
-e "TRAVIS_COMMIT=${TRAVIS_COMMIT}"
|
|
|
|
-e "CI=${CI}"
|
2020-11-17 15:49:42 +08:00
|
|
|
-e "RAY_INSTALL_JAVA=${RAY_INSTALL_JAVA:-}"
|
2021-02-18 14:19:28 -08:00
|
|
|
-e "BUILDKITE=${BUILDKITE:-}"
|
2021-12-21 20:16:34 -08:00
|
|
|
-e "BUILDKITE_PULL_REQUEST=${BUILDKITE_PULL_REQUEST:-}"
|
2021-02-18 14:19:28 -08:00
|
|
|
-e "BUILDKITE_BAZEL_CACHE_URL=${BUILDKITE_BAZEL_CACHE_URL:-}"
|
2021-08-05 17:58:19 -07:00
|
|
|
-e "RAY_DEBUG_BUILD=${RAY_DEBUG_BUILD:-}"
|
2020-05-05 10:47:49 -07:00
|
|
|
)
|
2020-04-29 21:19:02 -07:00
|
|
|
|
2021-02-18 14:19:28 -08:00
|
|
|
if [ -z "${BUILDKITE-}" ]; then
|
|
|
|
# This command should be kept in sync with ray/python/README-building-wheels.md,
|
|
|
|
# except the "${MOUNT_BAZEL_CACHE[@]}" part.
|
|
|
|
docker run --rm -w /ray -v "${PWD}":/ray "${MOUNT_BAZEL_CACHE[@]}" \
|
2021-11-16 17:52:51 -08:00
|
|
|
quay.io/pypa/manylinux2014_x86_64:2021-11-07-28723f3 /ray/python/build-wheel-manylinux2014.sh
|
2021-02-18 14:19:28 -08:00
|
|
|
else
|
2021-07-16 09:36:39 +08:00
|
|
|
rm -rf /ray-mount/*
|
2021-10-06 13:48:24 +01:00
|
|
|
rm -rf /ray-mount/.whl || true
|
|
|
|
rm -rf /ray/.whl || true
|
2021-02-18 14:19:28 -08:00
|
|
|
cp -rT /ray /ray-mount
|
2021-10-06 13:48:24 +01:00
|
|
|
ls -a /ray-mount
|
2021-02-18 14:19:28 -08:00
|
|
|
docker run --rm -v /ray:/ray-mounted ubuntu:focal ls /
|
|
|
|
docker run --rm -v /ray:/ray-mounted ubuntu:focal ls /ray-mounted
|
|
|
|
docker run --rm -w /ray -v /ray:/ray "${MOUNT_BAZEL_CACHE[@]}" \
|
2022-01-03 14:36:21 +00:00
|
|
|
quay.io/pypa/manylinux2014_x86_64:2021-11-07-28723f3 /ray/python/build-wheel-manylinux2014.sh
|
2021-02-18 14:19:28 -08:00
|
|
|
cp -rT /ray-mount /ray # copy new files back here
|
|
|
|
find . | grep whl # testing
|
2021-10-06 13:48:24 +01:00
|
|
|
|
2021-10-27 02:27:56 -07:00
|
|
|
# Sync the directory to buildkite artifacts
|
|
|
|
rm -rf /artifact-mount/.whl || true
|
2022-04-25 21:19:11 +01:00
|
|
|
|
|
|
|
if [ "${UPLOAD_WHEELS_AS_ARTIFACTS-}" = "1" ]; then
|
|
|
|
cp -r .whl /artifact-mount/.whl
|
|
|
|
chmod -R 777 /artifact-mount/.whl
|
|
|
|
fi
|
2021-10-27 02:27:56 -07:00
|
|
|
|
2022-03-25 13:07:20 +00:00
|
|
|
validate_wheels_commit_str
|
2021-02-18 14:19:28 -08:00
|
|
|
fi
|
2020-04-29 21:19:02 -07:00
|
|
|
;;
|
|
|
|
darwin*)
|
|
|
|
# This command should be kept in sync with ray/python/README-building-wheels.md.
|
2021-08-07 21:54:34 -07:00
|
|
|
"${WORKSPACE_DIR}"/python/build-wheel-macos.sh
|
2022-04-17 13:10:14 -07:00
|
|
|
mkdir -p /tmp/artifacts/.whl
|
|
|
|
rm -rf /tmp/artifacts/.whl || true
|
2022-04-25 21:19:11 +01:00
|
|
|
|
|
|
|
if [ "${UPLOAD_WHEELS_AS_ARTIFACTS-}" = "1" ]; then
|
|
|
|
cp -r .whl /tmp/artifacts/.whl
|
|
|
|
chmod -R 777 /tmp/artifacts/.whl
|
|
|
|
fi
|
2021-10-06 13:48:24 +01:00
|
|
|
|
|
|
|
validate_wheels_commit_str
|
2020-04-29 21:19:02 -07:00
|
|
|
;;
|
|
|
|
msys*)
|
2020-07-28 18:10:23 -07:00
|
|
|
keep_alive "${WORKSPACE_DIR}"/python/build-wheel-windows.sh
|
2020-04-29 21:19:02 -07:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
lint_readme() {
|
2020-05-19 08:29:17 -07:00
|
|
|
if python -s -c "import docutils" >/dev/null 2>/dev/null; then
|
|
|
|
(
|
|
|
|
cd "${WORKSPACE_DIR}"/python
|
|
|
|
python setup.py check --restructuredtext --strict --metadata
|
|
|
|
)
|
|
|
|
else
|
|
|
|
echo "Skipping README lint because the docutils package is not installed" 1>&2
|
|
|
|
fi
|
2020-04-29 21:19:02 -07:00
|
|
|
}
|
|
|
|
|
2020-07-30 16:39:28 -07:00
|
|
|
lint_scripts() {
|
2022-04-13 18:11:30 +01:00
|
|
|
FORMAT_SH_PRINT_DIFF=1 "${ROOT_DIR}"/lint/format.sh --all-scripts
|
2020-04-29 21:19:02 -07:00
|
|
|
}
|
|
|
|
|
2022-04-19 13:30:37 -07:00
|
|
|
lint_banned_words() {
|
|
|
|
"${ROOT_DIR}"/lint/check-banned-words.sh
|
|
|
|
}
|
|
|
|
|
2022-05-21 15:05:07 -07:00
|
|
|
lint_annotations() {
|
|
|
|
"${ROOT_DIR}"/lint/check_api_annotations.py
|
|
|
|
}
|
|
|
|
|
2020-04-29 21:19:02 -07:00
|
|
|
lint_bazel() {
|
|
|
|
# Run buildifier without affecting external environment variables
|
|
|
|
(
|
|
|
|
mkdir -p -- "${GOPATH}"
|
2020-07-21 19:56:41 -07:00
|
|
|
export PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}"
|
2020-04-29 21:19:02 -07:00
|
|
|
|
|
|
|
# Build buildifier
|
2022-06-15 17:31:07 -07:00
|
|
|
go install github.com/bazelbuild/buildtools/buildifier@latest
|
2020-04-29 21:19:02 -07:00
|
|
|
|
|
|
|
# Now run buildifier
|
2022-04-13 18:11:30 +01:00
|
|
|
"${ROOT_DIR}"/lint/bazel-format.sh
|
2020-04-29 21:19:02 -07:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
[CI] Check test files for `if __name__...` snippet (#25322)
Bazel operates by simply running the python scripts given to it in `py_test`. If the script doesn't invoke pytest on itself in the `if _name__ == "__main__"` snippet, no tests will be ran, and the script will pass. This has led to several tests (indeed, some are fixed in this PR) that, despite having been written, have never ran in CI. This PR adds a lint check to check all `py_test` sources for the presence of `if _name__ == "__main__"` snippet, and will fail CI if there are any detected without it. This system is only enabled for libraries right now (tune, train, air, rllib), but it could be trivially extended to other modules if approved.
2022-06-02 11:30:00 +02:00
|
|
|
lint_bazel_pytest() {
|
|
|
|
pip install yq
|
|
|
|
cd "${WORKSPACE_DIR}"
|
2022-06-08 22:25:59 +01:00
|
|
|
for team in "team:ml" "team:rllib" "team:serve"; do
|
2022-06-07 19:54:10 +02:00
|
|
|
# this does the following:
|
|
|
|
# - find all py_test rules in bazel that have the specified team tag EXCEPT ones with "no_main" tag and outputs them as xml
|
|
|
|
# - converts the xml to json
|
|
|
|
# - feeds the json into pytest_checker.py
|
|
|
|
bazel query "kind(py_test.*, tests(python/...) intersect attr(tags, \"\b$team\b\", python/...) except attr(tags, \"\bno_main\b\", python/...))" --output xml | xq | python scripts/pytest_checker.py
|
|
|
|
done
|
[CI] Check test files for `if __name__...` snippet (#25322)
Bazel operates by simply running the python scripts given to it in `py_test`. If the script doesn't invoke pytest on itself in the `if _name__ == "__main__"` snippet, no tests will be ran, and the script will pass. This has led to several tests (indeed, some are fixed in this PR) that, despite having been written, have never ran in CI. This PR adds a lint check to check all `py_test` sources for the presence of `if _name__ == "__main__"` snippet, and will fail CI if there are any detected without it. This system is only enabled for libraries right now (tune, train, air, rllib), but it could be trivially extended to other modules if approved.
2022-06-02 11:30:00 +02:00
|
|
|
}
|
|
|
|
|
2020-04-29 21:19:02 -07:00
|
|
|
lint_web() {
|
|
|
|
(
|
2021-09-15 11:17:15 -05:00
|
|
|
cd "${WORKSPACE_DIR}"/python/ray/dashboard/client
|
2020-04-29 21:19:02 -07:00
|
|
|
set +x # suppress set -x since it'll get very noisy here
|
2021-01-29 15:48:02 -08:00
|
|
|
|
|
|
|
if [ -z "${BUILDKITE-}" ]; then
|
|
|
|
. "${HOME}/.nvm/nvm.sh"
|
2021-10-19 14:13:06 -07:00
|
|
|
NODE_VERSION="14"
|
|
|
|
nvm install $NODE_VERSION
|
|
|
|
nvm use --silent $NODE_VERSION
|
2021-01-29 15:48:02 -08:00
|
|
|
fi
|
|
|
|
|
2020-04-29 21:19:02 -07:00
|
|
|
install_npm_project
|
2020-07-21 19:56:41 -07:00
|
|
|
local filenames
|
|
|
|
# shellcheck disable=SC2207
|
|
|
|
filenames=($(find src -name "*.ts" -or -name "*.tsx"))
|
|
|
|
node_modules/.bin/eslint --max-warnings 0 "${filenames[@]}"
|
|
|
|
node_modules/.bin/prettier --check "${filenames[@]}"
|
2020-04-29 21:19:02 -07:00
|
|
|
node_modules/.bin/prettier --check public/index.html
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2021-08-04 17:19:38 +08:00
|
|
|
lint_copyright() {
|
|
|
|
(
|
2022-04-13 18:11:30 +01:00
|
|
|
"${ROOT_DIR}"/lint/copyright-format.sh -c
|
2021-08-04 17:19:38 +08:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-04-29 21:19:02 -07:00
|
|
|
_lint() {
|
|
|
|
local platform=""
|
|
|
|
case "${OSTYPE}" in
|
|
|
|
linux*) platform=linux;;
|
|
|
|
esac
|
|
|
|
|
2020-05-19 08:29:17 -07:00
|
|
|
if command -v clang-format > /dev/null; then
|
2022-04-13 18:11:30 +01:00
|
|
|
"${ROOT_DIR}"/lint/check-git-clang-format-output.sh
|
2020-05-19 08:29:17 -07:00
|
|
|
else
|
|
|
|
{ echo "WARNING: Skipping linting C/C++ as clang-format is not installed."; } 2> /dev/null
|
|
|
|
fi
|
2020-04-29 21:19:02 -07:00
|
|
|
|
2021-09-17 19:01:07 -07:00
|
|
|
if command -v clang-tidy > /dev/null; then
|
|
|
|
pushd "${WORKSPACE_DIR}"
|
2022-04-13 18:11:30 +01:00
|
|
|
"${ROOT_DIR}"/env/install-llvm-binaries.sh
|
2021-09-17 19:01:07 -07:00
|
|
|
popd
|
2021-10-19 08:45:25 -07:00
|
|
|
# Disable clang-tidy until ergonomic issues are resolved.
|
2022-04-13 18:11:30 +01:00
|
|
|
# "${ROOT_DIR}"/lint/check-git-clang-tidy-output.sh
|
2021-09-17 19:01:07 -07:00
|
|
|
else
|
|
|
|
{ echo "WARNING: Skipping running clang-tidy which is not installed."; } 2> /dev/null
|
|
|
|
fi
|
|
|
|
|
2020-07-30 16:39:28 -07:00
|
|
|
# Run script linting
|
|
|
|
lint_scripts
|
2020-04-29 21:19:02 -07:00
|
|
|
|
2022-04-19 13:30:37 -07:00
|
|
|
# Run banned words check.
|
|
|
|
lint_banned_words
|
|
|
|
|
2022-05-21 15:05:07 -07:00
|
|
|
# Run annotations check.
|
|
|
|
lint_annotations
|
|
|
|
|
2020-04-29 21:19:02 -07:00
|
|
|
# Make sure that the README is formatted properly.
|
|
|
|
lint_readme
|
|
|
|
|
|
|
|
if [ "${platform}" = linux ]; then
|
|
|
|
# Run Bazel linter Buildifier.
|
|
|
|
lint_bazel
|
|
|
|
|
[CI] Check test files for `if __name__...` snippet (#25322)
Bazel operates by simply running the python scripts given to it in `py_test`. If the script doesn't invoke pytest on itself in the `if _name__ == "__main__"` snippet, no tests will be ran, and the script will pass. This has led to several tests (indeed, some are fixed in this PR) that, despite having been written, have never ran in CI. This PR adds a lint check to check all `py_test` sources for the presence of `if _name__ == "__main__"` snippet, and will fail CI if there are any detected without it. This system is only enabled for libraries right now (tune, train, air, rllib), but it could be trivially extended to other modules if approved.
2022-06-02 11:30:00 +02:00
|
|
|
# Check if py_test files have the if __name__... snippet
|
|
|
|
lint_bazel_pytest
|
|
|
|
|
2020-04-29 21:19:02 -07:00
|
|
|
# Run TypeScript and HTML linting.
|
|
|
|
lint_web
|
2021-08-04 17:19:38 +08:00
|
|
|
|
|
|
|
# lint copyright
|
|
|
|
lint_copyright
|
2021-08-18 18:38:31 -07:00
|
|
|
|
|
|
|
# lint test script
|
|
|
|
pushd "${WORKSPACE_DIR}"
|
2022-04-13 18:11:30 +01:00
|
|
|
bazel query 'kind("cc_test", //...)' --output=xml | python "${ROOT_DIR}"/lint/check-bazel-team-owner.py
|
|
|
|
bazel query 'kind("py_test", //...)' --output=xml | python "${ROOT_DIR}"/lint/check-bazel-team-owner.py
|
2021-08-18 18:38:31 -07:00
|
|
|
popd
|
2022-03-07 19:54:49 -08:00
|
|
|
|
|
|
|
# Make sure tests will be run by CI.
|
2022-04-13 18:11:30 +01:00
|
|
|
python "${ROOT_DIR}"/pipeline/check-test-run.py
|
2020-04-29 21:19:02 -07:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
lint() {
|
2020-05-05 10:47:49 -07:00
|
|
|
install_go
|
2020-04-29 21:19:02 -07:00
|
|
|
# Checkout a clean copy of the repo to avoid seeing changes that have been made to the current one
|
|
|
|
(
|
|
|
|
WORKSPACE_DIR="$(TMPDIR="${WORKSPACE_DIR}/.." mktemp -d)"
|
2020-07-21 14:47:09 -07:00
|
|
|
# shellcheck disable=SC2030
|
2022-04-13 18:11:30 +01:00
|
|
|
ROOT_DIR="${WORKSPACE_DIR}"/ci
|
2020-04-29 21:19:02 -07:00
|
|
|
git worktree add -q "${WORKSPACE_DIR}"
|
|
|
|
pushd "${WORKSPACE_DIR}"
|
|
|
|
. "${ROOT_DIR}"/ci.sh _lint
|
|
|
|
popd # this is required so we can remove the worktree when we're done
|
|
|
|
git worktree remove --force "${WORKSPACE_DIR}"
|
|
|
|
)
|
2020-04-15 08:10:22 -07:00
|
|
|
}
|
|
|
|
|
2020-05-05 10:47:49 -07:00
|
|
|
_check_job_triggers() {
|
2020-05-02 13:37:52 -07:00
|
|
|
local job_names
|
|
|
|
job_names="$1"
|
2020-04-15 08:10:22 -07:00
|
|
|
|
|
|
|
local variable_definitions
|
2021-12-21 20:16:34 -08:00
|
|
|
if command -v python3; then
|
|
|
|
# shellcheck disable=SC2031
|
2022-04-13 18:11:30 +01:00
|
|
|
variable_definitions=($(python3 "${ROOT_DIR}"/pipeline/determine_tests_to_run.py))
|
2021-12-21 20:16:34 -08:00
|
|
|
else
|
|
|
|
# shellcheck disable=SC2031
|
2022-04-13 18:11:30 +01:00
|
|
|
variable_definitions=($(python "${ROOT_DIR}"/pipeline/determine_tests_to_run.py))
|
2021-12-21 20:16:34 -08:00
|
|
|
fi
|
2020-04-15 17:00:38 -07:00
|
|
|
if [ 0 -lt "${#variable_definitions[@]}" ]; then
|
2020-05-05 10:47:49 -07:00
|
|
|
local expression restore_shell_state=""
|
|
|
|
if [ -o xtrace ]; then set +x; restore_shell_state="set -x;"; fi # Disable set -x (noisy here)
|
|
|
|
{
|
|
|
|
expression="$(printf "%q " "${variable_definitions[@]}")"
|
|
|
|
printf "%s\n" "${expression}" >> ~/.bashrc
|
|
|
|
}
|
|
|
|
eval "${restore_shell_state}" "${expression}" # Restore set -x, then evaluate expression
|
2020-04-15 17:00:38 -07:00
|
|
|
fi
|
2020-04-15 08:10:22 -07:00
|
|
|
|
2020-07-21 14:47:09 -07:00
|
|
|
# shellcheck disable=SC2086
|
2020-04-15 08:10:22 -07:00
|
|
|
if ! (set +x && should_run_job ${job_names//,/ }); then
|
2020-06-15 17:27:17 -07:00
|
|
|
if [ "${GITHUB_ACTIONS-}" = true ]; then
|
2020-05-05 10:47:49 -07:00
|
|
|
# If this job is to be skipped, emit 'exit' into .bashrc to quickly exit all following steps.
|
|
|
|
# This isn't needed on Travis (since everything runs in one shell), but is on GitHub Actions.
|
2020-04-21 09:53:08 -07:00
|
|
|
cat <<EOF1 >> ~/.bashrc
|
|
|
|
cat <<EOF2 1>&2
|
|
|
|
Exiting shell as no triggers were active for this job:
|
|
|
|
${job_names//,/}
|
|
|
|
The active triggers during job initialization were the following:
|
|
|
|
${variable_definitions[*]}
|
|
|
|
EOF2
|
|
|
|
exit 0
|
|
|
|
EOF1
|
|
|
|
fi
|
2020-04-15 08:10:22 -07:00
|
|
|
exit 0
|
|
|
|
fi
|
2020-04-16 15:23:00 -07:00
|
|
|
}
|
|
|
|
|
2020-04-29 21:19:02 -07:00
|
|
|
configure_system() {
|
|
|
|
git config --global advice.detachedHead false
|
|
|
|
git config --global core.askpass ""
|
|
|
|
git config --global credential.helper ""
|
|
|
|
git config --global credential.modalprompt false
|
2021-12-21 20:16:34 -08:00
|
|
|
|
|
|
|
# Requests library need root certificates.
|
|
|
|
if [ "${OSTYPE}" = msys ]; then
|
|
|
|
certutil -generateSSTFromWU roots.sst && certutil -addstore -f root roots.sst && rm roots.sst
|
|
|
|
fi
|
2020-04-29 21:19:02 -07:00
|
|
|
}
|
|
|
|
|
2020-04-16 15:23:00 -07:00
|
|
|
# Initializes the environment for the current job. Performs the following tasks:
|
2020-05-05 10:47:49 -07:00
|
|
|
# - Calls 'exit 0' in this job step and all subsequent steps to quickly exit if provided a list of
|
|
|
|
# job names and none of them has been triggered.
|
2020-04-16 15:23:00 -07:00
|
|
|
# - Sets variables to indicate the job names that have been triggered.
|
|
|
|
# Note: Please avoid exporting these variables. Instead, source any callees that need to use them.
|
2020-05-05 10:47:49 -07:00
|
|
|
# This helps reduce implicit coupling of callees to their parents, as they will be unable to run
|
|
|
|
# when not sourced, (especially with set -u).
|
2020-04-16 15:23:00 -07:00
|
|
|
# - Installs dependencies for the current job.
|
|
|
|
# - Exports any environment variables necessary to run the build.
|
|
|
|
# Usage: init [JOB_NAMES]
|
|
|
|
# - JOB_NAMES (optional): Comma-separated list of job names to trigger on.
|
|
|
|
init() {
|
2022-07-18 09:15:49 -07:00
|
|
|
# TODO(jjyao): fix it for windows
|
|
|
|
if [ "${OSTYPE}" != msys ]; then
|
|
|
|
_check_job_triggers "${1-}"
|
|
|
|
fi
|
2020-04-15 08:10:22 -07:00
|
|
|
|
2020-04-29 21:19:02 -07:00
|
|
|
configure_system
|
2020-04-15 08:10:22 -07:00
|
|
|
|
2020-07-21 14:47:09 -07:00
|
|
|
# shellcheck disable=SC2031
|
2022-04-13 18:11:30 +01:00
|
|
|
. "${ROOT_DIR}"/env/install-dependencies.sh # Script is sourced to propagate up environment changes
|
2020-04-15 08:10:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
2020-07-20 12:41:57 -07:00
|
|
|
if [ "${LINT-}" != 1 ]; then
|
|
|
|
_bazel_build_before_install
|
2020-12-22 22:51:45 -08:00
|
|
|
else
|
|
|
|
_bazel_build_protobuf
|
2020-07-20 12:41:57 -07:00
|
|
|
fi
|
2020-07-14 14:51:51 -07:00
|
|
|
|
2020-04-29 21:19:02 -07:00
|
|
|
if ! need_wheels; then
|
|
|
|
install_ray
|
|
|
|
if [ "${LINT-}" = 1 ]; then
|
|
|
|
# Try generating Sphinx documentation. To do this, we need to install Ray first.
|
|
|
|
build_sphinx_docs
|
2020-04-15 08:10:22 -07:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${RAY_CYTHON_EXAMPLES-}" = 1 ]; then
|
2020-04-29 21:19:02 -07:00
|
|
|
install_cython_examples
|
2020-04-15 08:10:22 -07:00
|
|
|
fi
|
|
|
|
|
2021-06-14 11:30:55 -07:00
|
|
|
if [ "${LINT-}" = 1 ]; then
|
2020-04-29 21:19:02 -07:00
|
|
|
install_go
|
2020-04-15 08:10:22 -07:00
|
|
|
fi
|
|
|
|
|
2020-04-29 21:19:02 -07:00
|
|
|
if need_wheels; then
|
|
|
|
build_wheels
|
2020-04-15 08:10:22 -07:00
|
|
|
fi
|
2020-04-29 21:19:02 -07:00
|
|
|
}
|
2020-04-15 08:10:22 -07:00
|
|
|
|
2022-05-19 01:42:26 +09:00
|
|
|
test_minimal() {
|
|
|
|
./ci/env/install-minimal.sh "$1"
|
|
|
|
./ci/env/env_info.sh
|
|
|
|
python ./ci/env/check_minimal_install.py
|
|
|
|
BAZEL_EXPORT_OPTIONS="$(./ci/run/bazel_export_options)"
|
|
|
|
# Ignoring shellcheck is necessary because if ${BAZEL_EXPORT_OPTIONS} is wrapped by the double quotation,
|
|
|
|
# bazel test cannot recognize the option.
|
|
|
|
# shellcheck disable=SC2086
|
|
|
|
bazel test --test_output=streamed --config=ci --test_env=RAY_MINIMAL=1 ${BAZEL_EXPORT_OPTIONS} python/ray/tests/test_basic
|
|
|
|
# shellcheck disable=SC2086
|
2022-07-24 21:11:30 +00:00
|
|
|
bazel test --test_output=streamed --config=ci --test_env=RAY_MINIMAL=1 --test_env=TEST_EXTERNAL_REDIS=1 ${BAZEL_EXPORT_OPTIONS} python/ray/tests/test_basic
|
|
|
|
# shellcheck disable=SC2086
|
2022-05-19 01:42:26 +09:00
|
|
|
bazel test --test_output=streamed --config=ci ${BAZEL_EXPORT_OPTIONS} python/ray/tests/test_basic_2
|
|
|
|
# shellcheck disable=SC2086
|
2022-07-24 21:11:30 +00:00
|
|
|
bazel test --test_output=streamed --config=ci --test_env=RAY_MINIMAL=1 --test_env=TEST_EXTERNAL_REDIS=1 ${BAZEL_EXPORT_OPTIONS} python/ray/tests/test_basic_2
|
|
|
|
# shellcheck disable=SC2086
|
2022-05-19 01:42:26 +09:00
|
|
|
bazel test --test_output=streamed --config=ci ${BAZEL_EXPORT_OPTIONS} python/ray/tests/test_basic_3
|
|
|
|
# shellcheck disable=SC2086
|
2022-07-24 21:11:30 +00:00
|
|
|
bazel test --test_output=streamed --config=ci --test_env=RAY_MINIMAL=1 --test_env=TEST_EXTERNAL_REDIS=1 ${BAZEL_EXPORT_OPTIONS} python/ray/tests/test_basic_3
|
|
|
|
# shellcheck disable=SC2086
|
2022-05-19 01:42:26 +09:00
|
|
|
bazel test --test_output=streamed --config=ci ${BAZEL_EXPORT_OPTIONS} python/ray/tests/test_basic_4
|
|
|
|
# shellcheck disable=SC2086
|
2022-07-24 21:11:30 +00:00
|
|
|
bazel test --test_output=streamed --config=ci --test_env=RAY_MINIMAL=1 --test_env=TEST_EXTERNAL_REDIS=1 ${BAZEL_EXPORT_OPTIONS} python/ray/tests/test_basic_4
|
|
|
|
# shellcheck disable=SC2086
|
2022-05-19 01:42:26 +09:00
|
|
|
bazel test --test_output=streamed --config=ci ${BAZEL_EXPORT_OPTIONS} python/ray/tests/test_basic_5
|
|
|
|
# shellcheck disable=SC2086
|
2022-07-24 21:11:30 +00:00
|
|
|
bazel test --test_output=streamed --config=ci --test_env=RAY_MINIMAL=1 --test_env=TEST_EXTERNAL_REDIS=1 ${BAZEL_EXPORT_OPTIONS} python/ray/tests/test_basic_5
|
|
|
|
# shellcheck disable=SC2086
|
2022-05-19 01:42:26 +09:00
|
|
|
bazel test --test_output=streamed --config=ci --test_env=RAY_MINIMAL=1 ${BAZEL_EXPORT_OPTIONS} python/ray/tests/test_output
|
|
|
|
# shellcheck disable=SC2086
|
|
|
|
bazel test --test_output=streamed --config=ci --test_env=RAY_MINIMAL=1 ${BAZEL_EXPORT_OPTIONS} python/ray/tests/test_runtime_env_ray_minimal
|
|
|
|
# shellcheck disable=SC2086
|
|
|
|
bazel test --test_output=streamed --config=ci ${BAZEL_EXPORT_OPTIONS} python/ray/tests/test_runtime_env
|
|
|
|
# shellcheck disable=SC2086
|
|
|
|
bazel test --test_output=streamed --config=ci ${BAZEL_EXPORT_OPTIONS} python/ray/tests/test_runtime_env_2
|
|
|
|
# shellcheck disable=SC2086
|
|
|
|
bazel test --test_output=streamed --config=ci ${BAZEL_EXPORT_OPTIONS} python/ray/tests/test_runtime_env_complicated
|
|
|
|
# shellcheck disable=SC2086
|
|
|
|
bazel test --test_output=streamed --config=ci ${BAZEL_EXPORT_OPTIONS} python/ray/tests/test_runtime_env_validation
|
|
|
|
# shellcheck disable=SC2086
|
|
|
|
bazel test --test_output=streamed --config=ci --test_env=RAY_MINIMAL=1 ${BAZEL_EXPORT_OPTIONS} python/ray/tests/test_serve_ray_minimal
|
|
|
|
# shellcheck disable=SC2086
|
|
|
|
bazel test --test_output=streamed --config=ci --test_env=RAY_MINIMAL=1 ${BAZEL_EXPORT_OPTIONS} python/ray/dashboard/test_dashboard
|
|
|
|
# shellcheck disable=SC2086
|
|
|
|
bazel test --test_output=streamed --config=ci --test_env=RAY_MINIMAL=1 ${BAZEL_EXPORT_OPTIONS} python/ray/tests/test_usage_stats
|
[core] Add stats for the gcs backend for telemetry. (#27876)
## Why are these changes needed?
To get better understanding of how GCS FT is used, adding this metrics.
Test:
```
cat /tmp/ray/session_latest/usage_stats.json
{"usage_stats": {"ray_version": "3.0.0.dev0", "python_version": "3.9.12", "schema_version": "0.1", "source": "OSS", "session_id": "70d3ecd3-5b16-40c3-9301-fd05404ea92a", "git_commit": "{{RAY_COMMIT_SHA}}", "os": "linux", "collect_timestamp_ms": 1660587366806, "session_start_timestamp_ms": 1660587351586, "cloud_provider": null, "min_workers": null, "max_workers": null, "head_node_instance_type": null, "worker_node_instance_types": null, "total_num_cpus": 16, "total_num_gpus": null, "total_memory_gb": 16.10752945020795, "total_object_store_memory_gb": 8.053764724172652, "library_usages": ["serve"], "total_success": 0, "total_failed": 13, "seq_number": 13, "extra_usage_tags": {"serve_api_version": "v1", "gcs_storage": "redis", "serve_num_deployments": "1"}, "total_num_nodes": 2, "total_num_running_jobs": 2}}
```
2022-08-17 00:02:04 +00:00
|
|
|
# shellcheck disable=SC2086
|
|
|
|
bazel test --test_output=streamed --config=ci --test_env=RAY_MINIMAL=1 --test_env=TEST_EXTERNAL_REDIS=1 ${BAZEL_EXPORT_OPTIONS} python/ray/tests/test_usage_stats
|
2022-05-19 01:42:26 +09:00
|
|
|
}
|
|
|
|
|
2020-04-29 21:19:02 -07:00
|
|
|
_main() {
|
2020-06-15 17:27:17 -07:00
|
|
|
if [ "${GITHUB_ACTIONS-}" = true ]; then
|
2020-05-05 10:47:49 -07:00
|
|
|
exec 2>&1 # Merge stdout and stderr to prevent out-of-order buffering issues
|
2020-04-29 21:19:02 -07:00
|
|
|
reload_env
|
2020-04-15 08:10:22 -07:00
|
|
|
fi
|
2020-04-29 21:19:02 -07:00
|
|
|
"$@"
|
2020-04-15 08:10:22 -07:00
|
|
|
}
|
|
|
|
|
2020-04-29 21:19:02 -07:00
|
|
|
_main "$@"
|
2020-04-15 08:10:22 -07:00
|
|
|
|
2020-05-05 10:47:49 -07:00
|
|
|
# Pop caller's shell options (quietly)
|
|
|
|
{ set -vx; eval "${SHELLOPTS_STACK##*|}"; SHELLOPTS_STACK="${SHELLOPTS_STACK%|*}"; } 2> /dev/null
|