Understanding threading in a Python operator

A Python operator must always be written to be thread safe as its methods might be called by different threads and might be called concurrently. Unlike typical Python applications, Python Operators utilize multiple threads.

While only one thread is running python code at a time, due to the Global Interpreter Lock, the executing thread may change at any time as part of the preemption mechanism.

Depending on the SPL topology, the processTuple and processPunctuation functions may be called by more than one threads. Also, again depending on the topology, submitTuple and submitPunctuation might directly call processTuple and processPunctuation of another operator, before returning.