(known_backends, backend_type)
return _load_backend_decorator
Returns a function that will load a given backend.

    `known_backends` - dict defining all Stolos-supported backends in form:
        {'easy-to-type-backend-name': 'python.path.to.class', ...}
    `backend_type` - either "configuration" or "queue"
Returns a function that will load a given backend.
Returns a function that will load a given backend .
def _load_backend(known_backends, backend_type):
    """
    Returns a function that will load a given backend.

    `known_backends` - dict defining all Stolos-supported backends in form:
        {'easy-to-type-backend-name': 'python.path.to.class', ...}
    `backend_type` - either "configuration" or "queue"
    """
    def _load_backend_decorator(inpt):
        _backend = known_backends.get(inpt, inpt)
        try:
            backend = util.load_obj_from_path(
                _backend,
                {'key': '%s_backend' % backend_type, backend_type: _backend})
        except Exception as err:
            log.error(
                "Could not load %s backend. err: %s" % (backend_type, err),
                extra={'%s_backend' % backend_type: _backend,
                       'err_kls': type(err)})
            raise
        return backend
    return _load_backend_decorator
def _load_backend ( known_backends , backend_type ) : def _load_backend_decorator ( inpt ) : _backend = known_backends . get ( inpt , inpt ) try : backend = util . load_obj_from_path ( _backend , { 'key' : '%s_backend' % backend_type , backend_type : _backend } ) except Exception as err : log . error ( "Could not load %s backend. err: %s" % ( backend_type , err ) , extra = { '%s_backend' % backend_type : _backend , 'err_kls' : type ( err ) } ) raise return backend return _load_backend_decorator