Skip to content

Migration: ProjectSettings.multinomial missing on projects saved before stochastic transitions #554

Open

Description

@RomeshA

Found in review of #539.

Problem

Model.__init__() reads settings.multinomial. A ProjectSettings object pickled before this attribute existed has no such attribute, so loading an older project and calling run_sim() raises AttributeError: 'ProjectSettings' object has no attribute 'multinomial'. Verified by deleting the attribute from a fresh settings object.

The existing migration _add_end_year_to_project_settings only runs for projects below version 1.17.0.

Implementation plan

  1. Bump the Atomica version and add a migration in atomica/migration.py for Project and Result that sets settings.multinomial = False when the attribute is missing. Follow the pattern of _add_end_year_to_project_settings.
  2. As a belt-and-braces measure, make Model.__init__ use getattr(settings, "multinomial", False).
  3. Add a test that loads a project saved under the previous version (there are existing version-pinned fixtures in tests/) and runs it.
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions