MCPcopy
hub / github.com/ray-project/ray / test_warn_large_udfs

Function test_warn_large_udfs

python/ray/data/tests/test_map.py:948–970  ·  view source on GitHub ↗
(
    ray_start_regular_shared, target_max_block_size_infinite_or_default
)

Source from the content-addressed store, hash-verified

946
947
948def test_warn_large_udfs(
949 ray_start_regular_shared, target_max_block_size_infinite_or_default
950):
951 driver = """
952import ray
953import numpy as np
954from ray.data._internal.execution.operators.map_operator import MapOperator
955
956large_object = np.zeros(MapOperator.MAP_UDF_WARN_SIZE_THRESHOLD + 1, dtype=np.int8)
957
958class LargeUDF:
959 def __init__(self):
960 self.data = large_object
961
962 def __call__(self, batch):
963 return batch
964
965ds = ray.data.range(1)
966ds = ds.map_batches(LargeUDF, concurrency=1)
967assert ds.take_all() == [{"id": 0}]
968 """
969 output = run_string_as_driver(driver)
970 assert "The UDF of operator MapBatches(LargeUDF) is too large" in output
971
972
973# NOTE: All tests above share a Ray cluster, while the tests below do not. These

Callers

nothing calls this directly

Calls 1

run_string_as_driverFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…