Skip to content

fix(loaders): honor "Stop and Keep" — keep partial data on user cancel#186

Merged
facontidavide merged 2 commits into
mainfrom
fix/keep-partial-import
Jul 6, 2026
Merged

fix(loaders): honor "Stop and Keep" — keep partial data on user cancel#186
facontidavide merged 2 commits into
mainfrom
fix/keep-partial-import

Conversation

@pabloinigoblasco

Copy link
Copy Markdown
Contributor

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:

  • 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.

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: honor Stop and Keep across all file loaders.

Test plan

  • Load a large CSV, cancel with "Stop and Keep": rows already parsed remain on the plot.
  • Load a large ULog, cancel with "Stop and Keep": same.
  • Load a parquet fanout / lerobot multi-file, cancel with "Stop and Keep": partial data preserved consistently.
  • "Stop and Discard" still drops everything on all loaders.

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.
@facontidavide facontidavide merged commit 3e27d61 into main Jul 6, 2026
30 checks passed
@facontidavide facontidavide deleted the fix/keep-partial-import branch July 6, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants