Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate daterange into datasets API #3371

Merged
merged 4 commits into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 0 additions & 58 deletions docs/API/V1/daterange.md

This file was deleted.

212 changes: 125 additions & 87 deletions docs/API/V1/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ and arbitrary metadata filter expressions.
Large collections can be paginated for efficiency using the `limit` and `offset`
query parameters.

The `keysummary` and `daterange` query parameters (if `true`) select "summary"
modes where aggregate metadata is returned without a list of datasets. These two
may be used together, but cannot be used along with the normal collection list
mode as they aren't subject to pagination.

## Query parameters

`access` string \
Expand All @@ -22,6 +27,13 @@ authenticated user; specifying `private` will show only the authenticated user's
private datasets, while specifying `public` will show only `public` datasets
(regardless of ownership).

`daterange` boolean \
Instead of returning a filtered set of datasets, return only the upload
timestamps of the oldest and most recent datasets in the filtered set. This
may be useful for initializing a date picker. If no datasets are selected by
the specified filters, the `from` and `to` keys (see
[results](#dataset-date-range)) will not be returned.

`end` date/time \
Select only datasets created on or before the specified time. Time should be
specified in ISO standard format, as `YYYY-MM-DDThh:mm:ss.ffffff[+|-]HH:MM`.
Expand Down Expand Up @@ -60,6 +72,17 @@ case, a boolean, which is represented in JSON as `true` or `false`). Beware
especially when attempting to match a JSON document (such as
`dataset.metalog.pbench`).

`keysummary` boolean \
Instead of displaying a list of selected datasets and metadata, use the set of
specified filters to accumulate a nested report on the metadata key namespace
for the set of datasets. See [metadata](../metadata.md) for deails on the
Pbench Server metadata namespaces. Because the `global` and `user` namespaces
are completely dynamic, and the `dataset.metalog` sub-namespace varies greatly
across Pbench Agent benchmark scripts, this mode provides a mechanism for a
metadata visualizer to understand what's available for a set of datasets. If no
datasets are selected by the specified filters, the `keys` key (see
[results](#key-namespace-summary)) will be set to an empty object.

`limit` integer \
"Paginate" the selected datasets by returning at most `limit` datasets. This
can be used in conjunction with `offset` to progress through the full list in
Expand Down Expand Up @@ -97,15 +120,6 @@ If the timezone offset is omitted it will be assumed to be UTC (`+00:00`); if
the time is omitted it will be assumed as midnight (`00:00:00`) on the
specified date.

`keysummary` boolean \
Instead of displaying a list of selected datasets and metadata, use the set of
specified filters to accumulate a nested report on the metadata key namespace
for the set of datasets. See [metadata](../metadata.md) for deails on the
Pbench Server metadata namespaces. Because the `global` and `user` namespaces
are completely dynamic, and the `dataset.metalog` sub-namespace varies greatly
across Pbench Agent benchmark scripts, this mode provides a mechanism for a
metadata visualizer to understand what's available for a set of datasets.

## Request headers

`authorization: bearer` token [_optional_] \
Expand Down Expand Up @@ -147,6 +161,20 @@ a message, and optional JSON data provided by the system administrator.

## Response body

### Dataset date range

The `application/json` response body is a JSON object describing the earliest
and most recent dataset upload time for the selected list of datasets. If the
collection filters exclude all datasets (the result set is empty), the return
value will be empty, omitting both the `from` and `to` keywords.

```json
{
"from": "2023-03-17T03:14:02.013184+00:00",
"to": "2023-04-05T11:29:02.585772+00:00"
}
```

### Dataset list

The `application/json` response body contains a list of objects which describe
Expand Down Expand Up @@ -217,9 +245,9 @@ might return:

When the `keysummary` query parameter is `true` (e.g., either `?keysummary` or
`?keysummary=true`), instead of reporting a list of datasets and metadata for
each dataset, report a hierarchical representation of the aggregate metadata
namespace across all selected datasets. This returns much less data and is not
subject to pagination.
each dataset, the `application/json` response body contains a hierarchical
representation of the aggregate metadata namespace across all selected datasets.
This returns much less data and is not subject to pagination.

"Leaf" nodes in the metadata tree are represented by `null` values while any
key with children will be represented as a nested JSON object showing those
Expand All @@ -235,83 +263,93 @@ will return a JSON document with the keys `config`, `date`, `hostname_f`,

```json
{
"dataset": {
"access": null,
"id": null,
"metalog": {
"controller": {
"hostname": null,
"hostname-alias": null,
"hostname-all-fqdns": null,
"hostname-all-ip-addresses": null,
"hostname-domain": null,
"hostname-fqdn": null,
"hostname-ip-address": null,
"hostname-nis": null,
"hostname-short": null,
"ssh_opts": null
},
"iterations/1-default": {
"iteration_name": null,
"iteration_number": null,
"user_script": null
},
"pbench": {
"config": null,
"date": null,
"hostname_f": null,
"hostname_ip": null,
"hostname_s": null,
"iterations": null,
"name": null,
"rpm-version": null,
"script": null,
"tar-ball-creation-timestamp": null
"keys": {
"dataset": {
"access": null,
"id": null,
"metalog": {
"controller": {
"hostname": null,
"hostname-alias": null,
"hostname-all-fqdns": null,
"hostname-all-ip-addresses": null,
"hostname-domain": null,
"hostname-fqdn": null,
"hostname-ip-address": null,
"hostname-nis": null,
"hostname-short": null,
"ssh_opts": null
},
"iterations/1-default": {
"iteration_name": null,
"iteration_number": null,
"user_script": null
},
"pbench": {
"config": null,
"date": null,
"hostname_f": null,
"hostname_ip": null,
"hostname_s": null,
"iterations": null,
"name": null,
"rpm-version": null,
"script": null,
"tar-ball-creation-timestamp": null
},
"run": {
"controller": null,
"end_run": null,
"raw_size": null,
"start_run": null
},
"tools": {
"group": null,
"hosts": null,
"trigger": null
},
"tools/dbutenho.bos.csb": {
"hostname-alias": null,
"hostname-all-fqdns": null,
"hostname-all-ip-addresses": null,
"hostname-domain": null,
"hostname-fqdn": null,
"hostname-ip-address": null,
"hostname-nis": null,
"hostname-short": null,
"label": null,
"rpm-version": null,
"tools": null,
"vmstat": null
},
"tools/dbutenho.bos.csb/vmstat": {
"install_check_output": null,
"install_check_status_code": null,
"options": null
}
},
"run": {
"controller": null,
"end_run": null,
"raw_size": null,
"start_run": null
},
"tools": {
"group": null,
"hosts": null,
"trigger": null
},
"tools/dbutenho.bos.csb": {
"hostname-alias": null,
"hostname-all-fqdns": null,
"hostname-all-ip-addresses": null,
"hostname-domain": null,
"hostname-fqdn": null,
"hostname-ip-address": null,
"hostname-nis": null,
"hostname-short": null,
"label": null,
"rpm-version": null,
"tools": null,
"vmstat": null
},
"tools/dbutenho.bos.csb/vmstat": {
"install_check_output": null,
"install_check_status_code": null,
"options": null
}
},
"name": null,
"owner_id": null,
"resource_id": null,
"uploaded": null
},
"server": {
"deletion": null,
"index-map": {
"container-pbench.v6.run-data.2023-03": null,
"container-pbench.v6.run-toc.2023-03": null
"name": null,
"owner_id": null,
"resource_id": null,
"uploaded": null
},
"origin": null,
"tarball-path": null
"server": {
"deletion": null,
"index-map": {
"container-pbench.v6.run-data.2023-03": null,
"container-pbench.v6.run-toc.2023-03": null
},
"origin": null,
"tarball-path": null
}
}
}
```

### Combining key namespace summary and date range

When both the `keysummary` and `daterange` query parameters are `true`, the
`application/json` response body contains the `from`, `to`, and `keys` key
values. If the selected collection filters produce no results, as with
`daterange` alone, the `from` and `to` keys will be omitted and the value of
`keys` will be an empty object.
webbnh marked this conversation as resolved.
Show resolved Hide resolved
1 change: 0 additions & 1 deletion lib/pbench/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class API(Enum):

DATASETS = "datasets"
DATASETS_CONTENTS = "datasets_contents"
DATASETS_DATERANGE = "datasets_daterange"
DATASETS_DETAIL = "datasets_detail"
DATASETS_INVENTORY = "datasets_inventory"
DATASETS_LIST = "datasets_list"
Expand Down
7 changes: 0 additions & 7 deletions lib/pbench/server/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from pbench.common.exceptions import ConfigFileNotSpecified
from pbench.common.logger import get_pbench_logger
from pbench.server import PbenchServerConfig
from pbench.server.api.resources.datasets_daterange import DatasetsDateRange
from pbench.server.api.resources.datasets_inventory import DatasetsInventory
from pbench.server.api.resources.datasets_list import DatasetsList
from pbench.server.api.resources.datasets_metadata import DatasetsMetadata
Expand Down Expand Up @@ -68,12 +67,6 @@ def register_endpoints(api: Api, app: Flask, config: PbenchServerConfig):
endpoint="datasets_contents",
resource_class_args=(config,),
)
api.add_resource(
DatasetsDateRange,
f"{base_uri}/datasets/daterange",
endpoint="datasets_daterange",
resource_class_args=(config,),
)
api.add_resource(
DatasetsDetail,
f"{base_uri}/datasets/<string:dataset>/detail",
Expand Down
Loading