Long-running jobs and running things at once
embed, faces and a full scan can each run for hours. This is what you can
safely do while they are going, and what happens when you stop them.
What is safe to run together
Section titled “What is safe to run together”Reading, always. The database is opened in WAL mode, which allows one writer
and many readers at once. All of these are fine against a live
videre watch or a running embed:
videre search "sunset" # reads stored vectorsvidere stats # reads the databasevidere report --show-faces # serves a live pagesqlite3 ~/.videre/hashes.db "SELECT COUNT(*) FROM file_hashes"videre watch and videre report --show-faces are specifically designed to run
at the same time.
Two different commands. Locks are per command per database, so
videre embed and videre locations can run together as far as locking is
concerned.
The same command against different databases. Locks are keyed by the database path, so two libraries never block each other.
What is refused
Section titled “What is refused”The same command twice against one database. The second invocation is refused rather than allowed to interleave writes. This is what stops a cron job from stacking up when a run takes longer than its interval.
What is allowed but a bad idea
Section titled “What is allowed but a bad idea”Run them one after another instead:
videre embed && videre facesIf you keep watch running, stop it first or restrict it to stages that do not
decode:
videre watch ~/Photos --scan --location # safe alongside a manual embedvidere locations blocks writers for its whole run. It does its work in a
single transaction, measured at about 8 minutes on a 70,000 file library, and
holds the write lock throughout. A concurrent watch write will wait. Run it
when nothing else needs to write.
Interrupting
Section titled “Interrupting”Ctrl-C is safe on every long-running command. None of them can leave the database in a broken state, because work is committed as it goes rather than at the end.
| Command | What a Ctrl-C costs |
|---|---|
scan |
Files not yet recorded. --retry-incomplete picks them up |
embed |
Up to --chunk rows, 500 by default |
faces |
Up to workers x batch images, ~160 with defaults |
classify |
Very little; it is fast to redo |
prune |
Nothing. Already-committed changes stand, and it is idempotent |
locations |
The whole run, since it is one transaction. Nothing is left half-done |
fix-dates |
Files already changed stay changed. See below |
Resuming
Section titled “Resuming”There is no resume flag. Rerunning is resuming, because each command only looks for work that has not been done:
videre embed # stopped after 12,000 photosvidere embed # continues from 12,001What makes that reliable is that each command records work that produced no result, not just work that produced one:
facesrecords every image it examined, including images with no faces in them. Otherwise every landscape photo would be re-examined forever.scanrecords a type ofapplication/octet-streamfor files it could not identify, so they are not reopened on every--retry-incomplete.
The exception: fix-dates
Section titled “The exception: fix-dates”fix-dates writes to your files, and an interrupt leaves the files it already
processed with their new timestamps and the rest with their old ones. That is
not corruption, but it is a partial result you cannot tell apart from a complete
one by looking.
Rerunning is harmless: it sets the same timestamps again. Use --dry-run first
so you know the full scope before starting.
Checking on a background job
Section titled “Checking on a background job”videre stats(running now) appears next to a command whose lock is currently held by a live
process. That is how you tell a running job from a crashed one.
videre stats --check exits nonzero if any command’s last run failed or
crashed, which is what to put in cron. A clean Ctrl-C records interrupted and
is deliberately not treated as a problem.
If a job died without cleaning up, for example a kill -9, a power loss, or an
out-of-memory kill, its row says running while no process holds the lock, and
stats reports it as crashed. Simply rerun the command.
Suggested order for a fresh library
Section titled “Suggested order for a fresh library”videre scan ~/Photos # first, everything depends on itvidere watch ~/Photos --heic # optional: makes faces ~70x faster on HEIC, then Ctrl-Cvidere embed # hoursvidere faces # hoursvidere classify # minutes, needs embedvidere locations # minutesSequential, deliberately. The parallelism that would help is already inside
faces, which uses twice your core count by default.