fix(loaders): honor "Stop and Keep" — keep partial data on user cancel#186
Merged
Conversation
The cancel dialog offers "Stop and Discard" (drop everything) and "Stop
and
Keep" (keep what was parsed so far). Every file loader returned an
error on a
user stop, so "Stop and Keep" kept nothing:
- CSV / ULog parse the whole file and write only at the end, so a stop
returned
before any appendRecord — the dataset came out empty.
- Parquet / lerobot write incrementally, so the single-file path
happened to keep
the rows, but returning `unexpected` on stop made the
multi-file/fanout path
treat it as a failure and drop them — inconsistent with the promise.
Make every loader treat a user stop as "stop reading, keep what's
written":
- CSV: don't abort on !success when isStopRequested(); fall through
and write the
partial `result` (and skip the interactive "continue?" prompts on
the stop path).
- ULog: break out of the read loop and fall through to the write path.
- Parquet / lerobot: break / return okStatus() instead of unexpected
on stop
(lerobot in both its scalar-batch loop and its post-episode check).
The host then flushes the buffered rows on Keep and evicts the dataset
on
Discard, so both actions behave the same across all loaders. MCAP
already did
this (break + return ok); mp4 loads video lazily and has no
partial-read path.
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.
Summary
The cancel dialog offers "Stop and Discard" (drop everything) and "Stop and Keep" (keep what was parsed so far). Every file loader returned an error on a user stop, so "Stop and Keep" kept nothing:
appendRecord— the dataset came out empty.unexpectedon stop made the multi-file/fanout path treat it as a failure and drop them — inconsistent with the promise.Make every loader treat a user stop as "stop reading, keep what's written":
!successwhenisStopRequested(); fall through and write the partialresult(and skip the interactive "continue?" prompts on the stop path).break/ returnokStatus()instead ofunexpectedon stop (lerobot in both its scalar-batch loop and its post-episode check).The host then flushes the buffered rows on Keep and evicts the dataset on Discard, so both actions behave the same across all loaders. MCAP already did this (
break+ return ok); mp4 loads video lazily and has no partial-read path.Contents
data_load_csv/csv_source.cpp,data_load_ulog/ulog_source.cpp,data_load_parquet/parquet_source.cpp,data_load_lerobot/lerobot_plugin.cpp: honorStop and Keepacross all file loaders.Test plan