omniscale / imposm-parser

Deprecated: Python parser for OpenStreetMap data
http://imposm.org/docs/imposm.parser/latest/
Apache License 2.0
133 stars 57 forks source link

raising exception in callback does not stop processes #15

Open qwiglydee opened 8 years ago

qwiglydee commented 8 years ago
import sys
from imposm.parser import OSMParser

def callback(data):
    raise Exception("I'm broken")

parser = OSMParser(relations_callback=callback, concurrency=1)
try:
    parser.parse_pbf_file("var/RU.osm.pbf")
except Exception as e:
    print(e)
    print("now you have to press ctrl-c")
    print("or kill all three processes with signal")

sys.exit(100500) # does not help
Traceback (most recent call last):
  File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "/home/qmax/Work/regions/.env/local/lib/python2.7/site-packages/imposm/parser/simple.py", line 113, in parse_it
    parser.parse(input)
  File "/home/qmax/Work/regions/.env/local/lib/python2.7/site-packages/imposm/parser/pbf/multiproc.py", line 70, in parse
    pos_queue.put(pos)
  File "/usr/lib/python2.7/multiprocessing/queues.py", line 311, in put
    if not self._sem.acquire(block, timeout):
KeyboardInterrupt