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

dask worker: daemonic processes are not allowed to have children #2142

Closed
costrouc opened this issue Jul 26, 2018 · 3 comments
Closed

dask worker: daemonic processes are not allowed to have children #2142

costrouc opened this issue Jul 26, 2018 · 3 comments

Comments

@costrouc
Copy link

costrouc commented Jul 26, 2018

I have a package that I have written that used multiprocessing and some complex communication with multiprocessing.Pipe. I run into an issue when trying to using multiprocessing within dask workers. Is there any workaround that I could do? Is there a way to run a dask worker not as a daemon?

Minimum working example.

dask-scheduler
dask-worker <scheduler-ip:scheduler-port>
def test_process():
    import multiprocessing

    def adder(a, b):
        return a + b

    p = multiprocessing.Process(target=adder, args=(1, 3))
    p.start()
    p.join()

if __name__ == "__main__":
    from dask.distributed import Client
    client = Client('<scheduler-ip:scheduler-port>')

    f = client.submit(test_process)
    f.result()

Error message

distributed.worker - WARNING -  Compute Failed
Function:  test_process
args:      ()
kwargs:    {}
Exception: AssertionError('daemonic processes are not allowed to have children',)

Traceback (most recent call last):
  File "test.py", line 16, in <module>
    f.result()
  File "/home/costrouc/.virtualenvs/dask-6qByegfR/lib/python3.6/site-packages/distributed/client.py", line 192, in result
    six.reraise(*result)
  File "/home/costrouc/.virtualenvs/dask-6qByegfR/lib/python3.6/site-packages/six.py", line 692, in reraise
    raise value.with_traceback(tb)
  File "test.py", line 8, in test_process
    p.start()
  File "/usr/lib/python3.6/multiprocessing/process.py", line 103, in start
    'daemonic processes are not allowed to have children'
AssertionError: daemonic processes are not allowed to have children
@mrocklin
Copy link
Member

Your minimal example is odd. You create a dask-worker and dask-scheduler but you also create a separate local cluster in the Client() call.

However, I suspect that what you're after is the --no-nanny flag to dask-worker or the processes=False keyword to Client, depending on how you actually create your cluster.

@costrouc
Copy link
Author

Thank you for correcting my misunderstanding. I have updated my comment above to show the correct Client('<scheduler-ip:port>') since I was interested in the distributed case.

Yes --no-nanny works for the Distributed cluster and processes=False works for the Local cluster. Issue is resolved.

@zhanghang1989
Copy link

I am new to dask. Is that possible to set --no-nanny when using dask-ssh?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants