Fix name of the queue logger. Moved imports of ckanext.harvest until after _load_config so that the loggers do not start disabled.
This commit is contained in:
parent
330c9b5391
commit
00e911a70c
|
@ -6,7 +6,6 @@ from ckan import model
|
||||||
from ckan.logic import get_action, ValidationError
|
from ckan.logic import get_action, ValidationError
|
||||||
|
|
||||||
from ckan.lib.cli import CkanCommand
|
from ckan.lib.cli import CkanCommand
|
||||||
from ckanext.harvest.queue import get_gather_consumer, get_fetch_consumer
|
|
||||||
|
|
||||||
class Harvester(CkanCommand):
|
class Harvester(CkanCommand):
|
||||||
'''Harvests remotely mastered metadata
|
'''Harvests remotely mastered metadata
|
||||||
|
@ -91,12 +90,14 @@ class Harvester(CkanCommand):
|
||||||
self.run_harvester()
|
self.run_harvester()
|
||||||
elif cmd == 'gather_consumer':
|
elif cmd == 'gather_consumer':
|
||||||
import logging
|
import logging
|
||||||
|
from ckanext.harvest.queue import get_gather_consumer
|
||||||
logging.getLogger('amqplib').setLevel(logging.INFO)
|
logging.getLogger('amqplib').setLevel(logging.INFO)
|
||||||
consumer = get_gather_consumer()
|
consumer = get_gather_consumer()
|
||||||
consumer.wait()
|
consumer.wait()
|
||||||
elif cmd == 'fetch_consumer':
|
elif cmd == 'fetch_consumer':
|
||||||
import logging
|
import logging
|
||||||
logging.getLogger('amqplib').setLevel(logging.INFO)
|
logging.getLogger('amqplib').setLevel(logging.INFO)
|
||||||
|
from ckanext.harvest.queue import get_fetch_consumer
|
||||||
consumer = get_fetch_consumer()
|
consumer = get_fetch_consumer()
|
||||||
consumer.wait()
|
consumer.wait()
|
||||||
elif cmd == 'initdb':
|
elif cmd == 'initdb':
|
||||||
|
|
|
@ -11,7 +11,7 @@ from ckan.plugins import PluginImplementations
|
||||||
from ckanext.harvest.model import HarvestJob, HarvestObject,HarvestGatherError
|
from ckanext.harvest.model import HarvestJob, HarvestObject,HarvestGatherError
|
||||||
from ckanext.harvest.interfaces import IHarvester
|
from ckanext.harvest.interfaces import IHarvester
|
||||||
|
|
||||||
log = logging.getLogger('ckanext')
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
__all__ = ['get_gather_publisher', 'get_gather_consumer', \
|
__all__ = ['get_gather_publisher', 'get_gather_consumer', \
|
||||||
'get_fetch_publisher', 'get_fetch_consumer']
|
'get_fetch_publisher', 'get_fetch_consumer']
|
||||||
|
@ -145,11 +145,13 @@ def fetch_callback(message_data,message):
|
||||||
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')
|
||||||
consumer.register_callback(gather_callback)
|
consumer.register_callback(gather_callback)
|
||||||
|
log.debug('Gather queue consumer registered')
|
||||||
return consumer
|
return consumer
|
||||||
|
|
||||||
def get_fetch_consumer():
|
def get_fetch_consumer():
|
||||||
consumer = get_consumer('ckan.harvert.fetch','harvest_object_id')
|
consumer = get_consumer('ckan.harvert.fetch','harvest_object_id')
|
||||||
consumer.register_callback(fetch_callback)
|
consumer.register_callback(fetch_callback)
|
||||||
|
log.debug('Fetch queue consumer registered')
|
||||||
return consumer
|
return consumer
|
||||||
|
|
||||||
def get_gather_publisher():
|
def get_gather_publisher():
|
||||||
|
|
Loading…
Reference in New Issue