-
-
Notifications
You must be signed in to change notification settings - Fork 428
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
Allow to run rules using scheduler to avoid "Failed to execute rule ‘{}' with status '{}'" error path #4072
Comments
Allow to run rules using scheduler to avoid "Failed to execute rule ‘{}' with status '{}'" error path
…{}' with status '{}'" error path (openhab#4072)
…{}' with status '{}'" error path (openhab#4072) Signed-off-by: Oleg Kleshchev <kjiec4@gmail.com>
…{}' with status '{}'" error path (openhab#4072) Signed-off-by: Oleg Andreych <kjiec4@gmail.com>
I commented on the PR because I didn't see this issue at first. Here is a better place to have the discussion. This might be a breaking change. Right now when one rule calls another rule, the call blocks until the called rule returns. For example:
with longrunning
produces the following output:
If I understand this proposal that behavior would change and the call to |
Hello) It’s not a change, but an addition.
It’s up to automation scripting addons maintainers/designers to decide how to expose new calling methods (instead or besides the existing) and whether to expose them at all. My aim is to expose some API for running rules to the Groovy scripting without the need to resort to getting services from the OSGi and without errors on parallel execution. I thought this PR would be a good first step. |
Talking about code snippets. As I’ve said earlier, it’s up to maintainers/designers of an addon to decide how to expose new API. One way to solve an issue with immediate return and reordering would be to wait for a Awaiting can be done inside the addon and not be exposed to the addon user/script writer. Another way can be to return Future/Promise from the As far as I understand, snippets are JS scripting examples. Unfortunately, I’m not familiar with JS scripting addon internals and not confident that there are no pitfalls with proposed strategies to mitigate early return from If you have a proposal on how to make an API more convenient or useful - I’m all ears. |
If this is just additional functionality then I've no concerns. I misunderstood and thought the proposal was to change the current behavior which could cause some problems. |
In case there's no more objections, can someone approve pull request? |
I don't have that power. A maintainer needs to come along and review the PR. |
I came across this issue, because I also ran into these errors. So can someone tell me what will be happening with this pull request? Or is there a workaround for the problem? |
Use a personal library instead of a Script if that is supported for the language you are using. |
You can try this solution https://www.openhab.org/addons/automation/groovyscripting/#code-reuse. It works for me since I've added it to the doc. |
Thanks, will have a look at both solutions. |
I propose to use
org.openhab.core.automation.internal.TriggerHandlerCallbackImpl#getScheduler
when calling scripts to resolve an issue with simultaneous executions, as it is done for "normal" rules execution path.That's needed for a code reuse using UI scripts.
Many rules are triggered with events with no known intervals and/or timing, so there's no sensible way to spread executions of these rules, so that they don't call scripts simultaneously.
An example of an issue can be found there: https://community.openhab.org/t/simultaneous-calling-of-script-problem/140087.
The text was updated successfully, but these errors were encountered: