def get_config():
    global __config__

    if __config__ is None:
        __config__ = cfg.load_config(failing_default={})

    return __config__
Ejemplo n.º 2
0
from taskflow.test import dummy_composite
from taskflow.symbolic import hash_str
from taskflow.backend import Session, ForkResource
import taskflow.distributed_io as dio
import taskflow.config as cfg

FORMAT = '%(asctime)s %(levelname)s - %(message)s'
logging.basicConfig(format=FORMAT,
                    datefmt='%m/%d/%Y %I:%M:%S %p')

logger = logging.getLogger("session_remote")

__db__ = None
__client__ = {}

__config__ = cfg.load_config()


def setup_client(url, auth=None):
    global __client__
    if url not in __client__:
        if auth is not None:
            uri = 'mongodb://%s:%s@%s/%s' % (
                quote_plus(auth['username']),
                quote_plus(auth['password']),
                url,
                auth['authSource']
            )
        else:
            uri = 'mongodb://%s/' % url