Normalize raw session metadata before ingest in the nightly cron - #354
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add a step to the nightly local cron that reconciles the per-session index metadata stored in the raw acquisition files (
.npy) with the database beforepopulate_rigingests them.docker/cron_common.sh: new cron helper that runs the repo's existing raw-metadata resync entrypoint in theclientcontainer, using the same setup as the scenario runner (vr4mice_check_env_file+BASE_INSTALL+source .env).cron_script.sh: invoke it aftercompose upand beforevr4mice_run_cron_scenario local.The resync action itself already exists in the repo; this PR only invokes it from the cron.
Why
Some session tables (
exp.Session/SessionScoreSheet) use a per-session index that is baked into the raw files as part of their primary key. A duplicated value colliding with an earlier session makes the new session silently skipped on ingest — it never lands in the database, with no error. The resync recomputes thecorrect values from the database, removing the collision at the source before ingest.
Behavior / notes
clientcontainer against/data/data, aftercompose up(containers up) and beforepopulate_rigmoves files toprocessed/.cron_script.shusesset -euo pipefail, so if the resync (or its env check) fails, the run aborts and the raw files are left untouched indata/datafor the next run — rather than ingesting inconsistent metadata.cron_script.shand notcron_script_aws.sh.crontabchange — the step lives inside the script.Testing
Ran the resync entrypoint on the production server: it corrected freshly-acquired files whose stored index was inconsistent, and was a verified no-op on already-correct files.
The new cron helper is a thin wrapper that runs exactly that entrypoint with the standard cron environment.