Skip to content

Commit 984c3da

Browse files
fix: set GRPC_VERBOSITY and remove grpcio upper bound (#3213)
* deps(pyproject): remove version pins on grpcio Signed-off-by: Cameron Smith <[email protected]> * fix(clis): set GRPC_VERBOSITY on clis using grpc Signed-off-by: Cameron Smith <[email protected]> * test(cli): verify GRPC_VERBOSITY=NONE by default but not overwritten Signed-off-by: Cameron Smith <[email protected]> --------- Signed-off-by: Cameron Smith <[email protected]>
1 parent e7c8bb5 commit 984c3da

File tree

3 files changed

+57
-4
lines changed

3 files changed

+57
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import os
2+
3+
# Set GRPC_VERBOSITY to NONE if not already set to silence unwanted output
4+
# This addresses the issue with grpcio >=1.68.0 causing unwanted output
5+
# https://github.com/flyteorg/flyte/issues/6082
6+
if "GRPC_VERBOSITY" not in os.environ:
7+
os.environ["GRPC_VERBOSITY"] = "NONE"

pyproject.toml

+2-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ dependencies = [
2424
"fsspec>=2023.3.0",
2525
"gcsfs>=2023.3.0",
2626
"googleapis-common-protos>=1.57",
27-
# Skipping those versions to account for the unwanted output coming from grpcio and grpcio-status.
28-
# Issue being tracked in https://github.com/flyteorg/flyte/issues/6082.
29-
"grpcio<=1.68.0",
30-
"grpcio-status<=1.68.0",
27+
"grpcio",
28+
"grpcio-status",
3129
"importlib-metadata",
3230
"joblib",
3331
"jsonlines",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import os
2+
3+
4+
def test_grpc_verbosity_set_on_import():
5+
"""
6+
Test that GRPC_VERBOSITY is set to NONE if not already present in the environment
7+
when the SDK container module is imported.
8+
"""
9+
original_value = os.environ.get("GRPC_VERBOSITY", None)
10+
11+
try:
12+
if "GRPC_VERBOSITY" in os.environ:
13+
del os.environ["GRPC_VERBOSITY"]
14+
15+
import importlib
16+
import flytekit.clis.sdk_in_container
17+
importlib.reload(flytekit.clis.sdk_in_container)
18+
19+
assert "GRPC_VERBOSITY" in os.environ
20+
assert os.environ["GRPC_VERBOSITY"] == "NONE"
21+
22+
finally:
23+
if original_value is not None:
24+
os.environ["GRPC_VERBOSITY"] = original_value
25+
elif "GRPC_VERBOSITY" in os.environ:
26+
del os.environ["GRPC_VERBOSITY"]
27+
28+
29+
def test_grpc_verbosity_not_overridden():
30+
"""
31+
Test that GRPC_VERBOSITY is not overridden if already set in the environment.
32+
"""
33+
original_value = os.environ.get("GRPC_VERBOSITY", None)
34+
35+
try:
36+
os.environ["GRPC_VERBOSITY"] = "INFO"
37+
38+
import importlib
39+
import flytekit.clis.sdk_in_container
40+
importlib.reload(flytekit.clis.sdk_in_container)
41+
42+
assert os.environ["GRPC_VERBOSITY"] == "INFO"
43+
44+
finally:
45+
if original_value is not None:
46+
os.environ["GRPC_VERBOSITY"] = original_value
47+
elif "GRPC_VERBOSITY" in os.environ:
48+
del os.environ["GRPC_VERBOSITY"]

0 commit comments

Comments
 (0)