Hi everyone,
Is there a way to create a tag that would return the number of active scripts running on a server?
https://docs.inductiveautomation.com/display/DOC80/Diagnostics+-+Running+Scripts
I would like to create an alarm notification if the number is greater than 0 for a sustained amount of time.
Thanks!
I would like to do this also. Does anyone know if this is possible?
You could run this somewhere on the gateway and write the results to a tag using your mechanism of choice:
from com.inductiveautomation.ignition.common.script import ScriptManager
list(ScriptManager.executingScripts())
1 Like
I ran this in a script console directly on the gateway server, and all I got was an empty square bracket:
Jython 2.7.2 (uncontrolled:000000000000, Jan 25 2022, 14:39:15)
[OpenJDK 64-Bit Server VM (Azul Systems, Inc.)] on java11.0.15
I tried multiple times. What is the result supposed to look like?
I wouldn’t expect this to work on the script console even in a designer on the same gateway server. You should set up a gateway message handler that runs the code and logs it/writes to a tag. You can then trigger that message handler via script console. But script console still runs as a designer/client scope, which is different from the gateway scope.
3 Likes
I executed the scrip at the gateway level (inside a tag) and the result is written in a string memory tag.
I got this result:
[com.inductiveautomation.ignition.common.script.ScriptManager$ExecutionInfo@3a1ca159, com.inductiveautomation.ignition.common.script.ScriptManager$ExecutionInfo@5286a490]
How do I know how much time each script is executing?