Killing Gateway Scripts Via Scripting

We have some scripts that do some heavy lifting in regards to pulling historical tag data out of our Canary Historian and parsing items together. There is an issue with having a bunch of concurrent users and requesting a large amount of data that cause some scripts to lock up. We’re working separately on that issue, but as a fail-safe, has anyone found a way to access/kill gateway scoped scripts via scripting?

We have some tags with alarming that trigger if the CPU for the gateway exceeds 80% for some period of time. Ideally, if that triggers, we could run a script that kills any currently running scripts that have been running for more than 15 minutes or something along those lines instead of manually having to kill them every time. Has anyone found a way to access that information and kill a script programmatically as opposed to manually going through and clicking the buttons to kill it?

In addition to the threadId, each element in the executingScripts() list will have a startTime long timestamp.

You might also consider restructuring to use a work queue to throttle Canary access. I would use a custom thread pool, but there are numerous ways to approach the problem.

Hmm. Maybe I should add a reference implementation to

1 Like

This is great, it will at least give us a temporary holdover until we can solve the root issue, thanks!