7 个版本
0.2.0 | 2022年4月3日 |
---|---|
0.1.5 | 2021年9月28日 |
0.1.3 | 2021年8月24日 |
167 在 数据库实现 中
每月下载 21 次
82KB
2K SLoC
mlmdquery
一个用于查询 ml-metadata 数据库内容的命令行工具。
功能
- 可以指定比原始 Python API 更灵活的搜索查询
- 可以在不获取所有数据的情况下获取与查询匹配的项目数
使用示例
注意
以下示例使用 SQLite 数据库文件(mlmd.db
)。数据库内容由 官方入门指南 中描述的示例代码生成。
获取数据库中的工件
$ mlmdquery get artifacts --db sqlite://mlmd.db
[
{
"id": 2,
"name": null,
"type": "SavedModel",
"uri": "path/to/model/file",
"state": "UNKNOWN",
"ctime": 1628605220.769,
"mtime": 1628605220.904,
"properties": {
"name": "MNIST-v1",
"version": 1
},
"custom_properties": {}
},
{
"id": 1,
"name": null,
"type": "DataSet",
"uri": "path/to/data",
"state": "UNKNOWN",
"ctime": 1628605220.108,
"mtime": 1628605220.235,
"properties": {
"day": 1,
"split": "train"
},
"custom_properties": {}
}
]
计算数据库中的工件数量
$ export MLMD_DB=sqlite://mlmd.db
$ mlmdquery count artifacts
2
指定最大工件数量
$ mlmdquery get artifacts --limit 1
[
{
"id": 2,
"name": null,
"type": "SavedModel",
"uri": "path/to/model/file",
"state": "UNKNOWN",
"ctime": 1628605220.769,
"mtime": 1628605220.904,
"properties": {
"name": "MNIST-v1",
"version": 1
},
"custom_properties": {}
}
]
Specify the URI of the target artifact:
```console
$ export MLMD_DB=sqlite://mlmd.db
$ mlmdquery get artifacts --uri path/to/data
[
{
"id": 1,
"name": null,
"type": "DataSet",
"uri": "path/to/data",
"state": "UNKNOWN",
"ctime": 1628605220.108,
"mtime": 1628605220.235,
"properties": {
"day": 1,
"split": "train"
},
"custom_properties": {}
}
]
$ mlmdquery get artifacts
的可用选项
$ mlmdquery get artifacts -h
Gets artifacts
USAGE:
mlmdquery get artifacts [FLAGS] [OPTIONS] --db <db>
FLAGS:
--asc If specified, the search results will be sorted in ascending order
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
--context <context> Context ID to which target artifacts belong
--ctime-end <ctime-end> End of creation time (UNIX timestamp seconds)
--ctime-start <ctime-start> Start of creation time (UNIX timestamp seconds)
--db <db> Database URL [env: MLMD_DB]
--id <ids>... Target artifact IDs
--limit <limit> Maximum number of artifacts in a search result [default: 100]
--mtime-end <mtime-end> End of update time (UNIX timestamp seconds)
--mtime-start <mtime-start> Start of update time (UNIX timestamp seconds)
--name <name> Target artifact name
--offset <offset> Number of artifacts to be skipped from a search result [default: 0]
--order-by <order-by> Field to be used to sort a search result [default: id] [possible values: id,
name, ctime, mtime]
--type <type-name> Target artifact type
--uri <uri> Target artifact URI
可用命令
$ mlmdquery -h
mlmdquery 0.1.0
USAGE:
mlmdquery <SUBCOMMAND>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
SUBCOMMANDS:
count Counts artifacts/executions/contexts/events
get Gets artifacts/executions/contexts/events
help Prints this message or the help of the given subcommand(s)
$ mlmdquery get -h
mlmdquery-get 0.1.0
Gets artifacts/executions/contexts/events
USAGE:
mlmdquery get <SUBCOMMAND>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
SUBCOMMANDS:
artifact-types Gets artifact types
artifacts Gets artifacts
context-types Gets context types
contexts Gets contexts
events Gets events
execution-types Gets execution types
executions Gets executions
help Prints this message or the help of the given subcommand(s)
如何构建静态二进制文件?
请使用 rust-musl-builder。
依赖关系
51MB
~1M SLoC