mastbaum/dirt — Issue #19: KeyError on exit
Author: mastbaum
Created: 2012-02-07 16:53:35+00:00
State: open

sometimes there is a KeyError on exit, when trying to de-allocate:

```
Feb 06 17:54:29 ratbuild pytunia : Caught SIGINT (Ctrl-C), Exiting.
Feb 06 17:54:29 ratbuild pytunia : Clearing running tasks from database
Traceback (most recent call last):
File "/home/rat/pytunia-env/bin/dirt", line 5, in
pkg_resources.run_script('dirt==0.5', 'dirt')
File "/home/rat/pytunia-env/lib/python2.6/site-packages/distribute-0.6.10-py2.6.egg/pkg_resources.py", line 461, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/home/rat/pytunia-env/lib/python2.6/site-packages/distribute-0.6.10-py2.6.egg/pkg_resources.py", line 1194, in run_script
execfile(script_filename, namespace, namespace)
File "/home/rat/pytunia-env/lib/python2.6/site-packages/dirt-0.5-py2.6.egg/EGG-INFO/scripts/dirt", line 107, in
serve_forever()
File "/home/rat/pytunia-env/lib/python2.6/site-packages/dirt-0.5-py2.6.egg/EGG-INFO/scripts/dirt", line 70, in serve_forever
for id in tasks:
File "/home/rat/pytunia-env/lib/python2.6/site-packages/dirt-0.5-py2.6.egg/dirt/core/dbi.py", line 46, in get_tasks
for change in changes:
File "/home/rat/pytunia-env/lib/python2.6/site-packages/CouchDB-0.8-py2.6.egg/couchdb/client.py", line 785, in _changes
for ln in lines:
File "/home/rat/pytunia-env/lib/python2.6/site-packages/CouchDB-0.8-py2.6.egg/couchdb/http.py", line 107, in __iter__
chunksz = int(self.resp.fp.readline().strip(), 16)
File "/usr/lib/python2.6/socket.py", line 397, in readline
data = recv(1)
File "/home/rat/pytunia-env/lib/python2.6/site-packages/dirt-0.5-py2.6.egg/EGG-INFO/scripts/dirt", line 41, in signal_handler
for alloc in nodes[node]['alloc']:
KeyError: 'alloc'
```