make gather phase as finished if there is an error

This commit is contained in:
kindly 2013-04-12 10:35:08 +01:00
parent bd761498f0
commit 7d7657f94a
1 changed files with 7 additions and 4 deletions

View File

@ -124,10 +124,13 @@ def gather_callback(channel, method, header, body):
try:
harvest_object_ids = harvester.gather_stage(job)
except Exception, e:
except (Exception, KeyboardInterrupt):
channel.basic_ack(method.delivery_tag)
model.Session.query(HarvestObject).filter_by(
harvest_job_id=job.id
).update(dict(state='ERROR', current=False))
raise
finally:
job.gather_finished = datetime.datetime.now()
job.save()