コード例 #1
0
ファイル: run_task.py プロジェクト: acrispin/app_celery
from src.log import setup_custom_logger
from src.tasks import longtime_add

logger = setup_custom_logger(__name__)

if __name__ == '__main__':
    logger.info('Inicio de ejecucion de test')
    result = longtime_add.delay(4, 4)
    logger.info('Task result: ' + result.get(timeout=6))
コード例 #2
0
 def __init__(self):
     super().__init__()
     self.gmaps = googlemaps.Client(key=self.config.gmaps_key)
     self.logger = log.setup_custom_logger('GOOGLE_API_CONTROLLER')
コード例 #3
0
 def __init__(self):
     super().__init__()
     self.conn = http.client.HTTPConnection('api.positionstack.com')
     self.logger = log.setup_custom_logger('PSTACK_API_CONTROLLER')
     self.params = None
コード例 #4
0
 def __init__(self):
     super().__init__()
     self.opcoder = OpenCageGeocode(self.config.opencage_key)
     self.logger = log.setup_custom_logger('OPCAGE_API_CONTROLLER')
コード例 #5
0
import json
from src import log

logger = log.setup_custom_logger('ES_GEO_CONTROLLER')


def search_by_index_and_id(es, _index, _id):
    logger.info(f'Searching cache for address id <{_id}>')
    res = es.get(index=_index, id=_id)

    return res


def add_to_index(es, _index, _id, body):
    logger.info(f'Adding address with <{_id}> to index')

    res = es.index(index=_index, id=_id, body=json.dumps(body))
    return res