Skip to content

Commit 8b26f5c

Browse files
[CI] Enable python-no-log-warn precommit rule (ray-project#51099)
`logging.warn` is legacy and deprecated Signed-off-by: Chi-Sheng Liu <[email protected]>
1 parent 9ed6ec6 commit 8b26f5c

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

ci/lint/lint.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pre_commit() {
1616
pip install -c python/requirements_compiled.txt pre-commit clang-format
1717

1818
HOOKS=(
19+
python-no-log-warn
1920
ruff
2021
check-added-large-files
2122
check-ast

python/ray/_private/memory_monitor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def __init__(self, error_threshold=0.95, check_interval=1):
125125
except IOError:
126126
self.cgroup_memory_limit_gb = sys.maxsize / (1024**3)
127127
if not psutil:
128-
logger.warn(
128+
logger.warning(
129129
"WARNING: Not monitoring node memory since `psutil` "
130130
"is not installed. Install this with "
131131
"`pip install psutil` to enable "

python/ray/data/_internal/datasource/image_datasource.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def _estimate_files_encoding_ratio(self) -> float:
115115
)
116116
num_files = len(non_empty_path_and_size)
117117
if num_files == 0:
118-
logger.warn(
118+
logger.warning(
119119
"All input image files are empty. "
120120
"Use on-disk file size to estimate images in-memory size."
121121
)
@@ -133,7 +133,7 @@ def _estimate_files_encoding_ratio(self) -> float:
133133
elif self.mode in ["RGBA", "CMYK", "I", "F"]:
134134
dimension = 4
135135
else:
136-
logger.warn(f"Found unknown image mode: {self.mode}.")
136+
logger.warning(f"Found unknown image mode: {self.mode}.")
137137
return IMAGE_ENCODING_RATIO_ESTIMATE_DEFAULT
138138
height, width = self.size
139139
single_image_size = height * width * dimension
@@ -146,7 +146,7 @@ def _estimate_files_encoding_ratio(self) -> float:
146146

147147
sampling_duration = time.perf_counter() - start_time
148148
if sampling_duration > 5:
149-
logger.warn(
149+
logger.warning(
150150
"Image input size estimation took "
151151
f"{round(sampling_duration, 2)} seconds."
152152
)

0 commit comments

Comments
 (0)