Repository navigation
Cap bulk document upload batches by size; fail when nothing is ingested; resume lightsheet builds from cloud documents - #372
Conversation
Port of VH-Lab/NDI-matlab#1247. uploadDocumentCollection put up to 100000 documents into one JSON file in one zip; a 638 MB file made the server's ingestion Lambda run out of scratch disk, nothing was ingested, and the upload still reported success. - New preference Cloud.Upload.Max_Document_Batch_Size (50 MB) and keyword-only max_bytes: batches end at that much JSON or at max_chunk documents (new helper documentBatchRanges). - Documents are encoded once; zip_documents_for_upload gains document_json. - If the server lists none of the stored documents when the ingestion wait ends: status 'partial', uploaded 0, ids moved from manifest to not_ingested, ingestion['state'] 'failed', reason in errors. - Bridge entries for uploadDocumentCollection, zip_documents_for_upload, documentBatchRanges (new) and preferences synced to NDI-matlab ec25d3c. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011v7R5rmThd1CWtGUX32qh7
The bridge drift check failed on readngrid: NDI-matlab e3744121e (now on main) lets readngrid read a did.file.fileobj such as the one database_openbinarydoc returns. Ported: file_path may also be a did.file.Fileobj or an open binary file object; an open one is read from its current position and left open, an unopened Fileobj is opened 'rb' and closed after. Bridge hash bumped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011v7R5rmThd1CWtGUX32qh7
|
The "MATLAB/Python bridge completeness" failure was not caused by this PR. It flagged Generated by Claude Code |
|
Generated by Claude Code |
…g-45o38v # Conflicts: # src/ndi/fun/data.py
…nc with NDI-matlab a469501c1) Port of VH-Lab/NDI-matlab#1296. DID strips series ingest_locations before storing, so an adopted document downloaded from NDI Cloud showed no member uids: missingMembers reported every chunk present (nothing lost was rebuilt) and a level reduced from an adopted level could not open its chunks. - SessionWriter._seriesWithUids: a series with members but no uids gets them rebuilt from its manifest (downloaded into the cache) via filehandler.reconstructSeriesIngestLocations; raises noManifest / downloadFailed / manifestUnreadable rather than guess. adopt, _registerSeries and missingMembers use it. - makePyramid: on resume, a level reduced from a stored level whose every chunk is already in the cloud is adopted and skipped before its source is resolved. - Tests: adopting a stored document finds exactly its missing members, opens a member, refuses a series whose manifest is gone; a finished build that loses three level-0 chunks resumes sending exactly those, declaring no level documents and opening no reduced level's source. - Bridge: SessionWriter and makePyramid synced to a469501c1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011v7R5rmThd1CWtGUX32qh7
Summary
Port of VH-Lab/NDI-matlab#1247 and VH-Lab/NDI-matlab#1296.
Bulk document uploads (NDI-matlab#1247)
A dataset uploaded no documents, yet the upload reported success.
uploadDocumentCollectionput up to 100000 documents into one JSON file in one zip (638 MB uncompressed). The server's ingestion Lambda ran out of/tmp(ENOSPC) and ingested nothing. The client's ingestion wait only warned that the server "may still be ingesting". The server fix is Waltham-Data-Science/ndi-cloud-node#175.Cloud.Upload.Max_Document_Batch_Size(50 MB, same key and default as MATLAB) and keyword-onlymax_bytes. A batch ends at that much JSON or atmax_chunkdocuments. New helperdocumentBatchRanges, which uses 0-based indexes and produces the same batches as MATLAB. The byte preference is read only on the bulk path.zip_documents_for_upload(..., document_json=...)reuses the encoded JSON and writes the same top-level array.statusis'partial',uploadedis 0, the ids move frommanifesttonot_ingested(sync's_upload_documentsreadsmanifest),ingestion['state']is'failed', and the reason goes toerrorsand the log. A partial count still only warns, as before.Resuming a lightsheet build from cloud documents (NDI-matlab#1296)
DID strips series
ingest_locationsbefore storing, so a document downloaded from NDI Cloud and adopted on resume showed no member uids. Two consequences:missingMembersreported every chunk present, so nothing lost was rebuilt. A prod pyramid kept 327 lost chunks this way.Changes:
SessionWriter._seriesWithUids. A series that has members but no uids gets them rebuilt from its manifest. The manifest is downloaded into the cache and read withfilehandler.reconstructSeriesIngestLocations. It raises (noManifest/downloadFailed/manifestUnreadable) rather than guess.adopt,_registerSeriesandmissingMembersuse it.makePyramid. On resume, a level reduced from a stored level whose every chunk is already in the cloud is adopted and skipped before its source is resolved.Bridge
uploadDocumentCollection,zip_documents_for_upload,documentBatchRangesandpreferencesare synced to NDI-matlabec25d3c.SessionWriterandmakePyramidare synced toa469501c1. Both commits are on NDI-matlabmain.main(Navigator: published filter in the cloud dataset browser; NDI Cloud login indicator #373, including itsreadngridport) was merged in; the conflictingreadngridfiles take Navigator: published filter in the cloud dataset browser; NDI Cloud login indicator #373's version.Testing
black --checkandruff checkare clean.tests/test_cloud_upload_bulk_documents.pycovers:document_jsonequivalence and mismatch;test_gui_preferences_editor.pywas updated for the new preference row.tests/test_cloud_session_writer.py:tests/test_fun_doc_lightsheet_build.py: a finished build loses three level-0 chunks and the resume sends exactly those. It declares no level documents and opens no reduced level's source.Generated by Claude Code