⚠️ Potential issue | 🟠 Major
Avoid writing the shared model pickle from per-task completion hooks.
Each hook does a read/append/write on {model}.pkl, while run_all() schedules many rows for the same model. If two completions overlap, one write can clobber the other's row. Persist per-task files instead, or aggregate and write once in the flow.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@benchmarks/mof/classification/classification.py` around lines 97 - 101, The
per-task on_completion hook used in widom_insertion.with_options calls
save_result which reads/appends/writes a shared "{model}.pkl", causing race
conditions when run_all schedules many rows; change the behavior so each task
writes its own unique file (e.g., include row id or task id in the filename) or
accumulate results in memory and perform a single write for model.pkl after all
tasks complete (move aggregation out of the on_completion hook into the
run_all() flow); update references where save_result is used to either produce
per-task files or to return results to the caller for final aggregation instead
of mutating the shared model pickle.
Originally posted by @coderabbitai[bot] in #84 (comment)
Avoid writing the shared model pickle from per-task completion hooks.
Each hook does a read/append/write on
{model}.pkl, whilerun_all()schedules many rows for the same model. If two completions overlap, one write can clobber the other's row. Persist per-task files instead, or aggregate and write once in the flow.🤖 Prompt for AI Agents
Originally posted by @coderabbitai[bot] in #84 (comment)