Skip to content

experiment_config should be a dataclass, not a 19-key dict #28

Description

@12yuens2

Raised by #9 (Phase 6), where it broke the same test fixture three times.

build_experiment_configs produces a dict per experiment from vars(args), and it is consumed three ways:

  • run_experiment unpacks it one experiment_config[key] per line, so a new flag means a new line there and a KeyError in every test fixture that builds a config by hand. Three flags were added on the Phase 6 branch and test_sweep.build_config had to be edited three times.
  • results.identity and _write_failed_experiment read the same keys again by string with .get(key, "") defaults, so a typo produces an empty column rather than an error.
  • the file names thread through as one string per file per call, down two levels.

A frozen dataclass built from vars(args) collapses all three: one place that names the fields, KeyError at construction rather than deep inside a worker, and no .get defaults papering over a typo. results.experiment_key — the --resume key — becomes a method on it rather than a string-keyed lookup that has to agree with a CSV header.

Not done in #9 by direction: refactors that do not stop a sweep finishing were kept out of that phase.

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

    tech-debtRefactor / debt cleanup, not a behaviour bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions