Skip to content

UnboundLocalErrors popping up when Protocols fail #1845

@IAlibay

Description

@IAlibay

This is something I actually fixed in #1774 but the fix accidentally didn't make it into the v1.9 release.

Our protocols try/except around the reporter & sampler creation as well as the simulation running now. The idea is that in the finally step, we clean up any leftover objects, since those tend to be slow to be garbage collected (if at all) and can lead to memory bloating in executors like Alchemiscale.

Historically this was only around the simulation running, but now it's been extended to the sampler & reporter creation. However, because of this, there's a non-zero way that you can crash early (e.g. during sampler or integrator creation) and hit the finally block. This will then lead to an UnboundLocalError, since e.g. the sampler hasn't been created yet.

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