Spaces:
Running
Running
Commit History
-
Time every screen, not just the clicks inside a harvest
This task timed almost nothing. A harvest screen recorded the first and last click on its boxes, and that was all. The instruction pages, the calibration, the practice, the quiz, the comprehension rounds, the night blocks and every questionnaire battery produced their answers with no clock on them, so a session's length could not be split into where it went. Every stage in effort_stages and questionnaires is built by the same _fb factory, so wrapping that one function covers the whole task. The intro pages are wrapped where they are shown, and a page revisited with Back is its own record, or the revisit would read as one very long page. Each record carries enter, exit, dwell, how many clicks it took and how long until the first one, which is the response time for a screen whose answer is a click. Clicks are logged for the first time here, ported from task_sl-cu-nicewebrl, each tagged with the screen it happened on. export_timing writes <base>_timing.csv, one row per screen in the or…4db8278
-
Stop the test suite writing to the participant-data repo; log arrivals
test_finish_reorder drives the app end to end with ?pid=SMOKE_final_screen&dev=1, which runs the real finish path: export -> push_to_gitlab -> a commit on the production dataset. Every full pytest run was adding SMOKE_* sessions and randomization_log rows, indistinguishable at a glance from participant data. conftest now clears GITLAB_TOKEN/PROJECT for the test session, so the code under test still runs its real path and no-ops at the network boundary. Also wires up gitlab_save.append_to_log(), which was fully implemented and never called from anywhere. It writes one roster row per session as soon as the pid is known -- before any stage completes -- so a participant who drops out early still leaves a trace. Six days of pilot data went missing in August with no record that anyone had arrived at all. Keyed on the browser session rather than the pid: pilot links are handed out as "pick one at random", so several participants share a pid and keying on it would have logged only the first …a534abf
-
Coalesce per-trial pushes, dedupe _stamped_names, lock final save
- persistence.py (push_current_data): skip queuing a push for a pid whose push is already in flight, instead of piling up behind it. Safe because export_qualtrics.export() re-reads the on-disk data file fresh every call, so an in-flight push already captures a superset of the data by the time it finishes. Cuts per-participant upload volume from ~96 POSTs/~50MB to the intended ~8-10. - persistence.py / web_app.py: _stamped_names was duplicated in both files; persistence.py is now the single canonical source and web_app.py imports it (persistence.py still imports nothing from web_app.py, so the import cycle it was designed to avoid stays avoided). - web_app.py (save_data): the final end-of-session export+push now takes the same per-pid lock push_current_data() uses (via new persistence.get_push_lock), so it can't race a still-in-flight per-trial push on the same CSV file. - export_qualtrics.py: note that occasional "Incomplete record" log lines from the third-party …fbacf4d -
Fix concurrency issues in per-trial push: per-pid lock, keep task refs
Reviewer found 2 concurrency risks in the per-trial online push added in a38e7c8: - persistence.push_current_data() had no coordination against overlapping calls for the same pid, so two trials finishing faster than one export+GitLab round trip could race on the same non-atomically-written CSV file and push a torn snapshot. Added a per-pid asyncio.Lock (_push_locks / _get_push_lock), following the same idiom as web_app.py's _user_locks / get_user_lock(), so overlapping pushes for the same participant serialize while different participants still run concurrently. - effort_stages._run_block only held the fire-and-forget push task in a loop-local variable, reassigned every trial. asyncio.create_task() keeps only a weak reference on the event loop, so a task with no other strong referent can in principle be garbage-collected mid-execution. Added a module-level _bg_push_tasks set that the task is added to on creation and discarded from in the existing done-callback…08f291c -
Extract shared save-and-push logic; trigger it after every trial (was every 120s)
- New persistence.py: push_current_data(pid) extracted from web_app.py's incremental_save(), preserving its exact export_qualtrics/gitlab_save calls and never-raise exception handling. - web_app.py: incremental_save() is now a thin wrapper around persistence.push_current_data(); the 120s ui.timer wiring is unchanged. - effort_stages.py: _run_block fires persistence.push_current_data(pid) after every non-practice trial via asyncio.create_task (not awaited) so a slow/failed network push never blocks progression to the next trial; a done-callback logs any exception that would otherwise be unhandled. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>a38e7c8