Giter Site home page Giter Site logo

Comments (5)

happyxhw avatar happyxhw commented on May 10, 2024

using yield, not return, can not work too !

https://docs.ray.io/en/latest/data/api/doc/ray.data.Dataset.map_batches.html

import numpy as np
import ray


class Embedding(object):
    """
    embedding
    """

    def __call__(self, item):
        """
        ray call
        """
        for i in range(0, 100):
            yield {'vector': np.random.uniform(low=0.5, high=13.3, size=(68000,)).tolist()}


@ray.remote(num_cpus=0)
def debug():
    ds = ray.data.from_items(list(range(0, 200)))
    ds = ds.map_batches(
        Embedding,
        batch_size=10,
        concurrency=(1, 4),
        num_cpus=0,
    )
    for item in ds.iter_batches():
        pass


if __name__ == '__main__':
    future = debug.remote()
    ray.get(future)
    ray.shutdown()

image

from ray.

happyxhw avatar happyxhw commented on May 10, 2024

try to kill by pid can release the memory

import numpy as np
import ray
import ray.runtime_context


class Embedding(object):
    """
    embedding
    """

    def __call__(self, item):
        """
        ray call
        """
        for i in range(0, 100):
            yield {'vector': np.random.uniform(low=0.5, high=13.3, size=(380,)).tolist()}


@ray.remote(num_cpus=0)
def debug():
    ds = ray.data.from_items(list(range(0, 200)))
    ds = ds.map_batches(
        Embedding,
        batch_size=10,
        concurrency=(1, 4),
        num_cpus=0,
    )
    for item in ds.iter_batches():
        pass
    return ray.runtime_context.get_runtime_context().get_worker_id()


if __name__ == '__main__':
    future = debug.remote()
    worker_id = ray.get(future)

    import os
    import signal
    import time

    from ray.experimental.state.api import get_worker

    worker = get_worker(worker_id)
    pid = worker.pid
    ray.shutdown()

    time.sleep(10)
    os.kill(pid, signal.SIGKILL)

from ray.

bveeramani avatar bveeramani commented on May 10, 2024

Hey @happyxhw, looks like this is expected behavior: https://discuss.ray.io/t/why-is-there-a-lot-of-ray-idle-in-my-ray-process/10395

from ray.

happyxhw avatar happyxhw commented on May 10, 2024

Hey @happyxhw, looks like this is expected behavior: https://discuss.ray.io/t/why-is-there-a-lot-of-ray-idle-in-my-ray-process/10395

I have read this discussion. I know "ray::IDLE" is something similar to a progress in a pool. But in this issue the "ray::IDLE" is dead without a "ID". It never goes away while consuming too much memory, and can not be reused forever.

image

from ray.

bveeramani avatar bveeramani commented on May 10, 2024

I ran the reproduction script with Ray 2.9.2, but I wasn't able to reproduce the issue. All of the IDLE processes have a PID.

@rynewang do you have a hunch about what might be going on here?

from ray.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.