-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dataframe view update and blueprint API (part 4): blueprint API (#7551)
### What This PR implements the blueprint API for the dataframe view: ```python blueprint = rrb.Blueprint( rrb.DataframeView( origin="/trig", query=rrb.archetypes.DataframeQueryV2( timeline="t", filter_by_range=(rr.TimeInt(seconds=0), rr.TimeInt(seconds=20)), filter_by_event="/trig/tan_sparse:Scalar", select=["t", "log_tick", "/trig/sin:Scalar", "/trig/cos:Scalar", "/trig/tan_sparse:Scalar"], ), ), ) ``` The blueprint API is now functional and can be used to configure everything in the new UI, which is _still_ mostly inoperative (except for column visibility—this can be tested end-to-end). <hr> Part of a series to address #6896 and #7498. All PRs: - #7515 - #7516 - #7527 - #7545 - #7551 - #7572 - #7573 ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested the web demo (if applicable): * Using examples from latest `main` build: [rerun.io/viewer](https://rerun.io/viewer/pr/7551?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) * Using full set of examples from `nightly` build: [rerun.io/viewer](https://rerun.io/viewer/pr/7551?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG * [x] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)! * [x] If have noted any breaking changes to the log API in `CHANGELOG.md` and the migration guide - [PR Build Summary](https://build.rerun.io/pr/7551) - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html) To run all checks from `main`, comment on the PR with `@rerun-bot full-check`.
- Loading branch information
Showing
15 changed files
with
580 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 4 additions & 48 deletions
52
rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query_v2.py
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
70 changes: 70 additions & 0 deletions
70
rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query_v2_ext.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Any | ||
|
||
from ... import datatypes | ||
from ...blueprint import components as blueprint_components, datatypes as blueprint_datatypes | ||
from ...error_utils import catch_and_log_exceptions | ||
|
||
|
||
class DataframeQueryV2Ext: | ||
"""Extension for [DataframeQueryV2][rerun.blueprint.archetypes.DataframeQueryV2].""" | ||
|
||
def __init__( | ||
self: Any, | ||
*, | ||
timeline: datatypes.Utf8Like | None = None, | ||
filter_by_range: tuple[datatypes.TimeInt, datatypes.TimeInt] | ||
| blueprint_datatypes.FilterByRangeLike | ||
| None = None, | ||
filter_by_event: blueprint_datatypes.ComponentColumnSelectorLike | None = None, | ||
apply_latest_at: bool = False, | ||
select: list[blueprint_datatypes.ComponentColumnSelectorLike | datatypes.Utf8Like | str] | None = None, | ||
): | ||
""" | ||
Create a new instance of the DataframeQueryV2 archetype. | ||
Parameters | ||
---------- | ||
timeline: | ||
The timeline for this query. | ||
filter_by_range: | ||
If set, a range filter is applied. | ||
filter_by_event: | ||
If provided, the dataframe will only contain rows corresponding to timestamps at which an event was logged | ||
for the provided column. | ||
apply_latest_at: | ||
Should empty cells be filled with latest-at queries? | ||
select: | ||
Selected columns. If unset, all columns are selected. | ||
""" | ||
|
||
if isinstance(filter_by_range, tuple): | ||
start, end = filter_by_range | ||
filter_by_range = blueprint_components.FilterByRange(start, end) | ||
|
||
if filter_by_event is not None: | ||
if isinstance(filter_by_event, str): | ||
column = blueprint_datatypes.ComponentColumnSelector(spec=filter_by_event) | ||
else: | ||
column = filter_by_event | ||
|
||
new_filter_by_event = blueprint_components.FilterByEvent(active=True, column=column) | ||
else: | ||
new_filter_by_event = None | ||
|
||
with catch_and_log_exceptions(context=self.__class__.__name__): | ||
self.__attrs_init__( | ||
timeline=timeline, | ||
filter_by_range=filter_by_range, | ||
filter_by_event=new_filter_by_event, | ||
apply_latest_at=apply_latest_at, | ||
select=select, | ||
) | ||
return | ||
self.__attrs_clear__() |
40 changes: 10 additions & 30 deletions
40
rerun_py/rerun_sdk/rerun/blueprint/datatypes/component_column_selector.py
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.