Ejemplo n.º 1
0
 def setUp(self):
     unittest.TestCase.setUp(self)
     self.app = app.ADSOrcidCelery('test', local_config=\
         {
         'SQLALCHEMY_URL': 'sqlite:///',
         'SQLALCHEMY_ECHO': False
         })
     Base.metadata.bind = self.app._session.get_bind()
     Base.metadata.create_all()
Ejemplo n.º 2
0
 def setUp(self):
     unittest.TestCase.setUp(self)
     self.proj_home = os.path.join(os.path.dirname(__file__), '../..')
     self._app = tasks.app
     self.app = app.ADSOrcidCelery('test', local_config=\
         {
         'SQLALCHEMY_URL': 'sqlite:///',
         'SQLALCHEMY_ECHO': False
         })
     tasks.app = self.app  # monkey-path the app object
     Base.metadata.bind = self.app._session.get_bind()
     Base.metadata.create_all()
Ejemplo n.º 3
0
 def setUp(self):
     unittest.TestCase.setUp(self)
     proj_home = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))
     self.app = app.ADSOrcidCelery('test', local_config=\
         {
         'SQLALCHEMY_URL': 'sqlite:///',
         'SQLALCHEMY_ECHO': False,
         'PROJ_HOME' : proj_home,
         'TEST_DIR' : os.path.join(proj_home, 'ADSOrcid/tests'),
         })
     Base.metadata.bind = self.app._session.get_bind()
     Base.metadata.create_all()
Ejemplo n.º 4
0
from __future__ import absolute_import, unicode_literals
import adsputils
from adsmsg import OrcidClaims
from ADSOrcid import app as app_module
from ADSOrcid import updater
from ADSOrcid.exceptions import ProcessingException, IgnorableException
from ADSOrcid.models import KeyValue
from kombu import Queue
import datetime
import os

# ============================= INITIALIZATION ==================================== #

proj_home = os.path.realpath(os.path.join(os.path.dirname(__file__), '../'))
app = app_module.ADSOrcidCelery('orcid-pipeline',
                                proj_home=proj_home,
                                local_config=globals().get('local_config', {}))
app.conf.CELERY_QUEUES = (
    Queue('check-orcidid', app.exchange, routing_key='check-orcidid'),
    Queue('match-claim', app.exchange, routing_key='match-claim'),
    Queue('check-updates', app.exchange, routing_key='check-updates'),
    Queue('output-results', app.exchange, routing_key='output-results'),
)
logger = app.logger

# ============================= TASKS ============================================= #


@app.task(queue='check-orcidid')
def task_index_orcid_profile(message):
    """
Ejemplo n.º 5
0
from __future__ import absolute_import, unicode_literals
import adsputils
from adsmsg import OrcidClaims
from ADSOrcid import app as app_module
from ADSOrcid import updater
from ADSOrcid.exceptions import ProcessingException, IgnorableException
from ADSOrcid.models import KeyValue
from kombu import Queue
import datetime
import requests
import os

app = app_module.ADSOrcidCelery('orcid-pipeline',
                                proj_home=os.path.realpath(
                                    os.path.join(os.path.dirname(__file__),
                                                 '../')))
app.conf.CELERY_QUEUES = (
    Queue('check-orcidid', app.exchange, routing_key='check-orcidid'),
    Queue('match-claim', app.exchange, routing_key='match-claim'),
    Queue('check-updates', app.exchange, routing_key='check-updates'),
    Queue('output-results', app.exchange, routing_key='output-results'),
)
logger = app.logger


@app.task(queue='check-orcidid')
def task_index_orcid_profile(message):
    """
    Fetch a fresh profile from the orcid-service and compare
    it against the state of the storage (diff). And re-index/update
    them.