将记帐记录上载到eudat记帐服务器

eudat.accounting.client的Python项目详细描述


将会计记录上载到EUDAT会计服务器

通过eudat公共数据提供的(存储)资源的管理员 基础设施可以使用此工具方便地报告当前资源 每个注册资源的消耗量。会计记录按照 由其(p)id标识的单个资源,该id在 该资源已在eudat的数据项目管理工具(DPMT)中注册。

默认设置是这样的:只有资源id和消耗的值 需要提供。默认单位是byte,默认资源是 类型设置为storage。 支持的选项的完整文档将在下一节中介绍。

如果这里提供的工具不能解决您的用例,您可以 对tracker的功能请求或使用更低级的方法 在server documentation中概述。

完整的文档和API

安装

安装该工具的最简单方法是通过pipeasy_install。 通常最好在virtualenv

$ pip install eudat.accounting.client

命令行界面

因此,现在有两个控制台脚本 addRecordiRODScollector。 使用-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

作者

  • Raphael Ritz, MPCDF (main author)
  • Claudio Cacciari, CINECA (initial iRODScollector)
  • Pavel Weber, KIT (improved iRODScollector)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java InputStream对象在声明后关闭   java未定义名为“transactionManager”的bean重命名transactionManager   java“jar”命令何时会拒绝将类添加到java中。jar文件?   java JPA标准依赖WHERE子句   安卓中从SD卡读取文本文件时出现java错误   java直接启用类似位置的权限   使用@WebMvcTest和Mockito-BDDMockito对SpringBoot-RestController进行java测试   java JSESSIONID存储在哪里?   java jtextarea鼠标事件覆盖容器鼠标事件   java DRL无法解析动态加载的类   java是从一个方法返回多个对象的最简单方法   java自定义按钮/编辑框是否不可见?   java GUI如何在保存用户输入的同时在面板或框架之间切换   swing Java自定义JSlider不会更新   GridBagLayout中的java超过1个JPanel   java从ProjectReactor中的flux中采样除第一个元素外的所有元素   Java泛型和泛型类型   Java代码生成宽指令的jvm