-
Notifications
You must be signed in to change notification settings - Fork 550
Record replay #1708
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
base: dev
Are you sure you want to change the base?
Record replay #1708
Changes from 2 commits
aa05448
4d7f98d
8f763c1
4e646d6
6c7ff5d
ff0adfc
9083096
8315178
2b9a476
c473fda
46b38b8
99e6013
81157b4
9d69576
6bf01da
7b6d0c1
a20eaf7
4e6ea2c
ad6debf
b11e938
bc563b7
2d6f159
5b4bdf4
2dfc23e
787bd66
d9f6ff3
480f853
28de1d2
34a20ba
4cbf61e
c3588c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,3 +77,6 @@ CLAUDE.MD | |
| htmlcov/ | ||
| .coverage | ||
| .coverage.* | ||
|
|
||
| # Created from simulation | ||
| MUJOCO_LOG.TXT | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,5 +69,9 @@ def fetch_by_ids(self, ids: list[int]) -> list[Observation[T]]: | |
| """Batch fetch by id (for vector search results).""" | ||
| ... | ||
|
|
||
| def delete_range(self, t1: float, t2: float) -> list[int]: | ||
| """Delete observations with ts in [t1, t2]. Returns deleted IDs.""" | ||
| raise NotImplementedError | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not make it an |
||
|
|
||
| def serialize(self) -> dict[str, Any]: | ||
| return {"class": qual(type(self)), "config": self.config.model_dump()} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -440,5 +440,21 @@ def fetch_by_ids(self, ids: list[int]) -> list[Observation[T]]: | |
| rows = self._conn.execute(sql, ids).fetchall() | ||
| return [self._row_to_obs(r, has_blob=join) for r in rows] | ||
|
|
||
| def delete_range(self, t1: float, t2: float) -> list[int]: | ||
| """Delete observations with ts in [t1, t2]. Returns deleted IDs.""" | ||
| with self._lock: | ||
| rows = self._conn.execute( | ||
| f'SELECT id FROM "{self._name}" WHERE ts >= ? AND ts <= ?', (t1, t2) | ||
| ).fetchall() | ||
| ids = [r[0] for r in rows] | ||
| if ids: | ||
| placeholders = ",".join("?" * len(ids)) | ||
| self._conn.execute(f'DELETE FROM "{self._name}" WHERE id IN ({placeholders})', ids) | ||
| self._conn.execute( | ||
| f'DELETE FROM "{self._name}_rtree" WHERE id IN ({placeholders})', ids | ||
| ) | ||
| self._conn.commit() | ||
|
Comment on lines
+445
to
+455
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can use DELETE-RETURNING and use 2 executes instead of 3 (i.e. merge the SELECT and DELETE into a single statement). rows = self._conn.execute(
f'DELETE FROM "{self._name}" WHERE ts >= ? AND ts <= ? RETURNING id',
(t1, t2),
).fetchall() |
||
| return ids | ||
|
|
||
| def stop(self) -> None: | ||
| super().stop() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Copyright 2026 Dimensional Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| from dimos.record.record_replay import RecordReplay | ||
|
|
||
| __all__ = ("RecordReplay",) |
Uh oh!
There was an error while loading. Please reload this page.