import logging.config
import sys
import yaml


if __name__ == "__main__":

    config_file = sys.argv[1]
    config = yaml.load(file(config_file, "r"))

    # logging
    logging.config.dictConfig(config["logging"])
    logger = logging.getLogger()

    # MongoDB
    mcm = mongo_from_config(config["mongo"])
    database = config["mongo"]["databases"]["processed"]
    resource_collection = mcm.get_collection(database, "resources", Resource)
    story_collection = mcm.get_collection(database, "stories", Story)
    update_collection = mcm.get_collection(database, "updates", StoryUpdate)

    # story updating
    su_client = story_updating_client_from_config(config["story_updating"]["client"])

    # exponential decay
    half_life = config["model_management"]["story_closing"]["resource_half_life"]
    decay_constant = compute_exponential_decay_constant(half_life)

    # story closing settings
    search_timeout = config["model_management"]["story_closing"]["search_timeout"]
    min_closing_score = config["model_management"]["story_closing"]["min_closing_score"]
import logging.config
import sys
import yaml


if __name__ == '__main__':

    config_file = sys.argv[1]
    config = yaml.load(file(config_file, 'r'))

    # logging
    logging.config.dictConfig(config['logging'])
    logger = logging.getLogger()

    # MongoDB
    mcm = mongo_from_config(config['mongo'])
    database = config['mongo']['databases']['processed']
    story_collection = mcm.get_collection(database, 'stories', Story)
    topic_collection = mcm.get_collection(database, 'topics', Topic)
    snapshot_collection = mcm.get_collection(database, 'topic_snapshots', TopicSnapshot)

    # elasticsearch
    es = elasticsearch_from_config(config['elasticsearch'])
    main_index = config['elasticsearch']['indexes']['main']

    # helpers
    index_helper = IndexHelper(es)

    # query builder
    max_clauses = config['model_management']['similarity']['max_clauses']
    max_entity_clauses = config['model_management']['similarity']['max_entity_clauses']
예제 #3
0
from django.conf import settings
from topic_tracking.model import Resource, Story, Topic
from topic_tracking.util.from_config import mongo_from_config


_mcm = mongo_from_config(settings.CONFIG['mongo'])
_db = settings.CONFIG['mongo']['databases']['processed']


def get_connection_manager():
    return _mcm

def get_resource_collection():
    return _mcm.get_collection(_db, 'resources', Resource)

def get_stories_collection():
    return _mcm.get_collection(_db, 'stories', Story)

def get_topics_collection():
    return _mcm.get_collection(_db, 'topics', Topic)