Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Measure scripts don't run with python-statemachine>=2.4 #739

Open
alexdewar opened this issue Dec 10, 2024 · 0 comments
Open

Measure scripts don't run with python-statemachine>=2.4 #739

alexdewar opened this issue Dec 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@alexdewar
Copy link
Collaborator

For some reason, ever since we updated python-statemachine to 2.4.0, measure scripts haven't been running. We possibly didn't notice because you have to explicitly update your poetry environment with poetry install in order to get the newer versions of packages (and this bug).

To reproduce:

  1. Ensure your virtual env is up to date by running poetry install
  2. Connect to dummy devices
  3. Start running a measure script
  4. The progress bar will be stuck on the "moving to x" step forever

If you downgrade python-statemachine with pip install python-statemachine==2.3.6 then it will magically start working again.

The underlying problem seems to be that the ScriptRunner.finish_moving() method isn't actually being called anymore when the move.end device message is sent via PubSub. finish_moving() is a "transition" which is a kind of callable object defined by the python-statemachine library for changing between states. No idea why this is the case, but PyPubSub does save these subscribed functions using weak refs, so maybe that's the culprit? Who knows.

Wrapping finish_moving() in a regular method works as a workaround, but I'm slightly concerned that the same kind of issue is present elsewhere, so I'd rather not do this (plus, what we're doing should work!). There is a @dependabot PR open to bump the version to 2.5.0 (#735) but this doesn't fix things, sadly.

I think I'll pin the version for now and when I've got time I'll try to root-cause it so we can report it upstream. Ideally we don't want to have to keep the version pinned forever.

@alexdewar alexdewar added the bug Something isn't working label Dec 10, 2024
alexdewar added a commit that referenced this issue Dec 10, 2024
The latest version has a bug which means that measure scripts no longer work properly (see #739). Pin to an older version for now until it can be fixed upstream.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant