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

Function test_generators

python/ray/tests/test_reference_counting_2.py:480–503  ·  view source on GitHub ↗
(one_cpu_100MiB_shared)

Source from the content-addressed store, hash-verified

478
479
480def test_generators(one_cpu_100MiB_shared):
481 @ray.remote(num_returns="dynamic")
482 def remote_generator():
483 for _ in range(3):
484 yield np.zeros(10 * 1024 * 1024, dtype=np.uint8)
485
486 gen = ray.get(remote_generator.remote())
487 refs = list(gen)
488 for r in refs:
489 _fill_object_store_and_get(r)
490
491 # Outer ID out of scope, we should still be able to get the dynamic
492 # objects.
493 del gen
494 for r in refs:
495 _fill_object_store_and_get(r)
496
497 # Inner IDs out of scope.
498 refs_oids = [r.binary() for r in refs]
499 del r
500 del refs
501
502 for r_oid in refs_oids:
503 _fill_object_store_and_get(r_oid, succeed=False)
504
505
506def test_lineage_leak(one_cpu_100MiB_shared):

Callers

nothing calls this directly

Calls 5

listFunction · 0.85
getMethod · 0.65
remoteMethod · 0.45
binaryMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…