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

net.shortest_paths doesn't work with multiprocessing #176

Open
lilianmarey opened this issue Apr 25, 2022 · 0 comments
Open

net.shortest_paths doesn't work with multiprocessing #176

lilianmarey opened this issue Apr 25, 2022 · 0 comments

Comments

@lilianmarey
Copy link

lilianmarey commented Apr 25, 2022

Hi,

I'm having a little of trouble trying to use Pandana with multiprocessing

Description of the bug

When I call net.shortest_paths (with an 's') in a multiprocessing process (I use a multiprocessing.Pool object), it doesn't finish like an infinite loop (no error message).
I tested to do the same with net.shortest_path (without an 's') and it worked! However I have to use shortest_paths because it is faster in my case.
I wanted to know if there is an explanation to this.

Network data (optional)

OpenStreetMap Data

Environment

Mac OS 11.2.1
Python 3.9.7
Pandana 0.6.1

Paste the code that reproduces the issue here:

from multiprocessing import Pool

n_cores = 3

def f(n_repet):
return [net.shortest_paths([node_0_id], [node_1_id]) for i in tqdm(range(n_repet))]

p = Pool(n_cores)
a = p.map(f, [10 for i in range(10)])

Thanks for your help!

@lilianmarey lilianmarey changed the title net.shortest_paths doesn't work in multiprocessing threads net.shortest_paths doesn't work with multiprocessing Apr 27, 2022
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

1 participant