Skip to content

Document and test multiprocessing pattern for concurrent XML loading#58

Merged
martinv13 merged 4 commits into
cre-dev:mainfrom
martinv13:claude/sync-main-branch-tFAIj
May 29, 2026
Merged

Document and test multiprocessing pattern for concurrent XML loading#58
martinv13 merged 4 commits into
cre-dev:mainfrom
martinv13:claude/sync-main-branch-tFAIj

Conversation

@martinv13
Copy link
Copy Markdown
Collaborator

Adds a test_multiprocessing.py test (parallel parse + serialised DuckDB writes via multiprocessing.Lock, with XML roundtrip content assertion) and a matching example in the API overview docs. Each worker creates its own DataModel with a unique temp_prefix so temp tables never collide. Bumps version to 0.13.1.

claude added 4 commits May 29, 2026 08:41
Documents and tests the pattern of using a multiprocessing.Lock to allow
parallel XML parsing while serialising DuckDB writes to a shared file-based
database. Each worker process gets its own DataModel (unique temp_prefix UUID),
so temp tables never collide. engine.dispose() is called inside the lock to
release the file handle before the next writer acquires it.

https://claude.ai/code/session_01JB3CkHnBDM3aQP2EHhfzjv
After all worker processes finish loading, verify each file by extracting
it from the database and comparing the regenerated XML byte-for-byte with
the original. Uses the same model config as the orders roundtrip test
(version 0) so the assertion is meaningful.

https://claude.ai/code/session_01JB3CkHnBDM3aQP2EHhfzjv
Open with the general principle (serialise DB access across processes)
and explain why the level of required synchronisation differs per backend,
before presenting the DuckDB-as-concrete-example snippet. Also rename
db_path → connection_string in the code sample to remove the DuckDB-specific
string construction.

https://claude.ai/code/session_01JB3CkHnBDM3aQP2EHhfzjv
@martinv13 martinv13 merged commit 1c828e5 into cre-dev:main May 29, 2026
9 checks passed
@martinv13 martinv13 deleted the claude/sync-main-branch-tFAIj branch May 29, 2026 09:54
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