dask / dask/distributed

Identify and warn about starting processes in module

Open
#2,708 6 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
1.7k
Forks
778
Avg merge
2h 50m
Merged PRs (30d)
3

Description

Users who are new to Dask and possibly new to Python often run into this error message

```
distributed.utils - ERROR -
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.

This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:

if __name__ == '__main__':
freeze_support()
...

The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
```

This comes from starting a new process in module code not protected by `if __name__ == '__main__':`

This error message is not informative, and seems to stop more than a few users. We probably can't affect this error message itself, nor the behavior (both are pretty deep in Python I suspect) but perhaps we can detect the situation before we trigger the error and raise a nicer error message?

How do we identify that we're starting a process in module code?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.