Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[util.multiprocessing] Unable to pass Queue to pool.apply_async #7561

Open
zewenli98 opened this issue Mar 11, 2020 · 0 comments
Open

[util.multiprocessing] Unable to pass Queue to pool.apply_async #7561

zewenli98 opened this issue Mar 11, 2020 · 0 comments
Labels
bug Something that is supposed to be working; but isn't P3 Issue moderate in impact or severity

Comments

@zewenli98
Copy link
Contributor

When using from ray.util.multiprocessing import Pool, I cannot pass a Queue to pool.apply_async. However, if from multiprocessing import Pool is used, there's no problem.

from multiprocessing import Process, Manager
from ray.util.multiprocessing import Pool

def async_evaluate(number, unevaluated_queue, evaluated_queue):
    print("entered async_evaluate")
    while True:
        sol = unevaluated_queue.get(block=True, timeout=None)
        # objective1.eval(sol)
        evaluated_queue.put(sol, block=True, timeout=None)

unevaluated_queue = Manager().Queue()
evaluated_queue = Manager().Queue()

pool = Pool()
pool.apply_async(func=async_evaluate, args=(666, unevaluated_queue, evaluated_queue,))

As above, I'm sure that some processes are started, but print("entered async_evaluate") is not executed. The problem is that these codes can be run correctly in Pool class of multiprocessing. Is there anything wrong(BUG) with Pool class in Ray?

@zewenli98 zewenli98 added the bug Something that is supposed to be working; but isn't label Mar 11, 2020
@ericl ericl added the P3 Issue moderate in impact or severity label Mar 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is supposed to be working; but isn't P3 Issue moderate in impact or severity
Projects
None yet
Development

No branches or pull requests

2 participants