From 36389e7ce03d40fcbb49eb55b6178ed72408aea7 Mon Sep 17 00:00:00 2001 From: kindly Date: Mon, 24 Dec 2012 12:21:21 +0000 Subject: [PATCH] make sure gather phase finishes job if there is a severe error --- ckanext/harvest/queue.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ckanext/harvest/queue.py b/ckanext/harvest/queue.py index 8fd959e..99be672 100644 --- a/ckanext/harvest/queue.py +++ b/ckanext/harvest/queue.py @@ -115,7 +115,13 @@ def gather_callback(channel, method, header, body): harvester_found = True # Get a list of harvest object ids from the plugin job.gather_started = datetime.datetime.now() - harvest_object_ids = harvester.gather_stage(job) + try: + harvest_object_ids = harvester.gather_stage(job) + except: + log.error('Gather stage failed unexpectedly') + job.status = 'Errored' + job.save() + continue job.gather_finished = datetime.datetime.now() job.save() log.debug('Received from plugin''s gather_stage: %r' % harvest_object_ids)