seamless-database 2.0.2__tar.gz → 2.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (19) hide show
  1. seamless_database-2.3.0/LICENSE.txt +22 -0
  2. {seamless_database-2.0.2 → seamless_database-2.3.0}/PKG-INFO +55 -6
  3. {seamless_database-2.0.2 → seamless_database-2.3.0}/README.md +52 -5
  4. {seamless_database-2.0.2 → seamless_database-2.3.0}/database.py +412 -172
  5. {seamless_database-2.0.2 → seamless_database-2.3.0}/database_models.py +129 -10
  6. {seamless_database-2.0.2 → seamless_database-2.3.0}/pyproject.toml +1 -1
  7. {seamless_database-2.0.2 → seamless_database-2.3.0}/seamless_database.egg-info/PKG-INFO +55 -6
  8. {seamless_database-2.0.2 → seamless_database-2.3.0}/seamless_database.egg-info/SOURCES.txt +6 -0
  9. seamless_database-2.3.0/tests/test_celljoin_records.py +72 -0
  10. seamless_database-2.3.0/tests/test_contract_hashtype_db.py +154 -0
  11. seamless_database-2.3.0/tests/test_contract_reference_lifecycle_db.py +65 -0
  12. seamless_database-2.3.0/tests/test_execution_records.py +524 -0
  13. seamless_database-2.3.0/tests/test_hash_type_tightening.py +159 -0
  14. {seamless_database-2.0.2 → seamless_database-2.3.0}/seamless_database.egg-info/dependency_links.txt +0 -0
  15. {seamless_database-2.0.2 → seamless_database-2.3.0}/seamless_database.egg-info/entry_points.txt +0 -0
  16. {seamless_database-2.0.2 → seamless_database-2.3.0}/seamless_database.egg-info/requires.txt +0 -0
  17. {seamless_database-2.0.2 → seamless_database-2.3.0}/seamless_database.egg-info/top_level.txt +0 -0
  18. {seamless_database-2.0.2 → seamless_database-2.3.0}/setup.cfg +0 -0
  19. {seamless_database-2.0.2 → seamless_database-2.3.0}/tests/test_random_port.py +0 -0
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Author: Sjoerd de Vries, MBI platform.
4
+ Copyright (c) 2023-2026 CNRS.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: seamless-database
3
- Version: 2.0.2
3
+ Version: 2.3.0
4
4
  Summary: SQLite-backed metadata database service for Seamless
5
5
  Author: Sjoerd de Vries
6
6
  License-Expression: MIT
@@ -18,8 +18,10 @@ Classifier: Topic :: Scientific/Engineering
18
18
  Classifier: Topic :: Software Development :: Libraries
19
19
  Requires-Python: >=3.10
20
20
  Description-Content-Type: text/markdown
21
+ License-File: LICENSE.txt
21
22
  Requires-Dist: aiohttp
22
23
  Requires-Dist: peewee
24
+ Dynamic: license-file
23
25
 
24
26
  # seamless-database
25
27
 
@@ -35,13 +37,60 @@ The database stores the following kinds of records:
35
37
  |-------|---------|
36
38
  | **Transformation** | Maps a transformation checksum to its result checksum |
37
39
  | **RevTransformation** | Reverse lookup: finds which transformations produced a given result |
38
- | **BufferInfo** | Stores buffer metadata (length, dtype, encoding, etc.) for a checksum |
40
+ | **HashType** | Stores the packed checksum classification word used by new HashType validation and conversion checks |
39
41
  | **SyntacticToSemantic** | Maps between syntactic and semantic checksums per celltype |
40
- | **Expression** | Caches expression evaluation results (input checksum + path + celltype → result checksum) |
41
- | **MetaData** | Stores execution metadata for transformations (executor, environment, timing) |
42
- | **IrreproducibleTransformation** | Records transformations whose results are not reproducible |
42
+ | **Expression** | Caches expression evaluation results keyed by `(input_checksum, path, input_celltype, celltype)` |
43
+ | **MetaData** | Stores a canonical execution record for each successful, non-probe transformation |
44
+ | **IrreproducibleTransformation** | Records transformations whose results are not reproducible; metadata is preserved on migration |
43
45
 
44
- All data is persisted in a single SQLite file (typically `seamless.db`).
46
+ All data is persisted in a single SQLite file (typically `seamless.db`). The current protocol version is **2.3**.
47
+
48
+ ## Expression cache schema
49
+
50
+ Expression `input_celltype` describes the input checksum's interpretation;
51
+ `celltype` describes the produced result. Both are part of the composite cache
52
+ key. Database, jobserver, remote client, and Dask payloads use those same names.
53
+ The unreleased old `celltype`/`target_celltype` keys are not accepted aliases.
54
+ Existing development caches need these statements, in order, or a recreated
55
+ expression cache table:
56
+
57
+ ```sql
58
+ ALTER TABLE expression RENAME COLUMN celltype TO input_celltype;
59
+ ALTER TABLE expression RENAME COLUMN target_celltype TO celltype;
60
+ ```
61
+
62
+ ## Execution records
63
+
64
+ `MetaData` stores one canonical execution record per successful, non-probe transformation, keyed by `tf_checksum`. Records are **write-once**: subsequent calls to a recorded transformation hit the normal `Transformation` cache and do not re-enter the record path.
65
+
66
+ Two record sizes coexist under the same schema:
67
+
68
+ - **Minimal record (default)** — `schema_version`, `tf_checksum`, `result_checksum`, `seamless_version`, `execution_mode`, `remote_target`, `wall_time_seconds`, `cpu_time_user_seconds`, `cpu_time_system_seconds`, `memory_peak_bytes`, `gpu_memory_peak_bytes`. The hot path pays only timing/memory capture and one write.
69
+ - **Full record (`record: true` in `seamless.profile.yaml`)** — adds environment fingerprints (content-addressed `node`, `environment`, `queue` sub-buffer checksums), compilation context, validation snapshots, contract-violation lists, execution envelope (requested cluster/queue/node, scratch/fingertip flags, resolved `__env__`), and per-job freshness/retry/worker fields.
70
+
71
+ The validator on `PUT metadata` checks identity only — record syntax (integer `schema_version`, body `tf_checksum`/`result_checksum` matching the request, sane `checksum_fields` if present) — not the full payload schema. Identical duplicates are idempotent successes; differing bodies are rejected. Once `IrreproducibleTransformation` rows exist for a `tf_checksum`, `PUT metadata` for that checksum is rejected to avoid silently migrating it back into the normal cache.
72
+
73
+ When a normal entry moves to `IrreproducibleTransformation`, its metadata body travels with it unchanged.
74
+
75
+ ### Schema upgrade from legacy
76
+
77
+ The legacy `meta_data` table had two columns (`checksum PRIMARY KEY`, `metadata JSON`). On startup, `seamless-database`:
78
+
79
+ - creates the upgraded table fresh if absent,
80
+ - drops and recreates the legacy table if it is empty,
81
+ - preserves an already-upgraded table on subsequent starts,
82
+ - and **fails loudly** if a non-empty legacy table is present (it must be migrated explicitly).
83
+
84
+ ### Endpoints (request types)
85
+
86
+ - `PUT metadata` — atomically creates missing `Transformation` and `RevTransformation` rows alongside the `MetaData` row. Body: `{type: "metadata", checksum: <tf>, result: <result>, value: <record>}`.
87
+ - `GET metadata` — return the canonical record body for a `tf_checksum`.
88
+ - `GET irreproducible` — return all rows for a `tf_checksum`, optionally filtered by `result`. Each row includes `checksum`, `result`, and `metadata`.
89
+ - `PUT irreproducible` — move a normal entry into `IrreproducibleTransformation`, preserving metadata.
90
+
91
+ The remote-client equivalents are `set_execution_record`, `get_execution_record`, and `get_irreproducible_records` in `seamless-remote`.
92
+
93
+ See the [agent contract](https://github.com/sjdv1982/seamless/blob/main/docs/agent/contracts/execution-records.md) for the full behavioral spec.
45
94
 
46
95
  ## Role in the Seamless ecosystem
47
96
 
@@ -12,13 +12,60 @@ The database stores the following kinds of records:
12
12
  |-------|---------|
13
13
  | **Transformation** | Maps a transformation checksum to its result checksum |
14
14
  | **RevTransformation** | Reverse lookup: finds which transformations produced a given result |
15
- | **BufferInfo** | Stores buffer metadata (length, dtype, encoding, etc.) for a checksum |
15
+ | **HashType** | Stores the packed checksum classification word used by new HashType validation and conversion checks |
16
16
  | **SyntacticToSemantic** | Maps between syntactic and semantic checksums per celltype |
17
- | **Expression** | Caches expression evaluation results (input checksum + path + celltype → result checksum) |
18
- | **MetaData** | Stores execution metadata for transformations (executor, environment, timing) |
19
- | **IrreproducibleTransformation** | Records transformations whose results are not reproducible |
17
+ | **Expression** | Caches expression evaluation results keyed by `(input_checksum, path, input_celltype, celltype)` |
18
+ | **MetaData** | Stores a canonical execution record for each successful, non-probe transformation |
19
+ | **IrreproducibleTransformation** | Records transformations whose results are not reproducible; metadata is preserved on migration |
20
20
 
21
- All data is persisted in a single SQLite file (typically `seamless.db`).
21
+ All data is persisted in a single SQLite file (typically `seamless.db`). The current protocol version is **2.3**.
22
+
23
+ ## Expression cache schema
24
+
25
+ Expression `input_celltype` describes the input checksum's interpretation;
26
+ `celltype` describes the produced result. Both are part of the composite cache
27
+ key. Database, jobserver, remote client, and Dask payloads use those same names.
28
+ The unreleased old `celltype`/`target_celltype` keys are not accepted aliases.
29
+ Existing development caches need these statements, in order, or a recreated
30
+ expression cache table:
31
+
32
+ ```sql
33
+ ALTER TABLE expression RENAME COLUMN celltype TO input_celltype;
34
+ ALTER TABLE expression RENAME COLUMN target_celltype TO celltype;
35
+ ```
36
+
37
+ ## Execution records
38
+
39
+ `MetaData` stores one canonical execution record per successful, non-probe transformation, keyed by `tf_checksum`. Records are **write-once**: subsequent calls to a recorded transformation hit the normal `Transformation` cache and do not re-enter the record path.
40
+
41
+ Two record sizes coexist under the same schema:
42
+
43
+ - **Minimal record (default)** — `schema_version`, `tf_checksum`, `result_checksum`, `seamless_version`, `execution_mode`, `remote_target`, `wall_time_seconds`, `cpu_time_user_seconds`, `cpu_time_system_seconds`, `memory_peak_bytes`, `gpu_memory_peak_bytes`. The hot path pays only timing/memory capture and one write.
44
+ - **Full record (`record: true` in `seamless.profile.yaml`)** — adds environment fingerprints (content-addressed `node`, `environment`, `queue` sub-buffer checksums), compilation context, validation snapshots, contract-violation lists, execution envelope (requested cluster/queue/node, scratch/fingertip flags, resolved `__env__`), and per-job freshness/retry/worker fields.
45
+
46
+ The validator on `PUT metadata` checks identity only — record syntax (integer `schema_version`, body `tf_checksum`/`result_checksum` matching the request, sane `checksum_fields` if present) — not the full payload schema. Identical duplicates are idempotent successes; differing bodies are rejected. Once `IrreproducibleTransformation` rows exist for a `tf_checksum`, `PUT metadata` for that checksum is rejected to avoid silently migrating it back into the normal cache.
47
+
48
+ When a normal entry moves to `IrreproducibleTransformation`, its metadata body travels with it unchanged.
49
+
50
+ ### Schema upgrade from legacy
51
+
52
+ The legacy `meta_data` table had two columns (`checksum PRIMARY KEY`, `metadata JSON`). On startup, `seamless-database`:
53
+
54
+ - creates the upgraded table fresh if absent,
55
+ - drops and recreates the legacy table if it is empty,
56
+ - preserves an already-upgraded table on subsequent starts,
57
+ - and **fails loudly** if a non-empty legacy table is present (it must be migrated explicitly).
58
+
59
+ ### Endpoints (request types)
60
+
61
+ - `PUT metadata` — atomically creates missing `Transformation` and `RevTransformation` rows alongside the `MetaData` row. Body: `{type: "metadata", checksum: <tf>, result: <result>, value: <record>}`.
62
+ - `GET metadata` — return the canonical record body for a `tf_checksum`.
63
+ - `GET irreproducible` — return all rows for a `tf_checksum`, optionally filtered by `result`. Each row includes `checksum`, `result`, and `metadata`.
64
+ - `PUT irreproducible` — move a normal entry into `IrreproducibleTransformation`, preserving metadata.
65
+
66
+ The remote-client equivalents are `set_execution_record`, `get_execution_record`, and `get_irreproducible_records` in `seamless-remote`.
67
+
68
+ See the [agent contract](https://github.com/sjdv1982/seamless/blob/main/docs/agent/contracts/execution-records.md) for the full behavioral spec.
22
69
 
23
70
  ## Role in the Seamless ecosystem
24
71