跳转到主要内容

Invenio的记录到推荐记录。

项目描述

https://travis-ci.org/CERNDocumentServer/record-recommender.svg?branch=master

记录推荐器为Invenio创建推荐。通过读取Elasticsearch的页面浏览量和下载量,计算推荐并将它们存储在Redis中,以便Invenio检索和显示。

用法

生成推荐的流程是

  1. recommender fetch 24 将Elasticsearch的最后24周的页面浏览量和下载量缓存。

  2. recommender profiles 24 从页面浏览量和下载量生成用户配置文件。对于未登录的用户,基于IP地址和用户代理创建配置文件。

  3. 推荐构建50使用50个进程计算推荐并将其存储在指定的Redis服务器中。

另外,可以通过一个命令自动获取推荐、生成配置文件和计算推荐。

recommender update_recommender 24 50用于过去24周,并使用50个进程。

配置

期望配置文件位于/etc/record_recommender.yml,否则可以使用命令行选项--config_path定义配置文件路径。

# Record-Recommender configuration.

elasticsearch:
es_index: ['index-2014', 'index-2015', 'index-2016']
es_user: user
es_password:
es_host: localhost
es_port: 443

recommendation_version: 1

# Sentry connection string
sentry:

redis:
host: localhost
port: 6379
db: 0
prefix: 'Reco_1::'

cache:
base_path: cache/
cache_file_prefix: ''

logging:
version: 1
disable_existing_loggers: False
formatters:
    simple:
    format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
handlers:
    console:
    class: logging.StreamHandler
    level: INFO
    formatter: simple
    stream: ext://sys.stdout
    sentry:
    class: raven.handlers.logging.SentryHandler
    level: WARN
    dsn:
    file:
    class : logging.FileHandler
    formatter: simple
    level: DEBUG
    filename: log_recommender.log
loggers:
    record_recommender:
    level: DEBUG
    handlers: [console, file, sentry]
    propagate: no
    # elasticsearch:
    #   level: WARN
    #   handlers: [console]
    #   propagate: no
root:
    level: ERROR
    handlers: [console, file, sentry]

除了配置文件中的配置选项和环境变量,还可以设置覆盖配置文件中设置的环境变量。

  • RECOMMENDER_ES_PASSWORD用于设置Elasticsearch密码。

  • RECOMMENDER_SENTRY用于设置Sentry连接字符串。

命令行

Usage: recommender [OPTIONS] COMMAND [ARGS]...

Record-Recommender command line version.

Options:
-v, --verbose           Enables verbose mode.
-c, --config_path TEXT  Path to the configuration file.
--help                  Show this message and exit.

Commands:
debug               Debug the application and recommender.
fetch               Fetch newest PageViews and Downloads.
build               Calculate all recommendations.
profiles            Number of weeks to build.
update_recommender  Download and build the recommendations.

调试推荐

首先检查在定义的cache文件夹中创建的用户配置文件。

要探索加载的所有数据的图形,请使用recommender debug命令以获取交互式Python外壳。

项目细节


下载文件

下载适用于您平台文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分发

record-recommender-0.0.2.tar.gz (25.6 kB 查看散列)

上传时间

支持者