Repository navigation
Explain what clear() does with files on disk in the JSON and Parquet recorders - #4079
Merged
Merged
Conversation
|
Performance benchmarks:
|
|
|
||
| def clear(self, dataset_name: str | None = None) -> None: | ||
| """Delete Parquet files.""" | ||
| """Clear recorded data by deleting the Parquet files. |
Collaborator
There was a problem hiding this comment.
Suggested change
| """Clear recorded data by deleting the Parquet files. | |
| """Clear recorded data by deleting the Parquet file(s). |
codebreaker32
approved these changes
Nov 13, 2026
codebreaker32
left a comment
Collaborator
There was a problem hiding this comment.
Sorry, just a small nitpick, otherwise LGTM!
EwoutH
approved these changes
Nov 14, 2026
EwoutH
left a comment
Member
There was a problem hiding this comment.
Thanks, checked both docstrings against the code; accurate.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pre-PR Checklist
Summary
Makes the
clear()docstrings ofJSONDataRecorderandParquetDataRecordersay what happens to files on disk.Bug / Issue
Fixes #4054
The two recorders treat files differently on
clear(), and the docstrings didn't explain why. As @codebreaker32 pointed out in the issue, both behaviours are right for their backend:clear()does with filesJSONDataRecordersave_to_json()exports it.jsonfiles aloneParquetDataRecorder.parquetfile itselfImplementation
Docstrings only, no behaviour change.
JSONDataRecorder.clear(): files already written bysave_to_json()stay on disk, and the nextsave_to_json()overwrites them.ParquetDataRecorder.clear(): was "Delete Parquet files.", now explains that the files are where the data is kept, so clearing deletes the file and empties the write buffer.DataRecorderandSQLDataRecorderalready describe what they clear, so I left them.Testing
clear()the.jsonfile is still there and the next save replaces its contents (times 0 to 3 before, 3 to 5 after), while the.parquetfile is gone and the recorder returns no rows.pytest tests/ -Werror -Wdefault::PendingDeprecationWarning: 1118 passed. Pre-commit passes.