Skip to content

Commit

Permalink
A few more tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
dbutenhof committed Apr 7, 2023
1 parent 4e79e67 commit fb5034a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 6 additions & 2 deletions docs/API/V1/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ private datasets, while specifying `public` will show only `public` datasets
`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
can be useful for initializing a date picker, for example.
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
Expand Down Expand Up @@ -77,7 +79,9 @@ 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.
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
Expand Down
9 changes: 5 additions & 4 deletions lib/pbench/server/api/resources/datasets_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,14 +332,15 @@ def keyspace(self, query: Query) -> JSONOBJECT:
Returns:
The aggregated keyspace JSON object
"""
aggregate: JSONOBJECT = {
"dataset": {c.name: None for c in Dataset.__table__._columns}
}

Database.dump_query(query, current_app.logger)
aggregate: JSONOBJECT = {}

datasets = query.all()
for d in datasets:
if not aggregate:
aggregate.update(
{"dataset": {c.name: None for c in Dataset.__table__._columns}}
)
for m in d.metadatas:
# "metalog" is a top-level key in the Metadata schema, but we
# report it as a sub-key of "dataset".
Expand Down

0 comments on commit fb5034a

Please sign in to comment.