Python package Jedi called by its own thread (GIL)
M. Gronle (approved)
Branch: jediCallThread
jediCallThread
Branch: master
master
Merged
#51 · Created · Last updated
Merged pull request
Merged in jediCallThread (pull request #51)
85601df·Author: M. Gronle·Closed by: M. Gronle·2020-10-23
Description
Now, all calls to the python package jedi (auto completion, calltips, goto assignment / definition) are handled by a thread, using the global interpreter lock (GIL) of Python. All requests to jedi are managed by the new class PythonJediRunner, that is instantiated by the PythonEngine. Calls to this runner are wrapped by PythonEngine (as before). All requests to jedi are managed by a FIFO queue, such that jedi is not called in parallel. However all calls to jedi are done in their own Python thread, such that other Python executions (like single line commands, script executions etc.) can now be done “almost” in parallel.
This fixes one issue: If you opened itom (especially under linux) and started typing in the command line: import numpy as np and pressed Return, this command was blocked for a coupe of seconds, since jedi was started before to parse the auto completion for numpy. However, this needs a little bit of time for the first time. Now, jedi parses in the 2nd thread and the command is directly executed, independent on the current state of jedi.
Now, all calls to the python package jedi (auto completion, calltips, goto assignment / definition) are handled by a thread, using the global interpreter lock (GIL) of Python. All requests to jedi are managed by the new class PythonJediRunner, that is instantiated by the PythonEngine. Calls to this runner are wrapped by PythonEngine (as before). All requests to jedi are managed by a FIFO queue, such that jedi is not called in parallel. However all calls to jedi are done in their own Python thread, such that other Python executions (like single line commands, script executions etc.) can now be done “almost” in parallel.
This fixes one issue: If you opened itom (especially under linux) and started typing in the command line: import numpy as np and pressed Return, this command was blocked for a coupe of seconds, since jedi was started before to parse the auto completion for numpy. However, this needs a little bit of time for the first time. Now, jedi parses in the 2nd thread and the command is directly executed, independent on the current state of jedi.