-
-
Notifications
You must be signed in to change notification settings - Fork 404
Fix invalid return type when an effect has aborted #1195
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
Conversation
Hello @vtavernier 👋 I'm your friendly neighborhood bot and would like to say thank you for So that you and other users can test your changes more quickly, If you make changes to your PR, i create a new link to your workflow artifacts. Best regards, |
@vtavernier Sorry, did you test that the proposed changes will fix the problem that effects started via tray do not run? Here the Booteffect nicely works and is stopped.
Would you mind check and test again? |
OK. I have the issue. Sometime setEffect() is called without timeout parameter populated which then defaults to -1 and therefore the effect stops immediately as timeout < 0 is met. Edit: I will take-over from here. Thanks for your support and bringing the initial fix! |
Good catch! I also thought something was different between the tray icon launch and the boot effect but I wasn't familiar enough with the code base to diagnose it. |
@vtavernier I checked in a fixe on the tray issue via PR #1199. In regard of this PR (and I have to admit, I am new to hyperion effects, too), If interpret it right, the intend of the Will this PR do any harm that hyperion will not stop in a defined fashion or reasonable timeline, as the effect script might be a long running sequence? or what should be changed to avoid the highlighted invalid return type issue? |
#1199 Looks good to me, with #1195 and without. As for the
This depends on whether we want to allow the script to run some clean-up after the timeout expires, and prevent errors that could be confusing with the 1st option (since they usually report as "cannot multiply |
@vtavernier Thanks for sharing your view. While thinking further on the topic in parallel, I came to the conclusion too, that doing things right outperform any performance driven optimizations. Given that the individual functions are small units of work, having them finished rightly might be better than pulling the plug the "hard way". So I am going to integrate #1195 into the latest PR and both of us do just some testing.... What do you think? More concerning for me is that I saw that, if you run a background effect, it burns actively CPU cycles, even it is "hidden" by another priority in the source queue. So it does not sleep until it gets into focus again. |
I also think it's not necessary to pull the plug the "hard way" as you put it. The effect module functions do a negligible amount of work: they would maybe run one time too many between the timeout and the next Letting the effects complete gracefully seems the most sensible option to me, and it does simplify the code (less checks for timeouts, no return type change, no need to document this effect in the Python module API, functions do behave as expected no matter the timeout). As for the resources issue, on limited hardware, the background effects indeed put substantial strain on the CPU when enabled (on a Raspberry Pi Zero, the Rainbow Swirl consumes 20%CPU constantly). Maybe adding a
|
@vtavernier While removing the stratements... In the various methods Sample:
|
I think it could be left that way. I only removed the "check timeout and return none" parts so the rest can be left as-is. In the case of |
Thanks. I now get the point (which I might have missed before). |
@vtavernier I just incorporated the changes of PR into #1199 to just having everything at one place for testing the PR. Thank you again very much for your time on getting this fix in place!!! Looking forward seeing the next PR by yourself ;) |
* Fix 1181, add constants and defaults * Include #1195 changes
* Fix 1181, add constants and defaults * Include hyperion-project#1195 changes
Summary
Fix 9475b93#commitcomment-47646390
This is a follow up to PR #1181: since, before this PR, effects would never stop, fixing this uncovered another bug: when aborting an effect, the
EffectModule
was written to returnNone
on any Python method call. This means that the return type of those methods could change mid-execution, if an effect was considered to have aborted beforehyperion.abort()
was checked again.By not changing the behavior depending on the abort status, the effect scripts don't crash when an abort is requested. We still have to check if this fixes launching effects from the tray, but I currently don't have access to the hardware setup to check that.
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing setups:
The PR fulfills these requirements:
Fixes: #xxx[,#xxx]
, where "xxx" is the issue number)If adding a new feature, the PR's description includes:
PLEASE DON'T FORGET TO ADD YOUR CHANGES TO CHANGELOG.MD
To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.
Other information: