Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 24 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# mini_sim_db

Tiny simulation run tracker.
Tiny local-first simulation run tracker.

Now SQLite-backed (`sqlite3` stdlib) with the same CLI + REST workflow.
Core storage is SQLite (`sim_db.py`). Remote host/client transport now lives in `remote_api/` as an optional module.

- If you pass a `.csv` path (old usage), it is treated as compatibility input and mapped to a sibling `.sqlite3` DB file.
- If that CSV exists and the SQLite file does not, rows are auto-imported on first open.
- `.csv` paths are still accepted for compatibility and map to a sibling `.sqlite3` DB.
- If legacy CSV exists and SQLite does not, rows are auto-imported on first open.

## Quick start (local CLI)

```bash
# default argument stays compatible: ~/sim_db.csv
# actual DB file is ~/sim_db.sqlite3
python sim_db.py init

python sim_db.py add \
Expand All @@ -21,29 +19,36 @@ python sim_db.py add \
--status start

python sim_db.py done --case case_001

# easy inspection table
python sim_db.py list --table
python sim_db.py list --table --status done --limit 20
```

## Local-first sync workflow (JSON artifact)

```bash
# inspect unsynced local updates
python sim_db.py sync-status --table

# optional explicit legacy import
python sim_db.py import-csv --csv ./legacy.csv
# export pending rows to a portable artifact
python sim_db.py sync-export --out ./sync-out.json

# import artifact from another machine
python sim_db.py sync-import --in ./sync-out.json
```

## Quick start (REST)
Sync format: JSON `mini_sim_db_sync_v1` with full row snapshots. Merge policy: per `job_id`, newer `updated_at` wins; if local is newer, import reports a conflict for manual review.

## Optional REST transport

```bash
export SIM_DB_API_TOKEN='replace-me'
python sim_db_server.py --host 127.0.0.1 --port 8765 --db ~/sim_db.csv

python sim_db_client.py --url http://127.0.0.1:8765 --token "$SIM_DB_API_TOKEN" init
python sim_db_client.py --url http://127.0.0.1:8765 --token "$SIM_DB_API_TOKEN" create \
--case c100 --inp c100.inp --bin solver --status start
python sim_db_client.py --url http://127.0.0.1:8765 --token "$SIM_DB_API_TOKEN" summary --status start --limit 20
python remote_api/server.py --host 127.0.0.1 --port 8765 --db ~/sim_db.csv
python remote_api/client.py --url http://127.0.0.1:8765 --token "$SIM_DB_API_TOKEN" health
```

Compatibility entrypoints are kept (`sim_db_server.py`, `sim_db_client.py`).

## Tests

```bash
python -m unittest -v
python3 -m unittest -v
```
1 change: 1 addition & 0 deletions remote_api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Optional remote transport module for mini_sim_db."""
Loading
Loading