记录以记录对Invenio的建议。
record-recommender的Python项目详细描述
记录推荐程序为invenio创建推荐。 通过从ElasticSearch读取页面视图和下载,计算 建议并将其存储在redis中以供检索和显示 因维尼奥。
用法
生成建议的工作流为:
- recommender fetch 24缓存过去24周的页面浏览量和下载量 来自ElasticSearch。
- recommender profiles 24从页面视图生成用户配置文件 以及下载。对于未登录的用户配置文件,基于 已创建IP地址和用户代理。
- recommender build 50使用50个进程计算建议 并将它们存储在指定的redis服务器中。
另外,建议可以自动获取,配置文件 生成并使用一个命令计算所有这些建议:
最近24周的推荐人更新\推荐人24 50并使用 50道工序。
配置
配置文件应在^{tt4}中$ 否则,可以使用 命令行选项--config_path。
# Record-Recommender configuration.elasticsearch:es_index:['index-2014','index-2015','index-2016']es_user:useres_password:es_host:localhostes_port:443recommendation_version:1# Sentry connection stringsentry:redis:host:localhostport:6379db:0prefix:'Reco_1::'cache:base_path:cache/cache_file_prefix:''logging:version:1disable_existing_loggers:Falseformatters:simple:format:'%(asctime)s-%(name)s-%(levelname)s-%(message)s'handlers:console:class:logging.StreamHandlerlevel:INFOformatter:simplestream:ext://sys.stdoutsentry:class:raven.handlers.logging.SentryHandlerlevel:WARNdsn:file:class :logging.FileHandlerformatter:simplelevel:DEBUGfilename:log_recommender.logloggers:record_recommender:level:DEBUGhandlers:[console,file,sentry]propagate:no# elasticsearch:# level: WARN# handlers: [console]# propagate: noroot:level:ERRORhandlers:[console,file,sentry]
除了配置文件中的配置选项之外 可以设置覆盖配置文件中的环境变量。
- RECOMMENDER_ES_PASSWORD设置ElasticSearch密码。
- RECOMMENDER_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.
调试建议
作为第一步,查看定义的^{tt8}中创建的用户配置文件$ 文件夹。
使用 recommender debug获取交互式python shell的命令。