-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[Core] Upgrade grpc from 1.46.6 to 1.57.0 #39210
Changes from all commits
ea63987
819796f
ce52a84
2ed0ebd
d07b6cf
476db83
ea88c87
2c03909
df2a2e8
f861519
c1a082b
65a0609
d982f44
c011461
c0c32b1
7460b58
ad13d56
10b3083
abc27d9
080be9f
df87b47
177ec79
eb3dbb0
f3efdb6
c8f87c7
a338446
d84d0fa
ea3f420
aec12f3
b6e14b5
a574c52
42c7b80
88f66e7
4aad5cf
447fb55
6f762d2
9783065
1fb6d80
b291345
a351711
3e3f3c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/python/ray/core/generated/**/* linguist-generated=true | ||
/python/ray/serve/generated/**/* linguist-generated=true | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,11 +86,19 @@ def auto_http_archive( | |
def ray_deps_setup(): | ||
# Explicitly bring in protobuf dependency to work around | ||
# https://github.com/ray-project/ray/issues/14117 | ||
# This is copied from grpc's bazel/grpc_deps.bzl | ||
http_archive( | ||
name = "com_google_protobuf", | ||
strip_prefix = "protobuf-3.19.4", | ||
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.19.4.tar.gz"], | ||
sha256 = "3bd7828aa5af4b13b99c191e8b1e884ebfa9ad371b0ce264605d347f135d2568", | ||
sha256 = "76a33e2136f23971ce46c72fd697cd94dc9f73d56ab23b753c3e16854c90ddfd", | ||
strip_prefix = "protobuf-2c5fa078d8e86e5f4bd34e6f4c9ea9e8d7d4d44a", | ||
urls = [ | ||
# https://github.com/protocolbuffers/protobuf/commits/v23.4 | ||
"https://github.com/protocolbuffers/protobuf/archive/2c5fa078d8e86e5f4bd34e6f4c9ea9e8d7d4d44a.tar.gz", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it mean we will use the lower version? (3.19 -> 2.3?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not 2.3 but 23 so 19 -> 23 |
||
], | ||
patches = [ | ||
"@com_github_grpc_grpc//third_party:protobuf.patch", | ||
], | ||
patch_args = ["-p1"], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you comment why this patch is needed from code? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
) | ||
|
||
# NOTE(lingxuan.zlx): 3rd party dependencies could be accessed, so it suggests | ||
|
@@ -205,15 +213,18 @@ def ray_deps_setup(): | |
"@com_github_ray_project_ray//thirdparty/patches:opencensus-cpp-harvest-interval.patch", | ||
"@com_github_ray_project_ray//thirdparty/patches:opencensus-cpp-shutdown-api.patch", | ||
], | ||
patch_args = ["-p1"], | ||
patch_args = ["-p1"], | ||
) | ||
|
||
# OpenCensus depends on Abseil so we have to explicitly pull it in. | ||
# This is how diamond dependencies are prevented. | ||
auto_http_archive( | ||
name = "com_google_absl", | ||
url = "https://github.com/abseil/abseil-cpp/archive/refs/tags/20220623.1.tar.gz", | ||
sha256 = "91ac87d30cc6d79f9ab974c51874a704de9c2647c40f6932597329a282217ba8", | ||
sha256 = "5366d7e7fa7ba0d915014d387b66d0d002c03236448e1ba9ef98122c13b35c36", | ||
strip_prefix = "abseil-cpp-20230125.3", | ||
urls = [ | ||
"https://github.com/abseil/abseil-cpp/archive/20230125.3.tar.gz", | ||
], | ||
) | ||
|
||
# OpenCensus depends on jupp0r/prometheus-cpp | ||
|
@@ -232,14 +243,13 @@ def ray_deps_setup(): | |
auto_http_archive( | ||
name = "com_github_grpc_grpc", | ||
# NOTE: If you update this, also update @boringssl's hash. | ||
url = "https://github.com/grpc/grpc/archive/refs/tags/v1.46.6.tar.gz", | ||
sha256 = "6514b3e6eab9e9c7017304512d4420387a47b1a9c5caa986643692977ed44e8a", | ||
url = "https://github.com/grpc/grpc/archive/refs/tags/v1.57.0.tar.gz", | ||
sha256 = "8393767af531b2d0549a4c26cf8ba1f665b16c16fb6c9238a7755e45444881dd", | ||
patches = [ | ||
"@com_github_ray_project_ray//thirdparty/patches:grpc-cython-copts.patch", | ||
"@com_github_ray_project_ray//thirdparty/patches:grpc-python.patch", | ||
], | ||
) | ||
|
||
http_archive( | ||
name = "openssl", | ||
strip_prefix = "openssl-1.1.1f", | ||
|
@@ -249,7 +259,7 @@ def ray_deps_setup(): | |
], | ||
build_file = "@rules_foreign_cc_thirdparty//openssl:BUILD.openssl.bazel", | ||
) | ||
|
||
http_archive( | ||
name = "rules_foreign_cc", | ||
sha256 = "2a4d07cd64b0719b39a7c12218a3e507672b82a97b98c6a89d38565894cf7c51", | ||
|
@@ -279,11 +289,11 @@ def ray_deps_setup(): | |
# https://github.com/grpc/grpc/blob/1ff1feaa83e071d87c07827b0a317ffac673794f/bazel/grpc_deps.bzl#L189 | ||
# Ensure this rule matches the rule used by grpc's bazel/grpc_deps.bzl | ||
name = "boringssl", | ||
sha256 = "534fa658bd845fd974b50b10f444d392dfd0d93768c4a51b61263fd37d851c40", | ||
strip_prefix = "boringssl-b9232f9e27e5668bc0414879dcdedb2a59ea75f2", | ||
sha256 = "0675a4f86ce5e959703425d6f9063eaadf6b61b7f3399e77a154c0e85bad46b1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how did we choose this? is it for a specific version (add a comment for the version?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
strip_prefix = "boringssl-342e805bc1f5dfdd650e3f031686d6c939b095d9", | ||
urls = [ | ||
"https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/boringssl/archive/b9232f9e27e5668bc0414879dcdedb2a59ea75f2.tar.gz", | ||
"https://github.com/google/boringssl/archive/b9232f9e27e5668bc0414879dcdedb2a59ea75f2.tar.gz", | ||
"https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/boringssl/archive/342e805bc1f5dfdd650e3f031686d6c939b095d9.tar.gz", | ||
"https://github.com/google/boringssl/archive/342e805bc1f5dfdd650e3f031686d6c939b095d9.tar.gz", | ||
], | ||
) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
load("@rules_python//python:pip.bzl", "compile_pip_requirements") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe consider splitting this into 2 prs:
this PR feels a bit too big right now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll just keep one PR for now given the time limit also it's easier to make sure everything works together. |
||
load("@rules_python//python:defs.bzl", "py_binary") | ||
load("@py_deps_compile_py_proto//:requirements.bzl", "requirement") | ||
|
||
compile_pip_requirements( | ||
name = "requirements_compile_py_proto", | ||
requirements_in = "requirements_compile_py_proto.in", | ||
requirements_txt = "requirements_compile_py_proto.txt", | ||
extra_args = ["--allow-unsafe"], | ||
tags = ["team:ci"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
py_binary( | ||
name = "grpc_tools_protoc", | ||
srcs = ["grpc_tools_protoc.py"], | ||
deps = [ | ||
requirement("grpcio-tools"), | ||
], | ||
exec_compatible_with = ["//:hermetic_python"], | ||
tags = ["team:ci"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
genrule( | ||
name = "compile_py_proto", | ||
srcs = [ | ||
"@io_opencensus_proto//opencensus/proto/metrics/v1:metrics.proto", | ||
"@io_opencensus_proto//opencensus/proto/resource/v1:resource.proto", | ||
"//src/ray/protobuf:core_protos", | ||
"//src/ray/protobuf:serve_protos", | ||
], | ||
cmd = """ | ||
TMP=$$(mktemp -d) | ||
|
||
mkdir -p $${TMP}/core | ||
$(location :grpc_tools_protoc) --python_out=$${TMP}/core --grpc_python_out=$${TMP}/core $(locations //src/ray/protobuf:core_protos) --proto_path=. --proto_path=$$(dirname $(locations @io_opencensus_proto//opencensus/proto/metrics/v1:metrics.proto))/../../../.. | ||
mkdir -p opencensus/proto/metrics/v1 | ||
mkdir -p opencensus/proto/resource/v1 | ||
cp $(locations @io_opencensus_proto//opencensus/proto/metrics/v1:metrics.proto) opencensus/proto/metrics/v1/metrics.proto | ||
cp $(locations @io_opencensus_proto//opencensus/proto/resource/v1:resource.proto) opencensus/proto/resource/v1/resource.proto | ||
$(location :grpc_tools_protoc) --python_out=$${TMP}/core --grpc_python_out=$${TMP}/core opencensus/proto/metrics/v1/metrics.proto opencensus/proto/resource/v1/resource.proto --proto_path=. | ||
mv $${TMP}/core/src/ray/protobuf/*.py $${TMP}/core/ | ||
mv $${TMP}/core/src/ray/protobuf/**/*.py $${TMP}/core/ | ||
mv $${TMP}/core/opencensus/proto/**/v1/*.py $${TMP}/core/ | ||
|
||
mkdir -p $${TMP}/serve | ||
$(location :grpc_tools_protoc) --python_out=$${TMP}/serve --grpc_python_out=$${TMP}/serve $(locations //src/ray/protobuf:serve_protos) --proto_path=. | ||
mv $${TMP}/serve/src/ray/protobuf/*.py $${TMP}/serve/ | ||
|
||
# NOTE(hchen): Protobuf doesn't allow specifying Python package name. So we use this `sed` | ||
# command to change the import path in the generated file. | ||
# shellcheck disable=SC2006 | ||
files=( | ||
`ls $${TMP}/*/*_pb2*.py` | ||
) | ||
sed -i -E 's/from src.ray.protobuf/from ./' "$${files[@]}" | ||
# TODO(sang): Build our own proto instead of creating a new proto for opencensus separately. | ||
# https://github.com/ray-project/ray/issues/31358 | ||
sed -i -E 's/from opencensus.proto.metrics.v1 import/from . import/' "$${files[@]}" | ||
sed -i -E 's/from opencensus.proto.resource.v1 import/from . import/' "$${files[@]}" | ||
# TODO(rickyx): Remove this experimental path rewrite once we move instance manager proto out | ||
# of experimental. | ||
autoscale_files=(`ls $${TMP}/core/instance_manager_pb2*.py`) | ||
sed -i -E 's/from ..experimental/from ./' "$${autoscale_files[@]}" | ||
|
||
# Help the generated serve files to have the correct module | ||
serve_files=(`ls $${TMP}/serve/*_pb2*.py`) | ||
sed -i -E 's/'"'"'src.ray.protobuf./'"'"'ray.serve.generated./' "$${serve_files[@]}" | ||
|
||
pushd $${TMP}/core | ||
tar -cvf compile_py_proto_core.tar *.py | ||
popd | ||
|
||
pushd $${TMP}/serve | ||
tar -cvf compile_py_proto_serve.tar *.py | ||
popd | ||
|
||
mv $${TMP}/core/compile_py_proto_core.tar $(location :compile_py_proto_core.tar) | ||
mv $${TMP}/serve/compile_py_proto_serve.tar $(location :compile_py_proto_serve.tar) | ||
rm -r $${TMP} | ||
""", | ||
tools = [ | ||
":grpc_tools_protoc", | ||
], | ||
outs = [ | ||
"compile_py_proto_core.tar", | ||
"compile_py_proto_serve.tar" | ||
], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
sh_binary( | ||
name = "install_py_proto", | ||
srcs = [ | ||
":install_py_proto.sh", | ||
], | ||
data = [ | ||
":compile_py_proto_core.tar", | ||
":compile_py_proto_serve.tar", | ||
], | ||
args = [ | ||
"$(location :compile_py_proto_core.tar)", | ||
"$(location :compile_py_proto_serve.tar)", | ||
], | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import subprocess | ||
import sys | ||
|
||
if __name__ == "__main__": | ||
args = [sys.executable, "-m", "grpc_tools.protoc"] | ||
args.extend(sys.argv[1:]) | ||
subprocess.check_call(args, stdout=sys.stdout, stderr=sys.stderr) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
mkdir -p "${BUILD_WORKSPACE_DIRECTORY}"/python/ray/core/generated | ||
tar -xvf "$1" -C "${BUILD_WORKSPACE_DIRECTORY}"/python/ray/core/generated | ||
|
||
mkdir -p "${BUILD_WORKSPACE_DIRECTORY}"/python/ray/serve/generated | ||
tar -xvf "$2" -C "${BUILD_WORKSPACE_DIRECTORY}"/python/ray/serve/generated |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This uses protoc v19 and | ||
# is compatible with python protobuf 3.19 | ||
grpcio-tools==1.46.5 | ||
setuptools |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed to compile upgraded absil.