将记帐记录上载到eudat记帐服务器
eudat.accounting.client的Python项目详细描述
将会计记录上载到EUDAT会计服务器
通过eudat公共数据提供的(存储)资源的管理员 基础设施可以使用此工具方便地报告当前资源 每个注册资源的消耗量。会计记录按照 由其(p)id标识的单个资源,该id在 该资源已在eudat的数据项目管理工具(DPMT)中注册。
默认设置是这样的:只有资源id和消耗的值 需要提供。默认单位是byte,默认资源是 类型设置为storage。 支持的选项的完整文档将在下一节中介绍。
如果这里提供的工具不能解决您的用例,您可以 对tracker的功能请求或使用更低级的方法 在server documentation中概述。
完整的文档和API
安装
安装该工具的最简单方法是通过pip或easy_install。 通常最好在virtualenv:
$ pip install eudat.accounting.client
命令行界面
因此,现在有两个控制台脚本 addRecord和iRODScollector。 使用-h调用它以查看其使用模式和选项。
添加记录
$ bin/addRecord -h usage: addRecord [-h] [--version] [-b BASE_URL] [-u USER] [-p PASSWORD] [-d DOMAIN] [-s SERVICE] [-n NUMBER] [-o OBJECT_TYPE] [-k KEY] [-T TYPE] [-m MEASURE_TIME] [-C COMMENT] [-t] [-v] account value [unit] positional arguments: account account to be used. Typically the (P)ID of the resource to be accounted value The value to be recorded unit The unit of measurement for the value provided. Default: "byte" optional arguments: -h, --help show this help message and exit --version show program's version number and exit -b BASE_URL, --base_url BASE_URL base URL of the accounting server to use. Default: https://accounting.eudat.eu -u USER, --user USER user id used for logging into the server. If not provided it is looked up in the environment variable "ACCOUNTING_USER". Default: "" - aka not set -p PASSWORD, --password PASSWORD password used for logging into the server. If not provided it is looked up in the environment variable "ACCOUNTING_PW". Default: "" - aka not set -d DOMAIN, --domain DOMAIN name of the domain holding the account. Default: eudat -s SERVICE, --service SERVICE UID (or PID) of the registered service component reporting the record. Default: "" - not set -n NUMBER, --number NUMBER number of objects associated with this accounting record. This is EUDAT specific. Default: "" - not set -o OBJECT_TYPE, --object_type OBJECT_TYPE object type for the number of objects specified with "-n". This is EUDAT specific. Default: "registered objects" -k KEY, --key KEY key used to refer to the record. If not set the accounting server will create the key. Specifying an existing key will overwrite the existing record. Default: "" - not set -T TYPE, --type TYPE type of the resource accounted. Default: storage -m MEASURE_TIME, --measure_time MEASURE_TIME measurement time of the accounting record if different from the current time. Default: "" - not set -C COMMENT, --comment COMMENT arbitrary comment (goes into the meta dictionary). Default: "" - not set -t, --test Dry run. Don't push data to server - run only locally Default: off -v, --verbose return the key of the accounting record created. Default: off
红外接收器
$ bin/iRODScollector -h usage: iRODScollector [-h] [--version] [-c CONFIGPATH] [-k KEY] [-T TYPE] [-m MEASURE_TIME] [-C COMMENT] [-t] [-v] optional arguments: -h, --help show this help message and exit --version show program's version number and exit -c CONFIGPATH, --configpath CONFIGPATH path to configuration file. Default: "./irodscollector.cfg" (in the current working directory) -k KEY, --key KEY key used to refer to the record. If not set the accounting server will create the key. Specifying an existing key will overwrite the existing record. Default: "" - not set -T TYPE, --type TYPE type of the resource accounted. Default: storage -m MEASURE_TIME, --measure_time MEASURE_TIME measurement time of the accounting record if different from the current time. Default: "" - not set -C COMMENT, --comment COMMENT arbitrary comment (goes into the meta dictionary). Default: "" - not set -t, --test Dry run. Don't push data to server - run only locally Default: off -v, --verbose return the key of the accounting record created. Default: off
分发版中包含模板配置文件,并且 看起来像这样:
$ cat irodscollector.ini ## template of a configuration file for EUDAT's irodscollector ## section containing the logging options [Logging] log_file=eudatacct.log # section containing the properties to access the accounting server # to get statistical data and report them [Report] # base URL of the accounting server to be used base_url=https://accounting.eudat.eu # domain: either eudat or test or demo domain=eudat # uid of the corresponding registered storage resource on DPMT #(same as storage_space_uuid on RCT)account=<insert uid here> # username of the provider on the accouniting server # owning the account specified above # contact dp-admin@mpcdf.mpg.de if you need one user=<username of provider> #if you have an access token from RCT already reuse that here password=<password or access token> service_uuid=<unsuported at the moment> # section contains the list of collections to be accounted together, replace # the examples with your collections, the script sums the values of all # collections and sends it to EUDAT's accounting service. [Collections] clist= /zone/some/path /zone/other/path
将此复制到irodscollector.cfg并使其适应您的站点。
大部分应该是自我解释。注意你需要 为会计服务提供信用证。如果你没有 请与EUDAT会计经理联系。
另外,您需要确保调用 此脚本设置了一个合适的iRODS环境。
记录基本使用信息和错误消息 到当前工作中名为.accounting.log的文件 从中调用addRecord的目录。
开发人员注释
请使用virtualenv来维护这个包,但我不需要这么说。
该软件包可以直接从github安装:
$ pip install git+git://github.com/EUDAT-DPMT/eudat.accounting.client
代码组织在嵌套的命名空间包中,即实际操作 正在子目录中发生
$cd src/eudat/accounting/client
开始四处看看。
运行测试(到目前为止没有那么有意义):
$ python setup.py test$ python run_tests.py
链接
项目主页
https://github.com/EUDAT-DPMT/eudat.accounting.client
源代码
https://github.com/EUDAT-DPMT/eudat.accounting.client
问题跟踪程序
https://github.com/EUDAT-DPMT/eudat.accounting.client/issues
1.0.1(2017-08-25)
- addrecord现在还支持dry run选项'-t' 这解决了问题3[Raphael Ritz]
1.0.0(2017-03-15)
- 根据Claudio和Pavel的工作[Raphael Ritz]添加IrodsCollector
- python 3兼容性[raphael ritz]
1.0.0rc1(2016-07-22)
- 初始版本[Raphael Ritz]