daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest Nov 21st, 2017 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import overpy
  2. api = overpy.Overpass()
  3. result = api.query("""area[name="Aachen"]->.a;(rel(area.a)["building"];way(area.a)["building"];);(._;>;);out;""")
  4.  
  5. import multiprocessing as mp
  6.  
  7. def transfer(i,send_end):
  8.     way = result.ways[i]
  9.  
  10.     bldg =  {'id':way.id,
  11.              'nodeid':[way.nodes[h].id for h in range(len(way.nodes))],
  12.              'coords':[(way.nodes[j].lat, way.nodes[j].lon) for j in range(len(way.nodes))],
  13.             'tags':way.tags}
  14.     send_end.send(bldg)
  15.  
  16.  
  17. if __name__=='__main__':
  18.     jobs = []
  19.     pipe_list = []
  20.     for i in range(10000):
  21.         recv_end, send_end = mp.Pipe(False)
  22.         p = mp.Process(target=transfer,args=(i,send_end))
  23.         jobs.append(p)
  24.         pipe_list.append(recv_end)
  25.         p.start()
  26.    for proc in jobs:
  27.        proc.join()
  28.  
  29.    result_list = [x.recv() for x in pipe_list]
  30.    
  31. OSError: [Errno 24] Too many open files
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top