readd code from old branch seperating the fetch and import logic

This commit is contained in:
kindly 2013-03-19 01:16:43 +00:00
parent c2a6bd14eb
commit 3adf38105e
1 changed files with 38 additions and 36 deletions

View File

@ -188,8 +188,12 @@ def fetch_callback(channel, method, header, body):
# matches # matches
for harvester in PluginImplementations(IHarvester): for harvester in PluginImplementations(IHarvester):
if harvester.info()['name'] == obj.source.type: if harvester.info()['name'] == obj.source.type:
fetch_and_import_stages(harvester, obj)
# See if the plugin can fetch the harvest object model.Session.remove()
channel.basic_ack(method.delivery_tag)
def fetch_and_import_stages(harvester, obj):
obj.fetch_started = datetime.datetime.now() obj.fetch_started = datetime.datetime.now()
obj.state = "FETCH" obj.state = "FETCH"
obj.save() obj.save()
@ -225,8 +229,6 @@ def fetch_callback(channel, method, header, body):
else: else:
obj.report_status = 'added' obj.report_status = 'added'
obj.save() obj.save()
model.Session.remove()
channel.basic_ack(method.delivery_tag)
def get_gather_consumer(): def get_gather_consumer():
consumer = get_consumer('ckan.harvest.gather','harvest_job_id') consumer = get_consumer('ckan.harvest.gather','harvest_job_id')