Currently Running Scripts Description

Is there a way to add a description to a thread so the description appears on the Currently Running Scripts page?

I’ve noticed a new section on the Gateway under Status->Diagnostics->Running Scripts which I’m finding really useful for some of my long running scripts.

I start my long running scripts using system.util.invokeAsynchronous() and can then identify the thread ID using this code:

import threading
ThreadId = threading.currentThread().ident

I’m then able to identify my scrip on the gateway page.
It would be really useful to also be able to add a description to these threads in my code so they’re even easier to identify!

You can do this with java’s Thread class constructors. With your background task suitably wrapped. (In lieu of system.util.invokeAsynchronous.)

Hmm, we should add an overload to invokeAsynchronous to do this - that’s a good idea. As it is now, invokeAsync tries to copy your description from the outer scope. You can manually provide one (that will render on the status page) by calling com.inductiveautomation.ignition.common.script.ScriptContext#setDescription from inside your async thread:

from com.inductiveautomation.ignition.common.script import ScriptContext
ScriptContext.setDescription("some description")
3 Likes