Skip to content

Avoid multiple runs trying to write to the same pickle file #85

Description

@chiang-yuan

⚠️ 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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions