I am interested in knowing more about the script execution system in Ignition.
We usually have gateway scripts and TagChange scripts running on the same project, and It would be nice to know which scripts are going to be executed with priority, of if there is a way to prioritize in case concurrent scripts triggers.
Each kind of gateway event uses its own thread model, and run independently (parallel) of other event types. Java and Jython are fully multi-threaded, unlike CPython.
Some event types offer a single shared thread or a dedicated thread per event definition, selectable.
Most event types, like gateway tag change events, simply use a dedicated thread per event definition. (Multiple tags assigned to such an event are processed one at a time, in order.) If you want two threads handling various tag events, split the lists of tags across multiple definitions. These event types never drop events, though you might crash your gateway on memory usage if your scripts don't keep up, on average.
Tag events, defined directly on the tag (outside the project), use a thread pool, size three, to run tag events in parallel. If more than three scripts are running from this source, more events will queue up. Unlike the queue for project-based tag change events, tag events have per-tag queues limited to five entries. Any events that occur with a full queue will set the missed event flag and be discarded.
Expression tags have their own thread pool, also size three, that will be used for any expressions involving runScript().
Tag events (on the tag) and runScript() calls should always be designed to run in single digit milliseconds, or you risk blocking all other tags' scripts/expressions. Some rules of thumb for tag event scripts: